Platforms to show: All Mac Windows Linux Cross-Platform

/DynaPDF/Web Edition/Web RTF to PDF Web1
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /DynaPDF/Web Edition/Web RTF to PDF Web1
This example is the version from Sun, 15th May 2021.
Project "Web RTF to PDF Web1.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 TextArea1 Inherits WebTextArea
ControlInstance TextArea1 Inherits WebTextArea
End Control
Control Button1 Inherits WebButton
ControlInstance Button1 Inherits WebButton
EventHandler Sub Action() run End EventHandler
End Control
Control HTMLViewer1 Inherits WebHTMLViewer
ControlInstance HTMLViewer1 Inherits WebHTMLViewer
End Control
Control TextArea2 Inherits WebTextArea
ControlInstance TextArea2 Inherits WebTextArea
End Control
Sub Run() // please note that StyledText class is not fully functional in console apps! // but we use it only as container, which may work well Dim StyledText As New StyledText Dim rtf As String = TextArea1.Text rtf = ReplaceLineEndings(rtf, EndOfLine.UNIX) StyledText.RTFDataMBS = rtf Dim pdf As New DynapdfMBS pdf.SetLicenseKey "Starter" // For this example you can use a Starter, Lite, Pro or Enterprise License Call pdf.CreateNewPDF Nil // We want to use top-down coordinates Call pdf.SetPageCoords pdf.kpcTopDown Call pdf.Append Call pdf.SetFont "Times", pdf.kfsItalic, 20.0, True, pdf.kcpUnicode Call pdf.SetTextRect(50, 50, pdf.GetPageWidth-100, pdf.GetPageHeight-100) TextArea2.Text = pdf.ConvertStyledText(StyledText) // or better call WriteStyledText directy Call pdf.WriteStyledText(pdf.ktaLeft, StyledText) Call pdf.EndPage Call pdf.CloseFile pdfFile = New WebFile pdfFile.Data = pdf.GetBuffer pdfFile.Filename = "test.pdf" pdfFile.MIMEType = "application/pdf" #If XojoVersion >= 2020 Then HTMLViewer1.LoadURL pdfFile.URL #Else HTMLViewer1.URL = pdfFile.URL #EndIf End Sub
Property pdfFile As WebFile
End Class
End Project

See also:

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

Feedback: Report problem or ask question.

The biggest plugin in space...

Start Chat