I am evaluating ICEpdf and wrote some code to play around with pdf files. I am using the latest Open Source version and used the following command:
java -cp icepdf-core.pdf:. test
The code works file on my local desktop, but when I tried to run it on my server, I got the following exception:
Exception in thread "pool-1-thread-1" java.lang.ExceptionInInitializerError
at org.icepdf.core.util.Parser.getObject(Parser.java:315)
at org.icepdf.core.util.LazyObjectLoader.loadTrailer(LazyObjectLoader.java:134)
at org.icepdf.core.util.Library.getTrailerByFilePosition(Library.java:105)
at org.icepdf.core.pobjects.PTrailer.loadXRefStmIfApplicable(PTrailer.java:315)
at org.icepdf.core.pobjects.CrossReference.getEntryForObject(CrossReference.java:197)
at org.icepdf.core.util.LazyObjectLoader.loadObject(LazyObjectLoader.java:68)
at org.icepdf.core.util.Library.getObject(Library.java:120)
at org.icepdf.core.util.Library.getObject(Library.java:172)
at org.icepdf.core.pobjects.Catalog.init(Catalog.java:96)
at org.icepdf.core.pobjects.Document.setInputStream(Document.java:454)
at org.icepdf.core.pobjects.Document.setFile(Document.java:210)
Caused by: java.awt.HeadlessException
at sun.java2d.HeadlessGraphicsEnvironment.getDefaultScreenDevice(HeadlessGraphicsEnvironment.java:64)
at org.icepdf.core.pobjects.Stream.<clinit>(Stream.java:81)
... 15 more
I also tried java -Djava.awt.headless=true -cp icepdf-core.pdf:. test
If we decide to go with ICEpdf, then the system will have to run on the server. The documentation mentions that ICEpdf supports headless mode - do I need to do something to enable it? The server is running Ubuntu 10.04 and Sun JDK v6.
ICEpdf does support headless mode but I mistakenly broke it in the 4.1 release with an unrelated fix. The headless bug is http://jira.icefaces.org/browse/PDF-202 and is fixed on the trunk. Until 4.1.1 is released, which will be soon as a result of this bug you'll have to used 4.0.1 to get around the headless issue or build the core from the repository.
ICEpdf does support headless mode but I mistakenly broke it in the 4.1 release with an unrelated fix. The headless bug is http://jira.icefaces.org/browse/PDF-202 and is fixed on the trunk. Until 4.1.1 is released, which will be soon as a result of this bug you'll have to used 4.0.1 to get around the headless issue or build the core from the repository.
Thanks for the reply - I downloaded 4.0.1 and it works fine. I will continue testing using that version till 4.1.1 comes out.
On an unrelated note, I could not find a way of making a new PDF by extracting a page range from an existing PDF. Is it possible using ICEpdf?
ICEpdf had some can alter annotations but we haven't ventured into page manipulation as of yet. The iText and Multivalent projects specialize in the PDF editing.