Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #35787

    Hi,

    Greetings. Hope you are well! I have a code rendering the HTML to pdf using both v 3 and v4. However in v3, it renders right but in v4 it does not render the entire HTML and format does not look good as well. This is the code i am using

    org.zefer.pd4ml.PD4ML pd4ml = new org.zefer.pd4ml.PD4ML(); java.awt.Insets margins = new java.awt.Insets(30,25,30,25); // Add letter border (top, left, bottom, right) pd4ml.setPageInsetsMM(margins); pd4ml.setPageSize(org.zefer.pd4ml.PD4Constants.A4); pd4ml.protectPhysicalUnitDimensions(); pd4ml.interpolateImages(true); java.util.Map m = new java.util.HashMap(); m.put(org.zefer.pd4ml.PD4Constants.PD4ML_ABSOLUTE_ADDRESS_SPACE, "document"); pd4ml.setDynamicParams(m); java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(); org.zefer.pd4ml.PD4PageMark footer = new org.zefer.pd4ml.PD4PageMark(); footer.setPageNumberTemplate("$[page] of $[total]"); footer.setPageNumberAlignment(org.zefer.pd4ml.PD4PageMark.RIGHT_ALIGN); footer.setColor(new java.awt.Color(0x303030)); footer.setInitialPageNumber(1); footer.setPagesToSkip(0); footer.setFontSize(11); footer.setAreaHeight(20); pd4ml.setPageFooter(footer); pd4ml.render(new java.io.StringReader(HTMLStream), baos); baos.close(); return baos.toByteArray();

    I have attached the screen shots of pdfs rendered via v3 and v4. Please have a look

    Attachments:
    You must be logged in to view attached files.
    #35790

    Hi! Could you please also share the source HTML doc with us?

    #35791

    Hi, Greetings. Here is the source html. Same HTMl renders fine with pd4ml v3 but not with pd4ml v4

    _Junk pdf is from pd4ml v4, other pdf is from pd4ml v3

    Attachments:
    You must be logged in to view attached files.
    #35795

    Hi,

    Greetings. Did you get a chance to look at this?

    Regards,
    Bharat

    #35798

    Hi,

    Greetings. Hope you are well! Did you get a chance to look at the source html and see why the pdf is not rendering right when using pd4ml v4?

    Regards,
    Bharat

    #35799

    Hi! The problem comes from strangely defined PDF margins in v4 version.

    Here is the API calls dump of v3:
    % PD4ML version: 3100.PRPC.1 Pro % JDK version: 1.8.0_342 % OS version: Linux 3.10.0-1160.76.1.el7.x86_64 % File encoding: UTF-8 % insets: java.awt.Insets[top=85,left=71,bottom=85,right=71] % size: java.awt.Dimension[width=595,height=842] % protectPhysicalUnitDimensions % interpolate: true % footer: % pn tpl lng: 19 % pn alg: 2 % init pn: 1 % skp: 0 % fn sz: 11 % hgh: 20

    As you can see the margins (aka insets) are set to moderate values in typographic points: [top=85,left=71,bottom=85,right=71], and the page size matches A4: [width=595,height=842]

    When you call v4, the settings differ:
    % PD4ML DIAGS % % Version: 4.0.13 % JDK version: 1.8.0_352 % OS version: Linux 3.10.0-1160.80.1.el7.x86_64 % file encoding: UTF-8 % supplied license 'java:pd4ml.lic...': v=true, i=true, p=true, pa=true, pb=true, pr=true, rt=true % setPageMargins: [null] l:142.0, t:142.0, r:142.0, b:142.0 % setPageMargins: [null] l:141.75, t:141.75, r:141.75, b:141.75 % setPageSize: null,595x842 % % protectPhysicalUnitDimensions % injectHtml*: 469 true % ttf: java:/defaultfonts % setPageMargins: [null] l:142.0, t:142.0, r:142.0, b:142.0 % userspace=640 % setPageSize: null,440x623

    The page margin are suspiciously huge: l:142.0, t:142.0, r:142.0, b:142.0
    And the page size for some reason degraded to 440×623 from initial 595×842(A4).

    I would recommend to start the troubleshooting with a switch from Version: 4.0.13 to 4.0.15fx2 – obviously you do not use PD4ML v4 API directly, but PD4ML v3 -> v4 API wrapper classes. We fixed few issues with the default page settings in the meantime.

    And please check your code to determine where 142pt margins come from.

    The attached is PDF output of the current v4 build.

    Attachments:
    You must be logged in to view attached files.
    #35801

    Hi,

    Greetings. Thank you. The attached pdf from v4 does not render the entire html. Is the pdf that you attached rendered using the source html that I sent? Moreover we are not setting any page margins, all we are doing is setting insets. If you render the source html via v4.0.15,did you see the entire html?

    Regards,
    Bharat

    #35802

    I can generate the entire content only if I explicitly define the document height:
    body { height: 150cm; }

    Your HTML layout consists of absolutely positioned blocks. Such layout for some reason makes actual document height computation incorrect. I’ve opened the internal ticket to fix the issue with the top priority. But the above style can be used as a temporal workaround.

    > Moreover we are not setting any page margins, all we are doing is setting insets.
    In PD4ML v3 we called the “page margins” as “page insets”. But they mean the same in the context.

    #35803

    Thank you. All we do is in the java code to set insets as below

    java.awt.Insets margins = new java.awt.Insets(30,25,30,25);

    Do I need to mention the style in the html source to display the entire content?

    Regards,
    Bharat

    #35804

    > Do I need to mention the style in the html source to display the entire content?
    Try the style as an experiment.
    Also try to define java.awt.Insets(0,0,0,0) to see if it impacts the resulting page margins.

    From our side it is difficult to guess where l:142.0, t:142.0, r:142.0, b:142.0 margins may come from.

    #35805

    Thank you, adding style and setting insets as 0,0,0,0 rendered the entire HTML however it is cutting off the text from right and PDF when opens is only by default opening at 95.1%, please see attached latest one after adding new changes.

    Regards,
    Bharat

    Attachments:
    You must be logged in to view attached files.
    #35807

    Thank you! Most probably an upgrade from 4.0.13 to 4.0.15fx2 helps with the huge margins and the right edge content cut.
    The correct document height calculation needs to be solved on our side.

    #35808

    Thank you, is there any reference number i should be aware of for the resolution of document height calculation?

    Regards,
    Bharat

    #35809

    And also if at all is there any workaround for this right edge content cut with current version 4.0.13, we are on time critical timelines and upgrading it to a new version of pd4ml should involve the vendor as license is bundled with Pega.

    Regards,
    Bharat

    #35810

    We’ll add you to the help desk ticket participants so that you can track the status and get the possible workaround ideas. Unfortunately I cannot do it right now by technical reasons. I’ll update you with the status on Monday.

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.