• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PdfConverter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.poi.xwpf.converter.pdf.PdfConverter的典型用法代码示例。如果您正苦于以下问题:Java PdfConverter类的具体用法?Java PdfConverter怎么用?Java PdfConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PdfConverter类属于org.apache.poi.xwpf.converter.pdf包,在下文中一共展示了PdfConverter类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import org.apache.poi.xwpf.converter.pdf.PdfConverter; //导入依赖的package包/类
public static void main( String[] args )
{
    long startTime = System.currentTimeMillis();

    try
    {
        // 1) Load docx with POI XWPFDocument
        XWPFDocument document = new XWPFDocument( Data.class.getResourceAsStream( "DocxBig.docx" ) );

        // 2) Convert POI XWPFDocument 2 PDF with iText
        File outFile = new File( "target/DocxBig.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 DocxBig.pdf with " + ( System.currentTimeMillis() - startTime ) + " ms." );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:25,代码来源:ConvertDocxBigToPDF.java


示例2: main

import org.apache.poi.xwpf.converter.pdf.PdfConverter; //导入依赖的package包/类
public static void main( String[] args )
{
    long startTime = System.currentTimeMillis();

    try
    {
        // 1) Load docx with POI XWPFDocument
        XWPFDocument document = new XWPFDocument( Data.class.getResourceAsStream( "DocxStructures.docx" ) );

        // 2) Convert POI XWPFDocument 2 PDF with iText
        File outFile = new File( "target/DocxStructures.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 DocxStructures.pdf with " + ( System.currentTimeMillis() - startTime ) + " ms." );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:25,代码来源:ConvertDocxStructuresToPDF.java


示例3: main

import org.apache.poi.xwpf.converter.pdf.PdfConverter; //导入依赖的package包/类
public static void main( String[] args )
{
    long startTime = System.currentTimeMillis();

    try
    {
        // 1) Load docx with POI XWPFDocument
        XWPFDocument document = new XWPFDocument( Data.class.getResourceAsStream( "DocxLettreRelance.docx" ) );

        // 2) Convert POI XWPFDocument 2 PDF with iText
        File outFile = new File( "target/DocxLettreRelance.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 DocxLettreRelance.pdf with " + ( System.currentTimeMillis() - startTime )
        + " ms." );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:26,代码来源:ConvertDocxLettreRelanceToPDF.java


示例4: convertPDF

import org.apache.poi.xwpf.converter.pdf.PdfConverter; //导入依赖的package包/类
@Override
public File convertPDF(File theFile, String md5UploadedFile) throws PDFConverterException {
	try {
		InputStream is = new FileInputStream(theFile);
		XWPFDocument document = new XWPFDocument(is);
		PdfOptions options = PdfOptions.create();
		String outFileName = this.getOutputFileName(md5UploadedFile);
		File outputFile = new File(Config.getString("application.staticFiles"), outFileName);
		FileOutputStream pdfStream = new FileOutputStream(outputFile);
		PdfConverter.getInstance().convert(document, pdfStream, options);
		pdfStream.close();
		return outputFile;
	} catch (Exception e) {
		log.error("Fail to create PDF in XDocReport Converter", e);
		throw new PDFConverterException("Fail to create PDF in XDocReport Converter", e);
	}
}
 
开发者ID:LeoFCardoso,项目名称:tudoToPDF,代码行数:18,代码来源:XDocReportConverter.java


示例5: main

import org.apache.poi.xwpf.converter.pdf.PdfConverter; //导入依赖的package包/类
public static void main( String[] args )
{
    long startTime = System.currentTimeMillis();

    try
    {
        // 1) Load docx with POI XWPFDocument
        XWPFDocument document = new XWPFDocument( Data.class.getResourceAsStream( "ooxml.docx" ) );

        // 2) Convert POI XWPFDocument 2 PDF with iText
        File outFile = new File( "target/ooxml.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 ooxml.pdf with " + ( System.currentTimeMillis() - startTime ) + " ms." );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:25,代码来源:ConvertOoxmlToPDF.java


示例6: create

import org.apache.poi.xwpf.converter.pdf.PdfConverter; //导入依赖的package包/类
private static void create()
{
    long startTime = System.currentTimeMillis();

    try
    {
        // 1) Load docx with POI XWPFDocument
        XWPFDocument document = new XWPFDocument( Data.class.getResourceAsStream( "DocxResume.docx" ) );

        // 2) Convert POI XWPFDocument 2 PDF with iText
        File outFile = new File( "target/DocxResume.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 DocxResume.pdf with " + ( System.currentTimeMillis() - startTime ) + " ms." );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:25,代码来源:ConvertDocxResumeToPDF.java


示例7: getPDFByteArray

import org.apache.poi.xwpf.converter.pdf.PdfConverter; //导入依赖的package包/类
/**
 * Converts the document to a PDF-File and returns its Byte[]
 * 
 * @author Tim Kaler / Whitecoast Solutions AG 
 * @since 29.04.2015
 * @return the converted PDF file as byte array
 */
public byte[] getPDFByteArray(){
	try{
		PdfOptions options = PdfOptions.getDefault();

		ByteArrayOutputStream out = new ByteArrayOutputStream();
		PdfConverter.getInstance().convert(document, out, options);
		
		return out.toByteArray();
	}
	catch(Exception e){
		System.out.println("Error in getPDFByteArray: " + e.toString());
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:crash785,项目名称:PrintEngine,代码行数:23,代码来源:WordXHandler.java


示例8: toPdf

import org.apache.poi.xwpf.converter.pdf.PdfConverter; //导入依赖的package包/类
@Test
public final void toPdf() throws FileNotFoundException, IOException {
	File file = new File("C:\\Users\\KYJ\\Desktop\\학습\\Algorism.docx");
	XWPFDocument document = new XWPFDocument(new FileInputStream(file));

	File outFile = new File("Algorism.pdf");

	try (OutputStream out = new FileOutputStream(outFile)) {
		PdfOptions options = PdfOptions.getDefault();
		PdfConverter.getInstance().convert(document, out, options);
	}
	System.out.println("Sucess");


	FileUtil.openFile(outFile);


}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:19,代码来源:MSWordTest.java


示例9: convert

import org.apache.poi.xwpf.converter.pdf.PdfConverter; //导入依赖的package包/类
@Override
public void convert() throws Exception {
	loading();       
	

       XWPFDocument document = new XWPFDocument(inStream);

       PdfOptions options = PdfOptions.create();

       
       processing();
       PdfConverter.getInstance().convert(document, outStream, options);
       
       finished();
       
}
 
开发者ID:yeokm1,项目名称:docs-to-pdf-converter,代码行数:17,代码来源:DocxToPDFConverter.java


示例10: convert

import org.apache.poi.xwpf.converter.pdf.PdfConverter; //导入依赖的package包/类
/**
 * @작성자 : KYJ
 * @작성일 : 2017. 3. 3.
 * @param docxFile
 * @param outPdfFile
 * @throws FileNotFoundException
 * @throws IOException
 */
public static void convert(XWPFDocument document, File outPdfFile) throws FileNotFoundException, IOException {
	try (OutputStream out = new FileOutputStream(outPdfFile)) {
		PdfOptions options = PdfOptions.getDefault();
		PdfConverter.getInstance().convert(document, out, options);
	}
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:15,代码来源:PDFUtil.java



注:本文中的org.apache.poi.xwpf.converter.pdf.PdfConverter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OAuth2Auth类代码示例发布时间:2022-05-23
下一篇:
Java SocksPortListenerImpl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap