Android Question HTML to PDF - Offline - <page_break_inside: avoid>

Discussion in 'Android Questions' started by MMORETTI964, Mar 7, 2019.

  1. MMORETTI964

    MMORETTI964 Member Licensed User

    We've a need trying to convert HTML document to PDF.
    I know, there is a way to convert HTML to a bitmap (using a webview) and then convert in PDF (like an image).
    However we need some more control over PDF created (for example using page_break_inside: avoid). Obviously this is not possible passing through a bitmap.
    In some other context (iOs) we use library like BNHTMLPDFKIT who give the ability to transform HTML to "real" pdf (not an image).
    As far as you all know, there is a way to get this result from B4A? Even, seems there are no library to wrap from Android world?

    Many thanks in advance.
    Maurizio
     
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. MMORETTI964

    MMORETTI964 Member Licensed User

    Thank you @Erel

    How can I pass html string to pdfDocument?
    I can't traduce html to pdf.Canvas.DrawText because html was passed from external sources (it's not hardcoded in app).

    Thank you.
    Maurizio
     
  4. MMORETTI964

    MMORETTI964 Member Licensed User

  5. Erel

    Erel Administrator Staff Member Licensed User

    You should use Printer.PrintHtml.
     
  6. MMORETTI964

    MMORETTI964 Member Licensed User

    We've tried but with PrintHtml open a windows, the user should manually select "PDF", ...
    We need to make it programmatically.

    So, we will make a library to get the result as a single operation like:
    HtmlToPdf("my.html","my.pdf")

    Thank you for support.
    Maurizio
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice