B4A Library HtmlToPdf

Similar threads

B4A Library Printing and Pdf creation
B4A Code Snippet [B4X] Bytes To File
B4A Code Snippet [B4X] Use WebView to show large images
B4A Tutorial [B4X] OkHttpUtils2 with Wait For
B4A Code Snippet Drawing Multiline Text


Licensed User
Hello everybody,

I've created this library that converts an html file (or string) to a pdf file programmatically.

A couple of important notes: it only works on devices with SDK versions >= 21 and it cannot read files from the asset folder (you can either copy the file to the internal folder and use it from there or read the content with File.ReadString and use the result)

You can find an example attached to this thread.

  • PalmoHtmlToPdf
    • Events:
      • Finished (Success As Boolean)
    • Functions:
      • ConvertFromFile(DirectoryInput as String,FilenameInput as String,DirectoryOutput as String,FilenameOutput as String)
      • ConvertFromString(htmlData as String, DirectoryOutput as String, FilenameOutput as String)
      • Initialize (EventName As String)