Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

/DynaPDF/Web Edition/Create PDF
Function:
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /DynaPDF/Web Edition/Create PDF
This example is the version from Sun, 23th Sep 2017.
Project "Create PDF.rbp"
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 Action() dim pdf as new MyDynapdfMBS create pdf CurrentFile = new WebFile CurrentFile.Filename = "test.pdf" CurrentFile.MIMEType = "application/pdf" CurrentFile.Data = pdf.GetBuffer HTMLViewer1.URL = 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 Action() 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 showurl(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.kcp1252 call pdf.WriteFText pdf.ktaCenter, "My first PDF with REAL Studio Web Edition!" call pdf.SetFont "Times", pdf.kfsNone, 14.0, true, pdf.kcp1252 call pdf.WriteText 50.0, 180.0, "File created: " + d.LongDate call pdf.SetFont "Times", pdf.kfsNormal, 20.0, true, pdf.kcp1252 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 WebPage1.MsgBox ErrorMessage Return 0 // ignore End EventHandler
Property IgnoreWarnings As Boolean
End Class
End Project

See also:

Feedback, Comments & Corrections

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




Links
MBS Xojo tutorial videos