HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML Forums › Technical questions / Troubleshooting › PD4ML_DOCUMENT_VIEW_MODE does not work
- This topic has 3 replies, 2 voices, and was last updated Dec 08, 2022
22:36:09 by Srinivas.Komarina.
-
AuthorPosts
-
December 6, 2022 at 19:14#35828
Hi,
Greetings. Hope you are well! I am trying to render a HTML stream using pd4ml v4. I am able to render the pdf however when i open the pdf it is only set at 70.4% zoom however when i do the same via pd4ml v3, i see pdf as “Fit to Width”. Below is the code i am using
//String PD4ML_DOCUMENT_VIEW_MODE ="pd4ml.document.view.mode"; oLog.infoForced("PD4ML_DOCUMENT_VIEW_MODE"+PD4ML_DOCUMENT_VIEW_MODE); org.zefer.pd4ml.PD4ML pd4ml = new org.zefer.pd4ml.PD4ML(); //com.pd4ml.PD4ML pd4mlNew = new com.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"); m.put (org.zefer.pd4ml.PD4Constants.PD4ML_DOCUMENT_VIEW_MODE,"OneColumn"); pd4ml.setDynamicParams(m); //pd4mlNew.setDynamicData(m); //pd4mlNew.setParam(PD4ML_DOCUMENT_VIEW_MODE,"OneColumn"); 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 see setDynamicParams uses class setParam from v4
public void setDynamicParams(Map paramMap) { if (paramMap != null) { HashMap<Object, Object> hashMap = new HashMap<>(); for (String str : paramMap.keySet()) { if ("pd4ml.sessionid.append".equals(str)) { this.pd4mlNew.setParam("" + str, "" + paramMap.get(str)); continue; } if ("pd4ml.cache.enable".equals(str)) { this.pd4mlNew.setParam("" + str, "" + paramMap.get(str)); continue; } if ("pd4ml.document.date".equals(str)) { this.pd4mlNew.setParam("" + str, "" + paramMap.get(str)); continue; } if ("pd4ml.document.view.mode".equals(str)) { this.pd4mlNew.setParam("" + str, "" + paramMap.get(str)); continue; }
But i still has issues setting the default Page to “Fit Width”
I am using 4.0.15fx2 snapshot
Any suggestions, please?
Regards,
BharatAttachments:
You must be logged in to view attached files.December 7, 2022 at 15:55December 7, 2022 at 15:56#35831We are investigating the issue right now. Sorry it takes that long
December 8, 2022 at 22:36 -
AuthorPosts
You must be logged in to reply to this topic.