Platforms to show: All Mac Windows Linux Cross-Platform

/DynaPDF/Web Edition/Cards Web


Required plugins for this example: MBS DynaPDF Plugin, MBS CURL Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /DynaPDF/Web Edition/Cards Web

This example is the version from Wed, 3rd Jan 2023.

Project "Cards Web.xojo_binary_project"
Class App Inherits WebApplication
EventHandler Sub Opening(args() as String) 'LoadImageFolder LoadImageRemote End EventHandler
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
Function LoadFile(name as string) As FolderItem // load image from MBS Website Static tempfolder As FolderItem if tempfolder = nil then tempfolder = SpecialFolder.Temporary.Child("Cards") tempfolder.CreateAsFolder End If Dim file As FolderItem = tempfolder.Child(name) // e.g. https://www.monkeybreadsoftware.de/xojo/images/Cards/thumb4.jpg If Not file.Exists Then Dim URL As String = "https://www.monkeybreadsoftware.de/xojo/images/Cards/"+name Dim c As New CURLSMBS c.OptionURL = url Call c.CreateMTOutputFile(file) Dim e As Integer = c.Perform If e <> 0 then Dim DebugLog As String = c.DebugMessages // got error? Check log! Break End If End If Return file End Function
Sub LoadImageFolder() // Please provide your own Cards folder with files: // thumb*.jpg for little thumbnails of pictures // pic*.jpg for actual pictures // back*.jpg for backgrounds as thumbnail pictures // back*.pdf for actual backgrounds as PDF // back*small.pdf for actual backgrounds as PDF with lower resolution Dim f As FolderItem = FindFile("Cards") While Not f.Exists If f.parent.parent = Nil Then Print "Failed to find Cards folder" Break Quit End If f = f.parent.parent.Child("Cards") Wend If f = Nil then Break end if Thumbnails.Append New WebPicture(Picture.Open(f.Child("thumb1.jpg")), Picture.FormatJPEG) Thumbnails.Append New WebPicture(Picture.Open(f.Child("thumb2.jpg")), Picture.FormatJPEG) Thumbnails.Append New WebPicture(Picture.Open(f.Child("thumb3.jpg")), Picture.FormatJPEG) Thumbnails.Append New WebPicture(Picture.Open(f.Child("thumb4.jpg")), Picture.FormatJPEG) pictureFiles.Append f.Child("pic1.jpg") pictureFiles.Append f.Child("pic2.jpg") pictureFiles.Append f.Child("pic3.jpg") pictureFiles.Append f.Child("pic4.jpg") BackPictures.Append New WebPicture(Picture.Open(f.Child("back1.jpg")), Picture.FormatJPEG) BackPictures.Append New WebPicture(Picture.Open(f.Child("back2.jpg")), Picture.FormatJPEG) BackPictures.Append New WebPicture(Picture.Open(f.Child("back3.jpg")), Picture.FormatJPEG) BackPictures.Append New WebPicture(Picture.Open(f.Child("back4.jpg")), Picture.FormatJPEG) backs.Append f.Child("back1.pdf") backs.Append f.Child("back2.pdf") backs.Append f.Child("back3.pdf") backs.Append f.Child("back4.pdf") backsmall.Append f.Child("back1small.pdf") backsmall.Append f.Child("back2small.pdf") backsmall.Append f.Child("back3small.pdf") backsmall.Append f.Child("back4small.pdf") End Sub
Sub LoadImageRemote() // Please provide your own Cards folder with files: // thumb*.jpg for little thumbnails of pictures // pic*.jpg for actual pictures // back*.jpg for backgrounds as thumbnail pictures // back*.pdf for actual backgrounds as PDF // back*small.pdf for actual backgrounds as PDF with lower resolution // load from MBS Website Thumbnails.Append New WebPicture(Picture.Open(LoadFile("thumb1.jpg")), Picture.FormatJPEG) Thumbnails.Append New WebPicture(Picture.Open(LoadFile("thumb2.jpg")), Picture.FormatJPEG) Thumbnails.Append New WebPicture(Picture.Open(LoadFile("thumb3.jpg")), Picture.FormatJPEG) Thumbnails.Append New WebPicture(Picture.Open(LoadFile("thumb4.jpg")), Picture.FormatJPEG) pictureFiles.Append LoadFile("pic1.jpg") pictureFiles.Append LoadFile("pic2.jpg") pictureFiles.Append LoadFile("pic3.jpg") pictureFiles.Append LoadFile("pic4.jpg") BackPictures.Append New WebPicture(Picture.Open(LoadFile("back1.jpg")), Picture.FormatJPEG) BackPictures.Append New WebPicture(Picture.Open(LoadFile("back2.jpg")), Picture.FormatJPEG) BackPictures.Append New WebPicture(Picture.Open(LoadFile("back3.jpg")), Picture.FormatJPEG) BackPictures.Append New WebPicture(Picture.Open(LoadFile("back4.jpg")), Picture.FormatJPEG) backs.Append LoadFile("back1.pdf") backs.Append LoadFile("back2.pdf") backs.Append LoadFile("back3.pdf") backs.Append LoadFile("back4.pdf") backsmall.Append LoadFile("back1small.pdf") backsmall.Append LoadFile("back2small.pdf") backsmall.Append LoadFile("back3small.pdf") backsmall.Append LoadFile("back4small.pdf") End Sub
Property BackPictures() As WebPicture
Property Backs() As folderitem
Property Thumbnails() As WebPicture
Property backsmall() As folderitem
Property pictureFiles() As folderitem
End Class
Class MyDynaPDFMBS Inherits DynaPDFMBS
EventHandler Function Error(ErrorCode as integer, ErrorMessage as string, ErrorType as integer) As integer // output all messages on the console: System.DebugLog str(ErrorCode)+": "+ErrorMessage MessageBox ErrorMessage Return 0 // ignore End EventHandler
Property IgnoreWarnings As Boolean
End Class
End Project

See also:

The items on this page are in the following plugins: MBS DynaPDF Plugin.


The biggest plugin in space...