Results 1 to 5 of 5
Thread: doc to pdf
- 07-11-2010, 10:21 AM #1
Member
- Join Date
- Jul 2010
- Posts
- 2
- Rep Power
- 0
doc to pdf
Hello guys,
I need to convert files to pdf doc. Conducting research on the internet I saw that you must use the POI and iText library. Indeed, using this code:
FileInputStream fis = new FileInputStream(in.getAbsolutePath());
FileOutputStream fos = new FileOutputStream(out);
HWPFDocument doc = new HWPFDocument(fis);
WordExtractor poi = new WordExtractor(doc);
String[] paragrafi = poi.getParagraphText();
Document d = new Document();
PdfWriter.getInstance(d, fos);
d.open();
d.newPage();
for(String paragrafo : paragrafi) {
d.add(new Paragraph(paragrafo));
}
d.close();
fos.close();
fis.close();
I managed to convert but I lose all formatting.
Does anyone know any tutorial or manual clear to make this conversion in full?
Thanks
- 07-12-2010, 11:54 AM #2
do you need a code?
But you can simply use OpenOffice for this :)
- 07-12-2010, 12:01 PM #3
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
- 07-12-2010, 07:14 PM #4
Member
- Join Date
- Jul 2010
- Posts
- 2
- Rep Power
- 0
I tried to use the stylesheet for paragraphs but I can not get it to work.
I would simply recall the character and alignment of each
single paragraph. You can send me a sample code?
Thanks
- 07-13-2010, 10:45 AM #5
Member
- Join Date
- Jul 2010
- Posts
- 3
- Rep Power
- 0


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks