StimVinsh / xdocreport

Automatically exported from code.google.com/p/xdocreport
0 stars 0 forks source link

I am trying to convert odt to pdf, but i am facing issues on this please go with detailed description. #17

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi i am trying to convert odt to pdf, this is error i got.
please give me solution to this.
The Code :
Options options = Options.getFrom(DocumentKind.ODT).to(ConverterTypeTo.PDF);
        InputStream in= new FileInputStream(new File("D:/AltranPDF/File.odt"));
        try {
            OdfDocument document = OdfTextDocument.loadDocument(in);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        // 2) Convert OdfTextDocument to PDF via IText
        OutputStream out = new FileOutputStream(new File("D:/4July/ODT.pdf"));
        XWPF2PDFViaITextConverter ss = new XWPF2PDFViaITextConverter();
        ss.convert(in, out, options);

Please help me.

Caused by: org.apache.poi.POIXMLException: 
org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should 
contain a content type part [M1.13]
    at org.apache.poi.util.PackageHelper.open(PackageHelper.java:41)
    at org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:112)
    at fr.opensagres.xdocreport.converter.docx.poi.itext.XWPF2PDFViaITextConverter.convert(XWPF2PDFViaITextConverter.java:48)
    ... 1 more

Original issue reported on code.google.com by lokeshba...@gmail.com on 5 Jul 2011 at 8:42

GoogleCodeExporter commented 8 years ago
Hi, you don't use teh well converter. You are using XWPF2PDFViaITextConverter 
wich is the converter for docx. Please use ODF2PDFViaITextConverter like 
explained at http://code.google.com/p/xdocreport/wiki/ODFDOMConverter

Regards Angelo

Original comment by angelo.z...@gmail.com on 5 Jul 2011 at 9:26

GoogleCodeExporter commented 8 years ago
Hi All,

Thank you for giving quick reply,
now i am unable to import ODF2PDFViaITextConverter class.
i have downloaded jar from xdocreport site only,

Thank you.

Regards
Lokesh

Original comment by lokeshba...@gmail.com on 5 Jul 2011 at 12:34

GoogleCodeExporter commented 8 years ago

Original comment by angelo.z...@gmail.com on 20 Jul 2011 at 3:37