HTML to PDF / DOCX / RTF Java converter library Forums PD4ML v3 Archived Forums (Read Only) Troubleshooting Browser error "File does not begin with ‘%PDF-‘"

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

    Usually the problem happens if an application server or servlet engine runs in a combination with Apache web server. By default Apache tries to optimize PDF delivery by so-called “byteserve” method, which is not correctly interpreted by every browser/acrobat reader plugin versions. To disable the optimization add to Apache’s httpd.conf file the following directive:
    Header unset Accept-Ranges
    Check Apache documentation to learn in which config section the directive should go to.

    #27220

    I have this error (sometimes) when i use PD4ML with Tomcat 5.5.26 server.
    How can i fix it?

    Regards

    #27221

    JSP is text output oriented environment. PD4ML taglib outputs binary data, where file start markers and the document structure (PDF object offsets integrity) is very important.

    If there is some content before tag, the undesired content is sent directly to client’s browser, before outputs the binary PDF data starts with “%PDF-“.

    Another possible reason: PD4ML failed (let’s say ss_css2.jar library is missing) but “Content-type: application/pdf” HTTP header is already sent. Adobe Reader plugin launched and tries to interpret the received data, however actually the data is not PDF bytes, but Java exception stack trace text.

    In any case a good starting point of the problem analyze is to add enable=”false” attribute to , to make sure that HTML passed to PD4ML is correct.

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

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