Forum Replies Created
-
AuthorPosts
-
in reply to: Out of memory error while converting a dxl file May 7, 2013 at 16:31#29220
extractAttachments() is intended to extract base64-encoded bulky data chunks from DXL (and replace with a reference to a TMP file), before the DXL is passed to XSLT transformer – otherwise it causes XSLT transformer to consume a lot of memory and to lose performance.
extractAttachments() deals with DXL not as with XML, but as with a long string. So it is sensitive to some XML formatting. The version I posted searches/replaces attachments more-less stable. You may use PdfAgent(R7).java or Dxl2Pdf.java extractAttachments() as a usage template (I thought your code is derived from one of the Java classes).
PD4ML may deal equally with attachments originally embedded in DXL or with references to extracted attachments. With the references it is asa a rule more performant.
in reply to: Text running off the page and same email content repeating May 7, 2013 at 14:32#29321If some content does not fit a page width, you’ve got two options: either to extend htmlWidth (in the case the content is scaled down) or to narrow the content, using HTML means.
If the downscaling of the content is not acceptable, just enclose the content into a table and set the table width more-less matching htmlWidth parameter.
In DXL scenario the enclosing table is already there – just find it in XSL and change width=”100%” to width=”800″, for example.
in reply to: Oracle Jserv May 2, 2013 at 17:18#29342Please give a try to the attached JAR – it should call ServletResponse.resetBuffer() instead or ServletResponse.reset().
in reply to: Oracle Jserv May 2, 2013 at 14:51#29340The code line, which throws the exception is marked in our SRC like that:
// ire: changed from sr.resetBuffer() to sr.reset() // for compatibility with servlet API 2.2 sr.reset();
We can produce for you a special version with resetBuffer(), but probably it is better to upgrade your server.
in reply to: PD4ML Page Height May 2, 2013 at 14:33#29336In order to predict a document height for particular conversion conditions, you may perform a fake conversion run and collect the conversion statistics:
https://pd4ml.com/cookbook/pd4ml_conversion_status.htm
You are interested in PD4Constants.PD4ML_DOCUMENT_HEIGHT_PX value. After the HTML doc height is known, you may adjust PDF page height proportionally.Also it is important to distinguish document dimensions in typographic points (“200×750” in your command line) and HTML document height and width, measured in screen pixels.
The following tries to explain the px/pt mapping and scaling:
https://pd4ml.com/cookbook/pdf_page_formatting.htmin reply to: PD4ML Page Height April 30, 2013 at 14:30#29334Would it be possible to publish testprintutf8.html and testprintutf8.pdf here?
in reply to: HTML entities not rendered in PDF April 29, 2013 at 18:31#29337PD4ML resolves entities by default. If it appears in resulting PDF as
"Something Quoted"
I would suspect, it comes to PD4ML in a form
"Something Quoted"
Make sure, that the framework/tool, which produces HTML, does not substitutes ‘&’ occurrences with the corresponding entity on-a-fly.
in reply to: Stop displaying dynamic data when user saves the document April 23, 2013 at 14:44#29310We need 1-2 days to learn/reproduce PDF-saving specific issues. I’ll let you know.
in reply to: Not able to extract a PDF attachment from DXL File April 23, 2013 at 14:42#29324Current XSL by an occurrence of an
<attachment-ref>lookups a matching<attachment>.You would only need to implement (before the closing
</body>) an iterator through<attachment>tags, which tests that there is no referenced<attachment-ref>.The solution is not going to impact the remaining XSL logic.
in reply to: MIME.HTM in the converted PDF April 23, 2013 at 14:27#29289A solution is to learn and parse MIME format of Lotus notes, and to choose the right MIME part to be shown. Currently it simply skips “garbage characters” of binary header and scans the remaining content for known patters. As we see the trick works not in 100% of cases.
in reply to: Out of memory error while converting a dxl file April 23, 2013 at 14:22#29218So it seems extractAttachments() method call takes no effect.
Make sure the method code is in the most actual state (and invoked from your code):
public static final String extractAttachments( String body ) throws IOException { if (body != null) { int index01 = body.indexOf( "<filedata" ); if ( index01 < 0 ) { return body; } StringBuffer sb = new StringBuffer(); int index02 = 0; while (index01 != -1) { String portion = body.substring( index02, index01 ); sb.append( portion ); sb.append( "<tmpfilereference>" ); index02 = body.indexOf( "</filedata>", index01 + 1 ); String fileName = "bin"; int name01 = body.lastIndexOf("name='", index02); if ( name01 > 0 ) { name01 += 6; int name02 = body.indexOf(''', name01); if ( name02 > 0 ) { fileName = body.substring(name01,name02); } } int endtag = body.indexOf( ">", index01 + 1 ); String fileContent = body.substring( endtag + 1, index02 ); byte[] bytes = Base64.decode( fileContent ); File file = File.createTempFile("attachment", "." + fileName); FileOutputStream fos = new FileOutputStream(file); fos.write(bytes); String tmpFileName = file.toURI().toString(); sb.append( tmpFileName ); sb.append( "</tmpfilereference>" ); index02 += 11; index01 = body.indexOf( "<filedata", index02 + 1 ); } sb.append( body.substring( index02 ) ); return sb.toString(); } return null; }in reply to: MIME.HTM in the converted PDF April 22, 2013 at 14:16#29287I replied to the question (to some extend) in the topic:
pdf-generation-troubleshooting-f4/text-running-off-the-page-and-same-email-content-repeating-t704.htmlin reply to: Out of memory error while converting a dxl file April 22, 2013 at 14:11#29216Please check if your Lotus agent (or standalone converter) calls extractAttachments( String dxl ) and after the call the attachment is replaced with something like that:
<tmpfilereference>file:/.../Temp/attachment13685.Undertaking.pdf</tmpfilereference>in reply to: How to add sent date in the header of the document April 22, 2013 at 13:44#29299Currently raw item data is converted to HTML to base64-data tag. CSS style “text-transform: base64” is non-standard, only PD4ML knows how to deal with it. Currently it simply decodes it (and tries to parse/reformat if it is a MIME message).
Currently the decoding module cannot recognise if an encoded raw item is a date and it does not know a target date format. So a solution for the issue would be to implement a new proprietary attribute dateFormat (or something like that) and perform a date conversion when the attribute is present.
The implementation is doable, but it is out of scope of free email support we offer.
Another solution would be to decode the base64 with XSLT means (I just googled http://gandhimukul.tripod.com/xslt/base64-xslt.html ), to cut Lotus specific header bytes from it and to reformat the date as needed, with means of XSLT (as far as I know, there is needed functionality in XSL spec).
in reply to: Text running off the page and same email content repeating April 22, 2013 at 13:27#293181. htmlWidth is a conversion parameter. If you change it for particular conversion call – it impacts the only conversion result. If you change it for all conversions (permanently in your agent code, for example) – it will impact all conversions.
In principle, you may measure the document right side edge with a fake conversion call (https://pd4ml.com/cookbook/pd4ml_conversion_status.htm ) and if it exceeds the default htmlWidth – increase its value.
Another approach would be to limit generated HTML width in XSL. Currently it is set to stretchable value “100%”. Set it absolute in “px”, more-less matching your htmlWidth parameter value.
... <body> <pd4ml-page-footer> <table width="100%"> <tr> <td>Page $[page] of $[total]</td> </tr> </table> </pd4ml-page-footer> <div> <table width="100%"> ...
If the document has, for example, an image, which is wider than the table width/htmlWidth – the trick do not help.
2. DXL format (especially its embedded objects, like bitmaps, attachments, mime-messages) is not well-documented. We workaround problems, learning them by example, but unfortunately we cannot be sure we covered all the species of DXL’s MIME format. In the particular case you faced with something, that does not match the patterns we worked on.
-
AuthorPosts
