HTML to PDF / DOCX / RTF Java converter library Forums PD4ML Forums Technical questions / Troubleshooting Issue formatting image tag correctly when converting HTML -> PDF

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #33787

    I switched our online wysiwyg editor from CKEditor to Froala. Our users are now running into issues with PD4ML converting the HTML and not formatting the document correctly as it relates to images. For example, below should produce an image with text below it. The Chrome Browser (save as PDF) produces the correct result, but the PD4ML java library produces something quite different. I am using the PD4ML version 4.0.7-SNAPSHOT. I’ve attached the resulting PDFs as well. Anyone know how I can address this? I have tested this html on another pdf library and the format was fine as well (but I would prefer to stick with PD4ML as it’s much faster)

    Class Setup
    private static final int margin_top = 15; private static final int margin_bottom = 15; private static final int margin_left = 15; private static final int margin_right = 15; private static final int htmlPixelWidth = 780; PD4ML pd4ml = new PD4ML(apiKey); pd4ml.setPageSize(PageSize.LETTER); pd4ml.setPageMargins(new PageMargins(margin_left, margin_top, margin_right, margin_bottom, Dimensions.Units.MM)); pd4ml.setHtmlWidth(htmlPixelWidth); pd4ml.useTTF("java:fonts", true); // Embed fonts pd4ml.monitorProgressWith(progressMonitorPD4ML);

    Source HTML
    <img src="https://staging.aframeonline.com/afs/FileView.action?t=df462609-c1d1-4499-9718-1943c419e908&f=24d20468-991e-47e2-9574-50ba9023da58" style="width: 300px; display: block; vertical-align: top; margin: 5px auto 5px 0px; text-align: left;"> Text that should appear below the image

    #33788

    Here are the resulting files (reduced the size so this forum would accept them)

    Attachments:
    You must be logged in to view attached files.
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.