Hello, I have read the following thread:
http://groups.google.com/group/jodconverter/browse_thread/thread/54e6292201d0d207/ff16b99300879a79?lnk=gst&q=PDF+to+PDF#ff16b99300879a79
And I would like to know if It's yet posible to do what Devit was
asking.
Since OpenOffice 3 supports PDF editing once you've installed the
proper plugin (wich is correctly installed so I can open PDF files
from OpenOffice Writer), I tried to open an existing PDF and write an
exact copy as a first aproach:
OfficeDocumentConverter converter;
DocumentFormatRegistry documentFormatRegistry = new
DefaultDocumentFormatRegistry();
documentFormatRegistry.getFormatByExtension(PDF).setInputFamily(DocumentFamily.DRAWING);
converter = new OfficeDocumentConverter(officeManager,
documentFormatRegistry);
DocumentFormat format = new DocumentFormat("PDF/A", PDF,
"application/pdf");
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("FilterName", "draw_pdf_Export");
Map<String, Object> filterData = new HashMap<String, Object>();
filterData.put("SelectPdfVersion", 1);
properties.put("FilterData", filterData);
format.setStoreProperties(DocumentFamily.DRAWING, properties);
converter.convert(inputFile, outputFile, format);
But I'm getting the following exception:
org.artofsolving.jodconverter.office.OfficeException: unsupported
conversion
at
org.artofsolving.jodconverter.AbstractConversionTask.storeDocument(AbstractConversionTask.java:
113)
at
org.artofsolving.jodconverter.AbstractConversionTask.execute(AbstractConversionTask.java:
63)
at org.artofsolving.jodconverter.office.PooledOfficeManager
$2.run(PooledOfficeManager.java:81)
at java.util.concurrent.Executors
$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:
303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
While debugging from my IDE, I found that in the following class
method:
(org.artofsolving.jodconverter.StandardConversionTask:64)
protected Map<String,?> getStoreProperties(File outputFile,
XComponent document) {
DocumentFamily family =
OfficeDocumentUtils.getDocumentFamily(document);
return outputFormat.getStoreProperties(family);
}
the DocumentFamily obtained is TEXT, instead of DRAWING, so the
getStoreProperties call returns null. That's the reason why the
previous exception is thrown.
Could anyone give me some guidance, please?
Thanks in advance.