HTML to PDF / DOCX / RTF Java converter library Forums PD4ML v3 Archived Forums (Read Only) Troubleshooting pd4ml:transform and "Didn’t meet stated Content-Length"

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26737

    UPDATE 06.14.2012
    Here is the most relevant post on stackoverflow. I don’t have the pd4ml source to look into this:
    http://stackoverflow.com/questions/1664996/weblogic-exceeded-stated-content-length-error

    Again the same code works fine on other J2EE servers, it’s specific to web logic and the workaround is to stop setting the content length. Does PD4ML set the content length?

    After upgrading to Oracle 11g Weblogic from Oracle’s OC4J 10g based application server I’m encountering an issue with a page we use pd4ml to generate a PDF. the error message is listed below. This error seems to be encountered by WebLogic users in general when outputting a response that is actually a PDF. Has anyone else experienced this and found a solution?


    JSP:
    <%@ taglib uri="http://pd4ml.com/tlds/pd4ml/2.6" prefix="pd4ml"%><br /> <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %><br /> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><br /> <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %><pd4ml:transform screenWidth="1000" pageFormat="LETTER" pageOrientation="landscape" pageInsets="24,36,24,36,points"><br /> <html><br /> <head><br /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /><br /> <title><br /> Teacher Authorization and Authentication<br /> </title><br /> <link href="${pageContext.request.contextPath}/include/css/style.css" rel="stylesheet" type="text/css" media="screen"/><br /> <link href="${pageContext.request.contextPath}/include/css/display-tag.css" rel="stylesheet" type="text/css" media="screen"/><br /> <link rel="icon" type="image/png" href="${pageContext.request.contextPath}/favicon.ico" /><br /> </head><br /> <br /> <body><br /> <div id="wrapper"><br /> <div id="topheader"><br /> <div id="logo"></div><br /> <h2 class="title"><tiles:getAsString name="title" /></h2><br /> </div><br /> </div><br /> <div style="clear: both;"></div><br /> <div id="page"><br /> <div id="print_content_full"><br /> <div style="clear: both;"></div><br /> <tiles:insertAttribute name="body" /><br /> </div><br /> <br /> <div style="clear: both;"></div><br /> </div><br /> <br /> <br /> </body><br /> </html></pd4ml:transform>

    #29024

    > Does PD4ML set the content length?

    Of course, yes. PDF is binary data, so it always makes sense to set it.

    The problem, you faced with, most probably caused by an undesired text encoding conversion, applied to PDF bytes. For example Latin-1 to UTF-8 – that explains why the actual data amount has grown. Obviously UTF-8 became a default file encoding after you upgraded to Oracle 11g.

    What to do?
    1. Try to run Oracle with file.encoding set to the same value as it was in previous installation
    2. If #1 is not possible, try to add encoding=”UTF-8″ or encoding=”default” attribute to

    Also there are 3 new line characters before – they will be sent before PD4ML started to send PDF bytes. It is a good idea to remove them.

    #29025

    Thank you. Setting the encoding to default fixed it. My point about the call to setContentLength is many forum users, including the sample code I linked to on stackoverflow.com showed a solution involved removing calls to setContentLength. I knew that was not an option for me because the call would be in the pd4ml. So I was hoping to find a solution that didn’t involve removing calls to setContentLength.

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘Troubleshooting’ is closed to new topics and replies.