Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #27173

    Hi,
    it is a little bit hard. I only want generate A4 paper PDF.

    I have a

    and a div with a lot of lorem ipsum. On the left is all fine, on the right side the text is cut! Only a few chars or maybe only one.

    I want exact positioning on the pdf. For example I want put a box with an exact size of 33 mm. For this I set the setHtmlWidth to 2.83*210
    2.83 because 1mm = 2.83pt

    Also I added margins with setPageInsetsMM results in a cut right side 🙁
    setPageSizeMM is with 210 and 297. Also I added to html style body {width:210mm;height:297mm;}

    All this have no effect of cutting the right side.
    What can I do?

    #30117

    If you define HTML/CSS dimensions in physical units, try
    pd4ml.protectPhysicalUnitDimensions() API call.

    #30118

    Okay. I think that this helped.

    3.78*210 for htmlWidth is correct?

    And a complete other question. I am using the ice pdf viewer and this viewer shows me always the wrong margins on the right side. Do you have a suggestion for an goog pdfviewer?
    Thank you

    #30119

    The way PD4ML scales HTML layout to “paper” media is explained by the link:
    http://pd4ml.com/cookbook/pdf_page_formatting.htm

    PD4ML uses 72dpi to translate screen pixels to physical units, but after the physical dimensions are translated to screen pixels, the entire layout is translated back to physical units (scaled to fit the target media width). The scale factor depends on htmlWidth, target paper format and paper margins.

    protectPhysicalUnitDimensions() protect elements, whose sizes given i.e. in mm, from being scaled at the phase.

    FYI constants used by PD4ML:

    A4 is 595 x 842pt
    MM_PER_INCH = 25.4;
    POINTS_PER_MM = 2.835;
    POINTS_PER_INCH = 72;
    PIXELS_PER_POINT = 1.35;
    PIXELS_PER_PICA = 12 * PIXELS_PER_POINT;

    Regarding a viewer: I’ve got no good tool to recommend, but we definitely have to test PD4ML output with ICE PDF to check what is wrong there.

    #30110

    Hi
    I tried a lot to display correct with icePDF. I attached an picture. Could you find anything out?

    #30111

    Is the issue only with icePDF? Does the doc layout appear in Acroread as expected?

    #30112

    Sorry first thing I have to correct right is the margin 1 cm

    In Adobe it looks correct. Also in other viewers.
    Here is the file attached.
    The issue is not only in icePDF. Also their is a similar issue with open OpenViewerFX.
    OpenViewerFX cuts also the header and footer. The first line of the header is gone also the pagenumber in footer.
    And the same issue at the right side.

    #30113

    If you open the document in Acroread its content is rendered correctly using Times font.
    IcePDF for some reason uses Arial instead (however in doc font info it still refers to Times).

    As for me it is a bug of IcePDF, or its free version restriction (which does not include a font engine, according to the download page).

    I would recommend to generate PDF with TTFs embedded, not relying to built-in viewer fonts.

    #30114

    Hmm… On my workstation it always uses Arial instead of any (even embedded) font.

    #30115

    It looks like the complete restriction of icePDF.
    I added to the html code downloaded your 32MB big fonts.jar and added pd4ml.useTTF(“java:fonts”, true)
    I think this should embbed the required fonts?

    #30116

    Strange!

    pd4ml.useTTF(“java:fonts”, true)
    pd4ml.setDefaultTTFs(“Times New Roman”, “Arial”, “Courier New”)

    After adding this, I see (other as in “normal” pdf viewer) another font face but the margin is correct!
    Very strange.

Viewing 11 posts - 1 through 11 (of 11 total)

The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.