when running my code it gives the following error: Could not find docmosis.properties. I've placed this file in the root folder of my project. I'm using Netbeans. Here's my code:
SystemManager.initialise();
TemplateIdentifier templateId = new TemplateIdentifier("test");
ConversionInstruction instruction = new ConversionInstruction();
instruction.setConverterGroupName("batch1");
instruction.setConversionFormats(new ConversionFormat[]{
ConversionFormat.FORMAT_PDF,});
instruction.setOutputFileName("out.pdf");
DataProviderBuilder dpb = new DataProviderBuilder();
// add the name of the project
dpb.add("hallo", "Deisel Institute");
File out = new File("template/out.pdf");
FileOutputStream fos = new FileOutputStream(out);
try {
DocumentProcessor.renderDoc(templateId, dpb.getDataProvider(), instruction, fos);
SystemManager.release();
} catch (IOException ex) {
Logger.getLogger(pdfGen.class.getName()).log(Level.SEVERE, null, ex);
} catch (ProcessingException ex) {
Logger.getLogger(pdfGen.class.getName()).log(Level.SEVERE, null, ex);
} catch (TemplateStoreException ex) {
Logger.getLogger(pdfGen.class.getName()).log(Level.SEVERE, null, ex);
}
Finding docmosis.properties with NetBeans
Hello erwinstaal.
Docmosis looks for the docmosis.properties file at the "root" of entries in the classpath.
Your project needs to make sure that the folder/directory containing docmosis.properties is added to your class path.
Try adding the folder containing docmosis.properties to your Sources with NetBeans:
Also, if you are trying things out, the DocumentProcessor.renderDoc(File, File, DataProvider) will make code easier.
// one-off initialise SystemManager.initialise(); // do lots of renders DataProviderBuilder dpb = new DataProviderBuilder(); dpb.add("hallo", "Deisel Institute"); File templateFile = new File("/projectA/AnalysisTemplate.doc"); File resultFile = new File("/projectA/AnalysisResult.pdf"); DocumentProcessor.renderDoc(templateFile, resultFile, dpb.getDataProvider()); // one-off release SystemManager.release();Some notes on your code snippet:
SystemManager.release()after rendering a single document. You should only call that when your application is exiting.fos)docmosis properties file not found
Hi,
Your 6 points solution that you give for Netbeans is ok to add docmosis properties source folder (example : src\app\resources in my case).
But after, this not work at run time whit this :
java -splash:splash1.png -cp dist/SAFdemo.jar;app/resources/ app.App -Xms32m -Xmx512m -Xss32m
The program start. All is ok. But docmosis.properties file is never found !
Any solution ? Thanks.
Platform
What platform are you using?
If it is unix/linux/mac, then your -cp looks wrong. You should use the ":" character not the ";" character to separate entries.
Is this the problem?
Docmosis properties file not found
I use Windows XP.
Finally this work with the line below :
java -splash:splash1.png -Xms32m -Xmx512m -Xss32m -cp .;SAFdemo.jar app.App
but docmosis files are "out of the jar" for modifications facilities (in Netbeans packaging: **/*.java,**/*.form,*.properties,*.xml) and must be in the root of the distribution.
Thanks for your answer.
Docmosis searching for docmosis.properties