Q: I am getting an error saying “Unable to find PDF Trailer” when trying to open a PDF document. Do you have idea why this might be happening?
This KB entry applies to all Qoppa’s PDF libraries and components (Java and Android).
A: This error means that our library or component is unable to recognize the document served as a valid PDF document.
The error string is not very intuitive: There is a section in a PDF file called the trailer, which is where we need to start reading the PDF. If we cannot find this trailer (such as when trying to read any non-PDF content), we throw this error. We will be changing it for a future version.
When opening the PDF from a URL
This error generally means that the content served by the web server for the URL that you fed is not a PDF, i.e. the URL might return a 404 error or HTML content. When our library and component tries and reads this as a PDF, it will throws this error.
Verify that the URL that you are passing does point to a PDF by copying and pasting the URL into a browser address bar. If the browser can read the PDF, then it should be OK.
When running in an applet
This error could happen when there is a security issue. In this case, you should see a warning on launching the applet.
Read carefully this warning as there are 2 possible issues:
- Unsigned Jars: Check that all jars in your applet are correctly signed by the same certificate. Read more about signing a jar here.
- Applet Permissions. There should be an information dialog that ask users if they would like to run this applet. Click on “Run” to accept to run the applet and give all appropriate permissions for the applet to run.
Make sure your applet behaves the same as the live demo applets on our website.
Make sure to try and follow all the steps above. If you are still having issue, email us at email@example.com. Make sure to tell us a bit more about the context that you are running in (server, applet, etc…), and send us the PDF that is giving you issue. If you are opening it from a URL, send us a link to it.