PDF module doesn't work when streaming via HTTP

Bug #1070615 reported by Chris Hillery
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
New
High
Cezar Andrei

Bug Description

The following query:

import module namespace read-pdf = "http://www.zorba-xquery.com/modules/read-pdf";
import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
declare namespace rpo = "http://www.zorba-xquery.com/modules/read-pdf/read-pdf-options";

let $pdf := fetch:content-binary("http://plugindoc.mozdev.org/testpages/test.pdf")
return
read-pdf:extract-text($pdf, ())

produces the following output:

Oct 23, 2012 5:24:30 PM org.apache.pdfbox.pdfparser.XrefTrailerResolver setStartxref
WARNING: Did not found XRef object at specified startxref position 6577
Oct 23, 2012 5:24:30 PM org.apache.pdfbox.filter.FlateFilter decode
SEVERE: Stop reading corrupt stream
Oct 23, 2012 5:24:30 PM org.apache.pdfbox.filter.FlateFilter decode
SEVERE: Stop reading corrupt stream
<?xml version="1.0" encoding="UTF-8"?>
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;&lt;head&gt;&lt;title&gt;&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;

However, if you download the file test.pdf to your current working directory and change the query to fetch:content-binary("./test.pdf"), you get:

<?xml version="1.0" encoding="UTF-8"?>
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;&lt;head&gt;&lt;title&gt;&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;&lt;p&gt;Your PDF viewing software works!&lt;/p&gt;

&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;

ie, no error output, and the string content of the PDF is displayed.

This not working (as well as bug 1070611) prevents the PDF module from functioning on try-zorba.

Chris Hillery (ceejatec)
Changed in zorba:
importance: Undecided → High
assignee: nobody → Cezar Andrei (cezar-andrei)
milestone: none → 2.8
Revision history for this message
Chris Hillery (ceejatec) wrote :

Assigning back to myself to verify that this is really happening; I recall some local weirdness.

Changed in zorba:
assignee: Cezar Andrei (cezar-andrei) → Chris Hillery (ceejatec)
Chris Hillery (ceejatec)
Changed in zorba:
milestone: 2.8 → 2.9
Revision history for this message
Chris Hillery (ceejatec) wrote :

I'm still able to reproduce this with a clean local build, so I think it's legit.

Changed in zorba:
assignee: Chris Hillery (ceejatec) → Cezar Andrei (cezar-andrei)
Chris Hillery (ceejatec)
Changed in zorba:
milestone: 2.9 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.