Forum Replies Created
-
AuthorPosts
-
in reply to: Header and footer overwrite text November 18, 2014 at 13:53#29612
//**************************************************<br /> // Get Pd4ml and rendering<br /> //***************************************************<br /> <br /> /*<br /> * Create Box styles<br /> */<br /> // [....]<br /> // Mail Text<br /> StringBuffer testoStyle = new StringBuffer("span.mailTextAddress {");<br /> testoStyle.append("position:absolute;");<br /> testoStyle.append("width: " + (width - testoMargineS - testoMargineD) + "mm;");<br /> testoStyle.append("top: " + testoMargineSup + "mm;");<br /> testoStyle.append("left: " + testoMargineS + "mm;");<br /> testoStyle.append("right: " + testoMargineD + "mm;");<br /> testoStyle.append("}");<br /> stili.add(testoStyle.toString());<br /> // Address Box<br /> StringBuffer boxAddressStyle = new StringBuffer("span.boxAddress {");<br /> boxAddressStyle.append(" width: " + pdfmlay.getPdfmIndDestiDimX().intValue() + "mm;");<br /> boxAddressStyle.append(" height: " + pdfmlay.getPdfmIndDestiDimY().intValue() + "mm;");<br /> boxAddressStyle.append("position: absolute;");<br /> boxAddressStyle.append("top:" + destMargineSup + "mm;");<br /> boxAddressStyle.append("left:" + destMargineSx + "mm;");<br /> boxAddressStyle.append("}");<br /> stili.add(boxAddressStyle.toString());<br /> <br /> // Create Pd4ml object<br /> PD4ML pd4ml = getPd4ml(sessionDo, PD4Constants.A4, stili.toArray(new String[stili.size()]), null, null);<br /> <br /> /*/*/<br /> InputStream is = new ByteArrayInputStream(input.getHTML().getBytes());<br /> InputStreamReader isr = new InputStreamReader(is);<br /> try {<br /> pd4ml.render(isr, outs1);<br /> ps = new PrintStream(outs);<br /> ps.write(outs1.toByteArray());<br /> outs.flush();<br /> } catch (InvalidParameterException e) {<br /> e.printStackTrace();<br /> throw new ErroreApplicativo(e);<br /> } catch (IOException e) {<br /> e.printStackTrace();<br /> throw new ErroreApplicativo(e);<br /> } finally {<br /> if (ps != null) {<br /> ps.close();<br /> }<br /> }<br /> <br /> <br /> <br /> <br /> //**************************************************<br /> // Build Pd4ml<br /> //***************************************************<br /> public static PD4ML getPd4ml(MainSessionDo sessionDo, java.awt.Dimension pageSize, String[] styles, Rectangle myHeader, Rectangle myFooter)<br /> throws ErroreApplicativo {<br /> PD4ML pd4ml = new PD4ML();<br /> pd4ml.setPageInsets(new Insets(80, 40, 80, 60));<br /> <br /> pd4ml.setPageSize(pageSize); // landscape page orientation<br /> pd4ml.protectPhysicalUnitDimensions();<br /> pd4ml.setHtmlWidth(780);<br /> <br /> <br /> /* <hr class="bbcode_rule" /> Header <hr class="bbcode_rule" /> */<br /> PD4PageMark header = new PD4PageMark();<br /> ImgInfo infoH = getTempImg(sessionDo, input, "H", letpar); // get img header<br /> String dir = infoH.getImgPath();<br /> if (dir.trim().length() > 0) {<br /> dir = getFileHttpProtocol(dir, false);<br /> header.setAreaHeight(-1);<br /> <br /> if (myHeader == null) {<br /> myHeader = new Rectangle(infoH.getPosX().intValue(), infoH.getPosY().intValue(), infoH.getWidth().intValue(), infoH.getHeight().intValue());<br /> } else {<br /> if (infoH.getWidth().intValue() <= myHeader.getWidth() && infoH.getHeight().intValue() <= myHeader.getHeight())<br /> myHeader.setSize(infoH.getWidth().intValue(), infoH.getHeight().intValue());<br /> }<br /> header.setWatermark(dir, myHeader, 255);<br /> }<br /> /* <hr class="bbcode_rule" /> Footer <hr class="bbcode_rule" /> */<br /> PD4PageMark footer = new PD4PageMark();<br /> ImgInfo infoF = getTempImg(sessionDo, input, "F", letpar); // get img footer<br /> footer.setAreaHeight(-1);<br /> footer.setFontSize(20);<br /> footer.setPagesToSkip(1);<br /> footer.setTitleAlignment(PD4PageMark.RIGHT_ALIGN);<br /> footer.setPageNumberAlignment(PD4PageMark.LEFT_ALIGN);<br /> dir = infoF.getImgPath();<br /> if (dir.trim().length() > 0) {<br /> dir = getFileHttpProtocol(dir, false);<br /> <br /> if (myFooter == null) {<br /> myFooter = new Rectangle(infoF.getPosX().intValue(), infoF.getPosY().intValue(), infoF.getWidth().intValue(), infoF.getHeight().intValue());<br /> } else {<br /> if (infoH.getWidth().intValue() <= myFooter.getWidth() && infoH.getHeight().intValue() <= myFooter.getHeight())<br /> myFooter.setSize(infoH.getWidth().intValue(), infoH.getHeight().intValue());<br /> }<br /> footer.setWatermark(dir, myFooter, 255);<br /> }<br /> <br /> pd4ml.setPageHeader(header);<br /> pd4ml.setPageFooter(footer);<br /> <br /> // Add styles<br /> if (styles != null) {<br /> for (int i = 0; i < styles.length; i++) {<br /> if (styles<i> != null) {<br /> pd4ml.addStyle(styles<i>, true);<br /> }<br /> }<br /> }<br /> <br /> return pd4ml;<br /> }<br /> <br /> <br /> <br />
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.
<br /> lPd4ml.useTTF("D:\Jakarta\tomcat-FEATURE2\server\webapps\ROOT\WEB-INF", true);<br />
You can use the following to generate de pd4fonts.properties file:
<br /> //Through commandline:<br /> java -jar pd4ml_demo.jar -configure.fonts c:WindowsFonts "D:Jakartatomcat-FEATURE2serverwebappsROOTWEB-INF"<br /> <br /> //Or by code:<br /> PD4Util.generateFontPropertiesFile("c:WindowsFonts", "D:\Jakarta\tomcat-FEATURE2\server\webapps\ROOT\WEB-INF");<br />
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??<br /> import it.solarisistemi.base.ErroreApplicativo;<br /> import it.solarisistemi.base.logs.LogEntry;<br /> <br /> import java.awt.Insets;<br /> import java.awt.Rectangle;<br /> import java.io.ByteArrayInputStream;<br /> import java.io.ByteArrayOutputStream;<br /> import java.io.File;<br /> import java.io.FileOutputStream;<br /> import java.io.IOException;<br /> import java.io.InputStream;<br /> import java.io.InputStreamReader;<br /> import java.io.PrintStream;<br /> import java.security.InvalidParameterException;<br /> import java.util.ArrayList;<br /> <br /> import org.zefer.pd4ml.PD4Constants;<br /> import org.zefer.pd4ml.PD4ML;<br /> import org.zefer.pd4ml.PD4PageMark;<br /> <br /> public class ProvaPD4ML {<br /> <br /> public static void main(String[] args) throws ErroreApplicativo {<br /> PD4ML pd4ml = new PD4ML();<br /> <br /> pd4ml.setPageInsetsMM(new Insets(15, 0, 15, 0));<br /> <br /> pd4ml.setPageSize(PD4Constants.A4); // landscape page orientation<br /> pd4ml.protectPhysicalUnitDimensions();<br /> pd4ml.setHtmlWidth(780);<br /> <br /> /* <hr class="bbcode_rule" /> Header <hr class="bbcode_rule" /> */<br /> PD4PageMark header = new PD4PageMark();<br /> header.setAreaHeight(-1);<br /> header.setFontSize(20);<br /> header.setPagesToSkip(1);<br /> String dir = getFileHttpProtocol(getImgTempPath(), true);<br /> header.setWatermark(dir, new Rectangle(10, 10, 200, 100), 255);<br /> <br /> /* <hr class="bbcode_rule" /> Footer <hr class="bbcode_rule" /> */<br /> PD4PageMark footer = new PD4PageMark();<br /> footer.setAreaHeight(-1);<br /> footer.setFontSize(20);<br /> footer.setPagesToSkip(1);<br /> footer.setWatermark(dir, new Rectangle(10, 700, 200, 100), 255);<br /> <br /> pd4ml.setPageHeader(header);<br /> pd4ml.setPageFooter(footer);<br /> <br /> ArrayList<String> styles = new ArrayList<String>();<br /> <br /> StringBuffer pageStyle = new StringBuffer("span.indirizzo {");<br /> pageStyle.append("position: absolute; top: 50mm; left: 120mm;");<br /> pageStyle.append("border: 1px solid red;");<br /> pageStyle.append("}");<br /> styles.add(pageStyle.toString());<br /> <br /> pageStyle = new StringBuffer("span.lettera {");<br /> pageStyle.append("position: absolute; top: 90mm; left: 15mm;");<br /> pageStyle.append("border: 1px solid blue;");<br /> pageStyle.append("}");<br /> styles.add(pageStyle.toString());<br /> <br /> if (styles != null) {<br /> <br /> for (int i = 0; i < styles.size(); i++) {<br /> if (styles.get(i) != null) {<br /> pd4ml.addStyle(styles.get(i), true);<br /> }<br /> }<br /> }<br /> <br /> StringBuffer letteraHtml = new StringBuffer("");<br /> letteraHtml.append("<span class='indirizzo'>");<br /> letteraHtml.append("SOLARI SISTEMI");<br /> letteraHtml.append("<br /> VIA CREMONA, 10");<br /> letteraHtml.append("<br /> 25025 BRESCIA BS");<br /> letteraHtml.append("</span>");<br /> <br /> letteraHtml.append("<span class='lettera'>");<br /> for (int i = 0; i < 100; i++) {<br /> letteraHtml.append("<br /> LoremIposum " + i);<br /> }<br /> letteraHtml.append("</span>");<br /> <br /> InputStream is = new ByteArrayInputStream(letteraHtml.toString().getBytes());<br /> InputStreamReader isr = new InputStreamReader(is);<br /> <br /> FileOutputStream outs = null;<br /> PrintStream ps = null;<br /> ByteArrayOutputStream outs1 = new ByteArrayOutputStream(16000);<br /> <br /> try {<br /> File myfile = new File("C:\tmp\pd4ml.pdf");<br /> if (myfile.exists()) {<br /> myfile.delete();<br /> myfile = new File("C:\tmp\pd4ml.pdf");<br /> }<br /> <br /> outs = new FileOutputStream(myfile);<br /> ps = new PrintStream(outs);<br /> <br /> pd4ml.render(isr, outs1);<br /> ps = new PrintStream(outs);<br /> ps.write(outs1.toByteArray());<br /> outs.flush();<br /> System.out.println("Fine");<br /> <br /> } catch (InvalidParameterException e) {<br /> e.printStackTrace();<br /> throw new ErroreApplicativo(e);<br /> } catch (IOException e) {<br /> e.printStackTrace();<br /> throw new ErroreApplicativo(e);<br /> } finally {<br /> if (outs != null) {<br /> try {<br /> outs.close();<br /> } catch (IOException e) {<br /> ;<br /> }<br /> }<br /> if (ps != null) {<br /> ps.close();<br /> }<br /> }<br /> <br /> }<br /> <br /> public static String getFileHttpProtocol(String path, boolean utfUrlEncode) {<br /> String url = path.replace(':', '|').replaceAll("/", File.separator).replaceAll("\\", "\\\\");<br /> url = "file:///" + url;<br /> return url.trim();<br /> }<br /> <br /> public static String getImgTempPath() {<br /> String path = "";<br /> <br /> String tempDir = System.getProperty("java.io.tmpdir");<br /> LogEntry.debug("PDFI - System temp directory :: " + tempDir);<br /> File fileTemp = new File(tempDir + File.separatorChar + "solari.png");<br /> if (fileTemp.exists()) {<br /> path = fileTemp.getAbsolutePath();<br /> }<br /> return path.trim();<br /> }<br /> <br /> }<br /> <br />
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
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
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
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.
http://pd4ml.com/support/html-pdf-faq-f1/pd4ml-table-breaks-t736.html<br /> TABLE {page-break-inside: auto !important}<br /> TR {page-break-inside: avoid;}<br />
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#269755,650 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"><br /> <a title="This is "my" title" data-toggle="tab" href="#ofsdo_18_sdfsd_078"><br /> This is "my" title<br /> </a><br /> </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