Forum Replies Created

Viewing 15 posts - 481 through 495 (of 1,410 total)
  • Author
    Posts
  • in reply to: Out of memory error while converting a dxl file
    #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.

    #29321

    If 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
    #29342

    Please give a try to the attached JAR – it should call ServletResponse.resetBuffer() instead or ServletResponse.reset().

    in reply to: Oracle Jserv
    #29340

    The 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
    #29336

    In 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.htm

    in reply to: PD4ML Page Height
    #29334

    Would it be possible to publish testprintutf8.html and testprintutf8.pdf here?

    in reply to: HTML entities not rendered in PDF
    #29337

    PD4ML 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
    #29310

    We 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
    #29324

    Current 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
    #29289

    A 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
    #29218

    So 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
    in reply to: Out of memory error while converting a dxl file
    #29216

    Please 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
    #29299

    Currently 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
    #29318

    1. 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.

Viewing 15 posts - 481 through 495 (of 1,410 total)