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

    We are mentioning the font size as 10pt in the HTML stream but generated PDF is getting rendered in 11pt
    code Snapshot:

    try{

    String sContent=sHtml;

    org.zefer.pd4ml.PD4ML pd4ml = new org.zefer.pd4ml.PD4ML();

    //pd4ml.resetAddedStyles();
    pd4ml.setPageInsetsMM(new java.awt.Insets(10, 21, 0, 16));
    pd4ml.enableImgSplit(false);
    //pd4ml.addStyle(“color:#8866ff; font-family:Times;”,true);
    java.io.ByteArrayOutputStream os=new java.io.ByteArrayOutputStream();
    java.io.InputStream is=new java.io.ByteArrayInputStream(sContent.getBytes());
    java.io.InputStreamReader ris=new java.io.InputStreamReader(is);
    pd4ml.setCookie(“JSESSIONID”,JSESSIONID);
    pd4ml.setCookie(“Pega-RULES”,PEGARULES);
    //String sFontsProp=”/opt/jdk1.7.0_67/jre/lib/fonts/fonts.properties”;
    pd4ml.useTTF(FontsProp,false);
    java.net.URL base=new java.net.URL(BASEURL);
    pd4ml.render(ris,os,base);

    byte[] byteArray=os.toByteArray();

    // Action == Preview
    if (Action.equalsIgnoreCase(“Preview”)){
    String sPDF=Base64Util.encodeToString(byteArray);
    ClipboardPage workpage = tools.findPage(“pyWorkPage”);
    workpage.putString(“PDFDocument”,sPDF);
    }

    else {
    tools.putParamValue(“PDFDocument”,byteArray);
    }

    }catch(Exception e){

    throw new PRRuntimeException(e.toString());
    }

    #29583

    Initially PD4ML renders a document as for a screen representation (converted all physical units to screen pixels with 72dpi). After the layout is rendered it is stretched or shrank to match the target paper page width. See
    http://pd4ml.com/cookbook/pdf_page_formatting.htm

    if you need to keep physical unit dimensions to exact on the paper, you either need to play with htmlWidth parameter or to trigger pd4ml.protectPhysicalUnitDimensions().

    (A drawback of the API call is a possible misbalance of resulting sizes of objects whose dimensions given in physical units and ones defined in screen pixels)

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

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