1
0
-1

Hi,

Is it possible to pass custom html to the PDF receipt renderer? We'd like to avoid the need to re-work receipt styling in the form and would rather generate HTML dynamically containing the form data. Then have this HTML processed by the PDF renderer rather then the form styled / generated HTML.

Cheers,
Dan.

  1. Dan Cormick

    And we'd like for this to be the receipt TM stores, it won't be sent to the user. Our admin will receive a Secure Email link, login, and then download the receipt.

CommentAdd your comment...

1 answer

  1.  
    1
    0
    -1

    Try ITextPdf's XMLWorker

    import com.itextpdf.tool.xml.XMLWorkerHelper;

    byte[] pdfInByteArray;
    try {
     String k = "<html><body> This is my test html</body></html>";

                ByteArrayOutputStream os = new ByteArrayOutputStream();

                Document document = new Document();

          PdfWriter writer = PdfWriter.getInstance(document, os);

     document.open();

               InputStream is = new ByteArrayInputStream(k.getBytes());

          XMLWorkerHelper.getInstance().parseXHtml(writer, document, is);

          document.close();

          pdfInByteArray = os.toByteArray();

          os.close();






    }

    catch (Exception e) { e.printStackTrace(); }

    return pdfInByteArray



      CommentAdd your comment...