Error: Cannot parse (FILE)c:/prueba3.pdf as a PDF file IN FIREFOX

534 views
Skip to first unread message

Question

unread,
May 24, 2016, 6:30:24 AM5/24/16
to qz-print
Hi,

I've a problem when I print a document (PDF,TXT,HTML,... ) through Firefox, the browser show me the next message: "Error: Cannot parse (FILE)c:/prueba3.pdf as a PDF". The same test works in IE11, Chrome...

Any suggestions?

Thank you!!

Tres Finocchiaro

unread,
May 24, 2016, 7:44:16 AM5/24/16
to Question, qz-print
Our software doesn't care which browser you use and we test PDF printing on all major browsers (including Firefox).  Most likely the issue you are running into is on your side (authentication, login session, permission).

First, the location you are printing from looks suspicious.  Does it work if you move the file into the demo folder?

-Tres

--
You received this message because you are subscribed to the Google Groups "qz-print" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tres Finocchiaro

unread,
May 24, 2016, 11:35:12 AM5/24/16
to Carlos Neila Ramos, qz-p...@googlegroups.com
Putting the mailing list back on CC.

Java doesn't have your login session or credentials when you pass the URL, so if there is any authentication involved, it won't work.

Clients tend to use base64 in that case and send via Ajax, etc and I suspect that to be your problem.

I don't believe this to be a QZ Tray problem but rather an access problem with the PDF.

One way to test is to open a new private/incognito browser and try to access the PDF.  If the private browser can't access, neither will QZ Tray (Java runs as a separate process).

If you don't want to open up security to fix this (we don't blame you!), try to use a base64 encoder and append it that way instead.

https://qz.io/wiki/2.0-pixel-printing#base64-pdf




 

On May 24, 2016 8:13 AM, "Carlos Neila Ramos" <carlos.ne...@gmail.com> wrote:
Hi Tres,

Firstly  thank you for your answer.

In the server doesn't work any example. On the other hand if I execute in my computer sample.html works.

I attached the log.

2016-05-24 14:02:04,491 [ERROR] Failed to print
java.lang.UnsupportedOperationException: Cannot parse (FILE)http://localhost:8080/hphis/curso/demo/assets/prueba3.pdf as a PDF file
    at qz.printer.action.PrintPDF.parseData(Unknown Source)
    at qz.ws.PrintSocketClient.processPrintRequest(Unknown Source)
    at qz.ws.PrintSocketClient.processMessage(Unknown Source)
    at qz.ws.PrintSocketClient.onMessage(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.jetty.websocket.common.events.annotated.CallableMethod.call(CallableMethod.java:70)
    at org.eclipse.jetty.websocket.common.events.annotated.OptionalSessionCallableMethod.call(OptionalSessionCallableMethod.java:68)
    at org.eclipse.jetty.websocket.common.events.JettyAnnotatedEventDriver$2.run(JettyAnnotatedEventDriver.java:210)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.IOException: Error: End-of-File, expected line
    at org.apache.pdfbox.pdfparser.BaseParser.readLine(BaseParser.java:1110)
    at org.apache.pdfbox.pdfparser.COSParser.parseHeader(COSParser.java:1875)
    at org.apache.pdfbox.pdfparser.COSParser.parsePDFHeader(COSParser.java:1846)
    at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:242)
    at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:973)
    at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:875)
    ... 13 more
Reply all
Reply to author
Forward
0 new messages