Forum Replies Created
-
AuthorPosts
-
in reply to: Header and footer overwrite text November 18, 2014 at 13:53#29612
//************************************************** // Get Pd4ml and rendering //*************************************************** /* * Create Box styles */ // [....] // Mail Text StringBuffer testoStyle = new StringBuffer("span.mailTextAddress {"); testoStyle.append("position:absolute;"); testoStyle.append("width: " + (width - testoMargineS - testoMargineD) + "mm;"); testoStyle.append("top: " + testoMargineSup + "mm;"); testoStyle.append("left: " + testoMargineS + "mm;"); testoStyle.append("right: " + testoMargineD + "mm;"); testoStyle.append("}"); stili.add(testoStyle.toString()); // Address Box StringBuffer boxAddressStyle = new StringBuffer("span.boxAddress {"); boxAddressStyle.append(" width: " + pdfmlay.getPdfmIndDestiDimX().intValue() + "mm;"); boxAddressStyle.append(" height: " + pdfmlay.getPdfmIndDestiDimY().intValue() + "mm;"); boxAddressStyle.append("position: absolute;"); boxAddressStyle.append("top:" + destMargineSup + "mm;"); boxAddressStyle.append("left:" + destMargineSx + "mm;"); boxAddressStyle.append("}"); stili.add(boxAddressStyle.toString()); // Create Pd4ml object PD4ML pd4ml = getPd4ml(sessionDo, PD4Constants.A4, stili.toArray(new String[stili.size()]), null, null); /*/*/ InputStream is = new ByteArrayInputStream(input.getHTML().getBytes()); InputStreamReader isr = new InputStreamReader(is); try { pd4ml.render(isr, outs1); ps = new PrintStream(outs); ps.write(outs1.toByteArray()); outs.flush(); } catch (InvalidParameterException e) { e.printStackTrace(); throw new ErroreApplicativo(e); } catch (IOException e) { e.printStackTrace(); throw new ErroreApplicativo(e); } finally { if (ps != null) { ps.close(); } } //************************************************** // Build Pd4ml //*************************************************** public static PD4ML getPd4ml(MainSessionDo sessionDo, java.awt.Dimension pageSize, String[] styles, Rectangle myHeader, Rectangle myFooter) throws ErroreApplicativo { PD4ML pd4ml = new PD4ML(); pd4ml.setPageInsets(new Insets(80, 40, 80, 60)); pd4ml.setPageSize(pageSize); // landscape page orientation pd4ml.protectPhysicalUnitDimensions(); pd4ml.setHtmlWidth(780); /* <hr class="bbcode_rule" /> Header <hr class="bbcode_rule" /> */ PD4PageMark header = new PD4PageMark(); ImgInfo infoH = getTempImg(sessionDo, input, "H", letpar); // get img header String dir = infoH.getImgPath(); if (dir.trim().length() > 0) { dir = getFileHttpProtocol(dir, false); header.setAreaHeight(-1); if (myHeader == null) { myHeader = new Rectangle(infoH.getPosX().intValue(), infoH.getPosY().intValue(), infoH.getWidth().intValue(), infoH.getHeight().intValue()); } else { if (infoH.getWidth().intValue() <= myHeader.getWidth() && infoH.getHeight().intValue() <= myHeader.getHeight()) myHeader.setSize(infoH.getWidth().intValue(), infoH.getHeight().intValue()); } header.setWatermark(dir, myHeader, 255); } /* <hr class="bbcode_rule" /> Footer <hr class="bbcode_rule" /> */ PD4PageMark footer = new PD4PageMark(); ImgInfo infoF = getTempImg(sessionDo, input, "F", letpar); // get img footer footer.setAreaHeight(-1); footer.setFontSize(20); footer.setPagesToSkip(1); footer.setTitleAlignment(PD4PageMark.RIGHT_ALIGN); footer.setPageNumberAlignment(PD4PageMark.LEFT_ALIGN); dir = infoF.getImgPath(); if (dir.trim().length() > 0) { dir = getFileHttpProtocol(dir, false); if (myFooter == null) { myFooter = new Rectangle(infoF.getPosX().intValue(), infoF.getPosY().intValue(), infoF.getWidth().intValue(), infoF.getHeight().intValue()); } else { if (infoH.getWidth().intValue() <= myFooter.getWidth() && infoH.getHeight().intValue() <= myFooter.getHeight()) myFooter.setSize(infoH.getWidth().intValue(), infoH.getHeight().intValue()); } footer.setWatermark(dir, myFooter, 255); } pd4ml.setPageHeader(header); pd4ml.setPageFooter(footer); // Add styles if (styles != null) { for (int i = 0; i < styles.length; i++) { if (styles[i] != null) { pd4ml.addStyle(styles[i], true); } } } return pd4ml; }in reply to: pdf generated empty November 19, 2014 at 13:07#29601I cannot find stdout or equivalent for Domino, I am looking at the Domino console, i.e., log.nsf.
If I create an error like change http://…. to htxx://… in the URL I get error information saying the protocol is wrong.what I get is:
19/11/2014 12:58:57 HTTP JVM: f:dataEW0008.pdf 19/11/2014 12:58:57 HTTP JVM: http://www.domain.com/v4/CTR0101.nsf/lookupParent/EW0008?OpenDocument 19/11/2014 12:58:57 HTTP JVM: version: PD4ML 380fx6 Pro (eval) 19/11/2014 12:58:57 HTTP JVM: done in 140ms.
But, the PDF is blank
in reply to: • shown as ? November 20, 2014 at 11:01#29606I wandered why I didn’t find this problem sooner, and found out this problem is introduced between version 3.85fx6 and 3.91.
I followed your advice and used TTF’s.
I added the following code when creating the pdf.lPd4ml.useTTF("D:\Jakarta\tomcat-FEATURE2\server\webapps\ROOT\WEB-INF", true);You can use the following to generate de pd4fonts.properties file:
//Through commandline: java -jar pd4ml_demo.jar -configure.fonts c:WindowsFonts "D:Jakartatomcat-FEATURE2serverwebappsROOTWEB-INF" //Or by code: PD4Util.generateFontPropertiesFile("c:WindowsFonts", "D:\Jakarta\tomcat-FEATURE2\server\webapps\ROOT\WEB-INF");And with this changes is everything now working again.
Thank you for your help.in reply to: pdf generated empty November 22, 2014 at 14:58#29602Is there an equivalent in Domino to Port 10039 in Websphere or are ports 80 and 443 enough?
in reply to: Header and footer overwrite text November 24, 2014 at 15:36#29611Hi,
I’ll post another error example.
I’m trying to print a pdf with 100 lines, a header and a footer.
Some lines (n 33, 85) are not printed and the text overwrite header and footer.
Any idea??import it.solarisistemi.base.ErroreApplicativo; import it.solarisistemi.base.logs.LogEntry; import java.awt.Insets; import java.awt.Rectangle; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.security.InvalidParameterException; import java.util.ArrayList; import org.zefer.pd4ml.PD4Constants; import org.zefer.pd4ml.PD4ML; import org.zefer.pd4ml.PD4PageMark; public class ProvaPD4ML { public static void main(String[] args) throws ErroreApplicativo { PD4ML pd4ml = new PD4ML(); pd4ml.setPageInsetsMM(new Insets(15, 0, 15, 0)); pd4ml.setPageSize(PD4Constants.A4); // landscape page orientation pd4ml.protectPhysicalUnitDimensions(); pd4ml.setHtmlWidth(780); /* <hr class="bbcode_rule" /> Header <hr class="bbcode_rule" /> */ PD4PageMark header = new PD4PageMark(); header.setAreaHeight(-1); header.setFontSize(20); header.setPagesToSkip(1); String dir = getFileHttpProtocol(getImgTempPath(), true); header.setWatermark(dir, new Rectangle(10, 10, 200, 100), 255); /* <hr class="bbcode_rule" /> Footer <hr class="bbcode_rule" /> */ PD4PageMark footer = new PD4PageMark(); footer.setAreaHeight(-1); footer.setFontSize(20); footer.setPagesToSkip(1); footer.setWatermark(dir, new Rectangle(10, 700, 200, 100), 255); pd4ml.setPageHeader(header); pd4ml.setPageFooter(footer); ArrayList<String> styles = new ArrayList<String>(); StringBuffer pageStyle = new StringBuffer("span.indirizzo {"); pageStyle.append("position: absolute; top: 50mm; left: 120mm;"); pageStyle.append("border: 1px solid red;"); pageStyle.append("}"); styles.add(pageStyle.toString()); pageStyle = new StringBuffer("span.lettera {"); pageStyle.append("position: absolute; top: 90mm; left: 15mm;"); pageStyle.append("border: 1px solid blue;"); pageStyle.append("}"); styles.add(pageStyle.toString()); if (styles != null) { for (int i = 0; i < styles.size(); i++) { if (styles.get(i) != null) { pd4ml.addStyle(styles.get(i), true); } } } StringBuffer letteraHtml = new StringBuffer(""); letteraHtml.append("<span class='indirizzo'>"); letteraHtml.append("SOLARI SISTEMI"); letteraHtml.append(" VIA CREMONA, 10"); letteraHtml.append(" 25025 BRESCIA BS"); letteraHtml.append("</span>"); letteraHtml.append("<span class='lettera'>"); for (int i = 0; i < 100; i++) { letteraHtml.append(" LoremIposum " + i); } letteraHtml.append("</span>"); InputStream is = new ByteArrayInputStream(letteraHtml.toString().getBytes()); InputStreamReader isr = new InputStreamReader(is); FileOutputStream outs = null; PrintStream ps = null; ByteArrayOutputStream outs1 = new ByteArrayOutputStream(16000); try { File myfile = new File("C:\tmp\pd4ml.pdf"); if (myfile.exists()) { myfile.delete(); myfile = new File("C:\tmp\pd4ml.pdf"); } outs = new FileOutputStream(myfile); ps = new PrintStream(outs); pd4ml.render(isr, outs1); ps = new PrintStream(outs); ps.write(outs1.toByteArray()); outs.flush(); System.out.println("Fine"); } catch (InvalidParameterException e) { e.printStackTrace(); throw new ErroreApplicativo(e); } catch (IOException e) { e.printStackTrace(); throw new ErroreApplicativo(e); } finally { if (outs != null) { try { outs.close(); } catch (IOException e) { ; } } if (ps != null) { ps.close(); } } } public static String getFileHttpProtocol(String path, boolean utfUrlEncode) { String url = path.replace(':', '|').replaceAll("/", File.separator).replaceAll("\\", "\\\\"); url = "file:///" + url; return url.trim(); } public static String getImgTempPath() { String path = ""; String tempDir = System.getProperty("java.io.tmpdir"); LogEntry.debug("PDFI - System temp directory :: " + tempDir); File fileTemp = new File(tempDir + File.separatorChar + "solari.png"); if (fileTemp.exists()) { path = fileTemp.getAbsolutePath(); } return path.trim(); } }in reply to: Header and footer overwrite text November 25, 2014 at 17:31#29613For the document generation you used PD4ML v380fx3. Try the most recent version – most probably the issue is already resolved.
in reply to: pdf generated empty November 25, 2014 at 18:06#29603“You can review output from a Java agent that is running locally in the Java Debug Console. To activate the console, choose Tools – Show Java Debug Console.”
in reply to: pdf generated empty November 25, 2014 at 18:18#29604Also, inspect an exported DXL file content. If there are
<rawitemdata type='1'>elements – it is a bad sign.The rawitem data type corresponds to TYPE_COMPOSITE, which is raw binary object, exported from Notes database “as is” (not represented as DXL’s
<richtext>element). A parsing of such objects is not a trivial task and it is out of PD4ML scope.The only solution in the case is to force DXLExporter not to output
<rawitemdata type='1'>objects.There are DXLExporter options to control that, but they not always work. See
http://www-01.ibm.com/support/knowledgecenter/#!/SSVRGU_9.0.1/com.ibm.designer.domino.main.doc/H_RICHTEXTOPTION_PROPERTY_EXPORTER.htmlin reply to: Header and footer overwrite text November 26, 2014 at 09:26#29614It doesn’t work even with the new version.
Below the attachment, same java code.in reply to: It seems adjustHtmlWidth doesn’t work December 1, 2014 at 06:13#29593I’ve tried v3.9.3.
But there is still a problem with converting html to rtf.
I set the html width to a big value before I used pd4ml.adjustHtmlWidth(),the font size of the resulting rtf becomes very small.If I set the html width to a smaller value,the right margin will be cut.I am confused that it’s normal to convert html to pdf, the content will auto wrap to a new line,but when I convert to rtf,the font size will be very small or right margin is cut off.
I hope it can auto wrap to a new line to fit to the page width when I convert a html to rtf , but the font size doesn’t become very small.
How can I solve it?
It’s urgent for us,please give us some advice.in reply to: Troubleshooting December 2, 2014 at 14:33#26973Hello All,
One of our users reported that the auto-generated table of contents numbering was not correct. Attached are a few screenshots verifying this.
We have verified this issue in both 3.9.3 demo and the much older 3.7. These PDFs are being generated using Java 7 on a Linux 64 bit machine.
We have enabled Smart Table Breaks. As well, we have a few custom CSS styles added. We added these styles as a fix for this issue we were running into.
https://pd4ml.com/support/html-pdf-faq-f1/pd4ml-table-breaks-t736.htmlTABLE {page-break-inside: auto !important} TR {page-break-inside: avoid;}Our table of contents is defined as:
<pd4ml:page.footer areaHeight='-1' scope='1+' >...$[page] of $[total].... </pd4ml:footer>Please see attached documents for verification. Any ideas on what is causing this?
Thank you so much for any assistance!
Mattin reply to: HTML/CSS rendering issues December 18, 2014 at 14:53#26975<td style="text-align: right;"> <span style="text-decoration:underline;border-bottom: 1px solid #000;">5,650</span></td>
I’ve got the above output that produces a double underline on browser but PD4ML only displays single underline.
Anyone gotten a double underline to work?
in reply to: Troubleshooting December 24, 2014 at 15:56#26976Hello!
I have an html page with quotes inside title attribute:
<li id="someId"> <a title="This is "my" title" data-toggle="tab" href="#ofsdo_18_sdfsd_078"> This is "my" title </a> </li>
If I use pd4ML to convert into pdf/rtf I have an error:
java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:658) at org.zefer.html.doc.PD4MLHtmlParser.buildDocument(Unknown Source) at org.zefer.pd4ml.PD4ML.super(Unknown Source) at org.zefer.pd4ml.PD4ML.render(Unknown Source) version: PD4ML 390b2 Pro
in reply to: General questions / FAQ January 5, 2015 at 13:35#26978response.setContentType( "application/pdf;charset=UTF-8" ); response.setHeader("Content-Disposition", "attachment; filename=" + filename + ".pdf" ); PD4ML pd4ml = new PD4ML(); pd4ml.setPageInsets(new Insets(10, 10, 10, 10));////////// pd4ml.setHtmlWidth(950); pd4ml.setPageSize( PD4Constants.A4 ); pd4ml.useTTF( EgovProperties.getProperty("Globals.pdfFontPath"), true ); pd4ml.enableSmartTableBreaks(true);////////// pd4ml.enableDebugInfo();coding!!
why enableSmartTableBreaks dont…
why data none display??
place help me
version 3.83in reply to: enableSmartTableBreaks bug? January 8, 2015 at 15:37#29641I would recommend to begin with an upgrade to the most recent version of PD4ML v393 (you currently use v385).
There is a fully functional evaluation version is available for download.
-
AuthorPosts
