I created a java app that create some documents in output. The documents are created with apache POI api and are made of text abn tables. My boss now decided they also want them in pdf format for storing them. They of course have 0$ budget. I tryed using iText 4.2 (which comes under lgpl license) but i lost all tables (I'm having only naked text)
This is my script:
try{
XWPFDocument doc = new XWPFDocument(POIXMLDocument.openPackage(s + ".doc"));
XWPFWordExtractor wx = new XWPFWordExtractor(doc);
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(s + ".pdf"));
document.open();
writer.setPageEmpty(true);
document.newPage();
writer.setPageEmpty(true);
String text = wx.getText();
text=text.replaceAll("\\cM?\r?\n", "");
document.add(new Paragraph(text));
}
catch(Exception e){
System.out.println("Exception during test");
e.printStackTrace();
}
Any help? Even a change of direction would be great. I was wandering if I could simply write a macro that open the doc, type save as, and save it as pdf with same name. Launching it eventually inside java app.
Thank you