Platforms to show: All Mac Windows Linux Cross-Platform
/DynaPDF/Web Edition/Create PDF Web
Required plugins for this example: MBS DynaPDF Plugin
Last modified Mon, 16th Jan 2022.
You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /DynaPDF/Web Edition/Create PDF Web
Download this example: Create PDF Web.zip
Project "Create PDF Web.xojo_binary_project"
Class App Inherits WebApplication
End Class
Class Session Inherits WebSession
Const ErrorDialogCancel = "Do Not Send"
Const ErrorDialogMessage = "This application has encountered an error and cannot continue."
Const ErrorDialogQuestion = "Please describe what you were doing right before the error occurred:"
Const ErrorDialogSubmit = "Send"
Const ErrorThankYou = "Thank You"
Const ErrorThankYouMessage = "Your feedback helps us make improvements."
Const NoJavascriptInstructions = "To turn Javascript on, please refer to your browser settings window."
Const NoJavascriptMessage = "Javascript must be enabled to access this page."
End Class
Class WebPage1 Inherits WebPage
Control Button1 Inherits WebButton
ControlInstance Button1 Inherits WebButton
EventHandler Sub Pressed()
dim pdf as new MyDynapdfMBS
create pdf
CurrentFile = new WebFile
CurrentFile.Filename = "test.pdf"
CurrentFile.MIMEType = "application/pdf"
CurrentFile.Data = pdf.GetBuffer
HTMLViewer1.LoadURL CurrentFile.URL
End EventHandler
End Control
Control HTMLViewer1 Inherits WebHTMLViewer
ControlInstance HTMLViewer1 Inherits WebHTMLViewer
End Control
Control Button2 Inherits WebButton
ControlInstance Button2 Inherits WebButton
EventHandler Sub Pressed()
Dim pdf As New MyDynapdfMBS
create pdf
CurrentFile = new WebFile
CurrentFile.Filename = "test.pdf"
CurrentFile.MIMEType = "application/pdf"
CurrentFile.Data = pdf.GetBuffer
CurrentFile.ForceDownload = true
GoToURL(CurrentFile.url)
End EventHandler
End Control
Control Label1 Inherits WebLabel
ControlInstance Label1 Inherits WebLabel
End Control
Control TextField1 Inherits WebTextField
ControlInstance TextField1 Inherits WebTextField
End Control
Control Link1 Inherits WebLink
ControlInstance Link1 Inherits WebLink
End Control
Sub Create(pdf as dynaPDFMBS)
Dim d As New date
Dim f As FolderItem = SpecialFolder.Desktop.Child("Create PDF.pdf")
pdf.SetLicenseKey "Starter" // For this example you can use a Starter, Lite, Pro or Enterprise License
call pdf.CreateNewPDF nil
call pdf.SetDocInfo pdf.kdiSubject, "My first Xojo output"
call pdf.SetDocInfo pdf.kdiProducer, "Xojo test application"
call pdf.SetDocInfo pdf.kdiTitle, "My first Xojo output"
// We want to use top-down coordinates
call pdf.SetPageCoords pdf.kpcTopDown
call pdf.Append
call pdf.SetFont "Times", pdf.kfsItalic, 40.0, true, pdf.kcpUnicode
call pdf.WriteFText pdf.ktaCenter, "My first PDF with REAL Studio Web Edition!"
call pdf.SetFont "Times", pdf.kfsNone, 14.0, true, pdf.kcpUnicode
call pdf.WriteText 50.0, 180.0, "File created: " + d.LongDate
call pdf.SetFont "Times", pdf.kfsNormal, 20.0, true, pdf.kcpUnicode
call pdf.WriteText 50.0, 240.0, TextField1.text
call pdf.EndPage
call pdf.CloseFile
End Sub
Property CurrentFile As WebFile
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:
- /DynaPDF/Web Edition/Cards Web
- /DynaPDF/Web Edition/Web RTF to PDF Web
- /DynaPDF/Web Edition/WebPDF Web
- /DynaPDF/Web Edition/WebPicture from PDF Page Web
Download this example: Create PDF Web.zip
The items on this page are in the following plugins: MBS DynaPDF Plugin.
