Subscribe

Unknown type: Comment

  1. 2010-09-23 15:15:27 PDT
    Hi, Thank you for the effort on PDFClown, it seems to be great so far. I've run into a slight snag. I generate many PDFs from HTML, using PD4ML. I am now trying to use PDFClown to combine them into a single PDF with bookmarks. PDFClown fails to .clone() Documents generated using PD4ML and I can't figure out why, nor how to fix it. My source code is as follows: final File testoutput = Pd4mlImpl.getInstance(HTMLToPdf.Implementation.Pd4ml).convert(new File("/Users/sone/test.html")); final File srcPDF = new File("/Users/sone/test.pdf"); testoutput.renameTo(srcPDF); it.stefanochizzolini.clown.files.File outputFile = new it.stefanochizzolini.clown.files.File(); final Document outputDocument = outputFile.getDocument(); final PageManager pageManager = new PageManager(outputDocument); pageManager.add(new it.stefanochizzolini.clown.files.File(srcPDF.getAbsolutePath()).getDocument()); Here is the error I get from PDFClown: Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unknown type: Comment at it.stefanochizzolini.clown.objects.PdfIndirectObject.getDataObject(PdfIndirectObject.java:199) at it.stefanochizzolini.clown.files.IndirectObjects.addExternal(IndirectObjects.java:207) at it.stefanochizzolini.clown.objects.PdfIndirectObject.clone(PdfIndirectObject.java:152) at it.stefanochizzolini.clown.objects.PdfReference.clone(PdfReference.java:168) at it.stefanochizzolini.clown.objects.PdfArray.clone(PdfArray.java:86) at it.stefanochizzolini.clown.documents.Page.clone(Page.java:255) at it.stefanochizzolini.clown.documents.Page.clone(Page.java:64) at it.stefanochizzolini.clown.documents.Document.contextualize(Document.java:173) at it.stefanochizzolini.clown.documents.Document.contextualize(Document.java:185) at it.stefanochizzolini.clown.tools.PageManager.add(PageManager.java:91) at it.stefanochizzolini.clown.tools.PageManager.add(PageManager.java:74) at test.URLsToPDF.main(URLsToPDF.java:113) Caused by: java.lang.RuntimeException: Unknown type: Comment at it.stefanochizzolini.clown.tokens.Parser.parsePdfObject(Parser.java:796) at it.stefanochizzolini.clown.objects.PdfIndirectObject.getDataObject(PdfIndirectObject.java:196) I naively attempted to get things to work by modifying Parser.java, adding the "missing" case statement for Comment, making it return an empty pdf string. The errors went away, but it was obviously the wrong thing to do, as the output PDF simply contained two (apparently) blank pages. Here's a link to the PD4ML PDF I am using as a test case, which fails to .clone using PDFClown: http://dl.dropbox.com/u/1987709/test.pdf
  2. 2010-09-25 09:13:54 PDT
    Thank you for your report: this issue has been solved by PDF Clown 0.0.8.2 Patch [1]. It was caused by unhandled comment lines within indirect object entries. Stefano [1] https://sourceforge.net/tracker/?func=detail&aid=3075555&group_id=176158&atid=876125
  3. 2010-09-27 13:18:53 PDT
    Works like a charm! Much appreciated, Stefano.
Jump To:
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.