Hi Julien, thank you for your response. I replied only to you by
mistake. Now I'll share what I tried.
Following what you explain in your post (but using jodconverter API
directly from within my application instead of the webservice), this
is what I do:
I extend DefaultDocumentFormatRegistry:
public MyDocumentFormatRegistry() {
DocumentFormat pdf = new DocumentFormat("Portable Document Format",
"pdf", "application/pdf");
LinkedHashMap<String,Object> aFilterMap = new
LinkedHashMap<String,Object>();
aFilterMap.put("FilterName", "writer_pdf_Export");
aFilterMap.put("FilterData",
Collections.singletonMap("SelectPdfVersion", Integer.valueOf(1)));
pdf.setStoreProperties(DocumentFamily.TEXT, aFilterMap);
aFilterMap = new LinkedHashMap<String,Object>();
aFilterMap.put("FilterName", "calc_pdf_Export");
aFilterMap.put("FilterData",
Collections.singletonMap("SelectPdfVersion", Integer.valueOf(1)));
pdf.setStoreProperties(DocumentFamily.SPREADSHEET,
aFilterMap);
aFilterMap = new LinkedHashMap<String,Object>();
aFilterMap.put("FilterName", "impress_pdf_Export");
aFilterMap.put("FilterData",
Collections.singletonMap("SelectPdfVersion", Integer.valueOf(1)));
pdf.setStoreProperties(DocumentFamily.PRESENTATION,
aFilterMap);
aFilterMap = new LinkedHashMap<String,Object>();
aFilterMap.put("FilterName", "draw_pdf_Export");
aFilterMap.put("FilterData",
Collections.singletonMap("SelectPdfVersion", Integer.valueOf(1)));
pdf.setStoreProperties(DocumentFamily.DRAWING, aFilterMap);
addFormat(pdf);
}
And then I call the converter this way:
converter = new OfficeDocumentConverter(officeManager, new
MyDocumentFormatRegistry());
converter.convert(inputFile, outputFile);
The issue is that I'm getting an illegible PDF file, like
Jodconverter was reading the input file as an ASCII file and dumping
every character to the output PDF, instead of reading the input as a
PDF file.
Can you guess something I'm doing wrong?
As additional information for other readers, I also tried what I wrote
in the following post:
http://groups.google.com/group/jodconverter/browse_thread/thread/9412400df0cf059a
Regards and thanks in advance.
> Everything’s fine, my WS convert to PDF/A (checked byhttp://
www.pdf-tools.com/pdf/validate-pdfa-online.aspx)
>
> The DocumentFormat.xml file of 2.2.2 had disappeared (I’m not sure
> that the FilterData worked, see XmlDocumentFormatRegistry utility,
> anyway), so I found this way to add the FilterData. Use of a config
> file may be better, but I saw nothing in web service context (Json
> file is only for command line).
http://shervinasgari.blogspot.com/search/label/pdfa