Java Code Examples for org.odftoolkit.odfdom.doc.OdfTextDocument#loadDocument()

The following examples show how to use org.odftoolkit.odfdom.doc.OdfTextDocument#loadDocument() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConvertODTStructuresToXHTML.java    From xdocreport.samples with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args )
{
    long startTime = System.currentTimeMillis();

    try
    {
        // 1) Load odt with ODFDOM
        OdfTextDocument document = OdfTextDocument.loadDocument( Data.class.getResourceAsStream( "ODTStructures.odt" ) );

        // 2) Convert ODFDOM OdfTextDocument 2 PDF with iText
        File outFile = new File( "target/ODTStructures.htm" );
        outFile.getParentFile().mkdirs();

        OutputStream out = new FileOutputStream( outFile );
        XHTMLConverter.getInstance().convert( document, out, null );
    }
    catch ( Throwable e )
    {
        e.printStackTrace();
    }

    System.out.println( "Generate ODTStructures.htm with " + ( System.currentTimeMillis() - startTime ) + " ms." );
}
 
Example 2
Source File: ConvertODTResumeToXHTML.java    From xdocreport.samples with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args )
{
    long startTime = System.currentTimeMillis();

    try
    {
        // 1) Load odt with ODFDOM
        OdfTextDocument document = OdfTextDocument.loadDocument( Data.class.getResourceAsStream( "ODTResume.odt" ) );

        // 2) Convert ODFDOM OdfTextDocument 2 PDF with iText
        File outFile = new File( "target/ODTResume.htm" );
        outFile.getParentFile().mkdirs();

        OutputStream out = new FileOutputStream( outFile );
        XHTMLConverter.getInstance().convert( document, out, null );
    }
    catch ( Throwable e )
    {
        e.printStackTrace();
    }

    System.out.println( "Generate ODTResume.htm with " + ( System.currentTimeMillis() - startTime ) + " ms." );
}
 
Example 3
Source File: ConvertODTBigToXHTML.java    From xdocreport.samples with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args )
{
    long startTime = System.currentTimeMillis();

    try
    {
        // 1) Load odt with ODFDOM
        OdfTextDocument document = OdfTextDocument.loadDocument( Data.class.getResourceAsStream( "ODTBig.odt" ) );

        // 2) Convert ODFDOM OdfTextDocument 2 PDF with iText
        File outFile = new File( "target/ODTBig.htm" );
        outFile.getParentFile().mkdirs();

        OutputStream out = new FileOutputStream( outFile );
        XHTMLConverter.getInstance().convert( document, out, null );
    }
    catch ( Throwable e )
    {
        e.printStackTrace();
    }

    System.out.println( "Generate ODTBig.htm with " + ( System.currentTimeMillis() - startTime ) + " ms." );
}
 
Example 4
Source File: ConvertODTLettreRelanceToXHTML.java    From xdocreport.samples with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args )
{
    long startTime = System.currentTimeMillis();

    try
    {
        // 1) Load odt with ODFDOM
        OdfTextDocument document =
            OdfTextDocument.loadDocument( Data.class.getResourceAsStream( "ODTLettreRelance.odt" ) );

        // 2) Convert ODFDOM OdfTextDocument 2 PDF with iText
        File outFile = new File( "target/ODTLettreRelance.htm" );
        outFile.getParentFile().mkdirs();

        OutputStream out = new FileOutputStream( outFile );
        XHTMLConverter.getInstance().convert( document, out, null );
    }
    catch ( Throwable e )
    {
        e.printStackTrace();
    }

    System.out.println( "Generate ODTLettreRelance.htm with " + ( System.currentTimeMillis() - startTime ) + " ms." );
}
 
Example 5
Source File: ConvertODTLettreRelanceToPDF.java    From xdocreport.samples with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args )
{
    long startTime = System.currentTimeMillis();

    try
    {
        // 1) Load odt with ODFDOM
        OdfTextDocument document =
            OdfTextDocument.loadDocument( Data.class.getResourceAsStream( "ODTLettreRelance.odt" ) );

        // 2) Convert ODFDOM OdfTextDocument 2 PDF with iText
        File outFile = new File( "target/ODTLettreRelance.pdf" );
        outFile.getParentFile().mkdirs();

        OutputStream out = new FileOutputStream( outFile );
        PdfOptions options = null;// PDFViaITextOptions.create().fontEncoding( "windows-1250" );
        PdfConverter.getInstance().convert( document, out, options );
    }
    catch ( Throwable e )
    {
        e.printStackTrace();
    }

    System.out.println( "Generate ODTLettreRelance.pdf with " + ( System.currentTimeMillis() - startTime ) + " ms." );
}
 
Example 6
Source File: ConvertODTResumeToPDF.java    From xdocreport.samples with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args )
{
    long startTime = System.currentTimeMillis();

    try
    {
        // 1) Load odt with ODFDOM
        OdfTextDocument document = OdfTextDocument.loadDocument( Data.class.getResourceAsStream( "ODTResume.odt" ) );

        // 2) Convert ODFDOM OdfTextDocument 2 PDF with iText
        File outFile = new File( "target/ODTResume.pdf" );
        outFile.getParentFile().mkdirs();

        OutputStream out = new FileOutputStream( outFile );
        PdfOptions options = null;// PDFViaITextOptions.create().fontEncoding( "windows-1250" );
        PdfConverter.getInstance().convert( document, out, options );
    }
    catch ( Throwable e )
    {
        e.printStackTrace();
    }

    System.out.println( "Generate ODTResume.pdf with " + ( System.currentTimeMillis() - startTime ) + " ms." );
}
 
Example 7
Source File: ConvertODTBigToPDF.java    From xdocreport.samples with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args )
{
    long startTime = System.currentTimeMillis();

    try
    {
        // 1) Load odt with ODFDOM
        OdfTextDocument document = OdfTextDocument.loadDocument( Data.class.getResourceAsStream( "ODTBig.odt" ) );

        // 2) Convert ODFDOM OdfTextDocument 2 PDF with iText
        File outFile = new File( "target/ODTBig.pdf" );
        outFile.getParentFile().mkdirs();

        OutputStream out = new FileOutputStream( outFile );
        PdfOptions options = PdfOptions.create().fontEncoding( "windows-1250" );
        PdfConverter.getInstance().convert( document, out, options );
    }
    catch ( Throwable e )
    {
        e.printStackTrace();
    }

    System.out.println( "Generate ODTBig.pdf with " + ( System.currentTimeMillis() - startTime ) + " ms." );
}
 
Example 8
Source File: ConvertODTStructuresToPDF.java    From xdocreport.samples with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args )
{
    long startTime = System.currentTimeMillis();

    try
    {
        // 1) Load odt with ODFDOM
        OdfTextDocument document =
            OdfTextDocument.loadDocument( Data.class.getResourceAsStream( "ODTStructures.odt" ) );

        // 2) Convert ODFDOM OdfTextDocument 2 PDF with iText
        File outFile = new File( "target/ODTStructures.pdf" );
        outFile.getParentFile().mkdirs();

        OutputStream out = new FileOutputStream( outFile );
        PdfOptions options = null;// PDFViaITextOptions.create().fontEncoding( "windows-1250" );
        PdfConverter.getInstance().convert( document, out, options );
    }
    catch ( Throwable e )
    {
        e.printStackTrace();
    }

    System.out.println( "Generate ODTStructures.pdf with " + ( System.currentTimeMillis() - startTime ) + " ms." );
}
 
Example 9
Source File: OdtToPDF.java    From docs-to-pdf-converter with MIT License 4 votes vote down vote up
@Override
public void convert() throws Exception {
	loading();       


	OdfTextDocument document = OdfTextDocument.loadDocument(inStream);

	PdfOptions options = PdfOptions.create();

	
	processing();
	PdfConverter.getInstance().convert(document, outStream, options);

	finished();


}