PDF exception handling

PDF Exceptions are problems or unexpected occurrences which can occur within the Java PDF library. JPedal will attempt to deal with these as sensibly as possible.

JPedal can be set to produce a log file which records program operation and any messages.

 

Problems which can arise with PDF files

The PDF file has been corrupted.
A PDF file is a complicated binary structure with its own index. If the PDF file is unencrypted, JPedal will attempt to manually identify the PDF objects in the PDF file. If recovery is not possible JPedal will throw a PdfException which will include details of the problem. If the file is encrypted as well a PdfSecurityException is thrown.

The PDF file is encrypted.
PDF files can have encryption settings to stop general access to the file. The user may need to supply a password to gain access to the PDF file (JPedal provides routines to set the password). If the user has not supplied a password which is valid, a PdfSecurityException will be thrown.

Decoding the PDF file generates a memory error.
We have seen some PDF files with very large images which can require lots of memory. JPedal will try to recover and will generate a message with the prefix [MEMORY] in its log file.

There is a minor problem with the PDF file.
A PDF file may contain a minor issue which does not cause major problems. A message will be written to the log file with the prefix [PDF].

There is a major problem with the PDF file.
A PDF file may contain a major issue in which case a PdfException is thrown which will provide further details.

Some other problem.
If you experience any other PDF problems, please send us the PDF file and full details of the problem so we can ensure it is parsed correctly and any problems encountered are handled as above.

Wherever JPedal can continue, it will log a message. The best way to see what problems may have occurred are inorg.jpedal.PdfDecoder.getPageDecodeStatus(int type)where type is any value Defined in org.jpedal.parser.DecodeStatus. Example usage is shown in org.jpedal.examples.viewer.gui.SwingGUI.