world 转PDF

package com.qlzx.utils;

import java.io.File;
import java.io.FileOutputStream;

import java.io.InputStream;

import org.aspectj.weaver.ast.Test;

import com.aspose.words.Document;
import com.aspose.words.License;
import com.aspose.words.SaveFormat;

/**

  • 可以用 world 转pdf 速度快,效果好
  • // 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,EPUB, XPS, SWF 相互转换
  • license.xml应放在…\WebRoot\WEB-INF\classes路径下
  • @author Liang Qizhao
  • @date 2018年11月20日
  • @project metroHs
    */
    public class WorldToPdf {

/**

  • 去水印

  • @return
    */
    public static boolean getLicense() {
    boolean result = false;
    try {
    InputStream is = Test.class.getClassLoader().getResourceAsStream(“license.xml”); // license.xml应放在…\WebRoot\WEB-INF\classes路径下
    License aposeLic = new License();
    aposeLic.setLicense(is);
    result = true;
    } catch (Exception e) {
    e.printStackTrace();
    }
    return result;
    }

    public static void doc2pdf(String inPath, String outPath) {
    if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
    return;
    }
    try {
    long old = System.currentTimeMillis();
    File file = new File(outPath); // 新建一个空白pdf文档
    FileOutputStream os = new FileOutputStream(file);
    Document doc = new Document(inPath); // Address是将要被转化的word文档
    doc.save(os, SaveFormat.PDF);// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,
    // EPUB, XPS, SWF 相互转换
    long now = System.currentTimeMillis();
    System.out.println(“共耗时:” + ((now - old) / 1000.0) + “秒”); // 转化用时
    } catch (Exception e) {
    e.printStackTrace();
    }
    }

    public static void main(String[] args) {
    long start=System.currentTimeMillis();
    doc2pdf(“C:\Users\Liang Qizhao\Desktop\劳动合同.doc”, “C:\Users\Liang Qizhao\Desktop\劳动合同123.pdf”);
    long end=System.currentTimeMillis();
    System.out.println(“用时”+(end-start));
    }
    }
    License.xml



    Aspose.Total for Java
    Aspose.Words for Java

    Enterprise
    20991231
    20991231
    8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7

    sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
PowerWorld是一种用于电力系统建模和分析的电力系统软件。其中,PowerWorld PDF是PowerWorld软件的一部分,它是PowerWorld公司提供的电力系统应用手册的电子版本。 PowerWorld PDF提供了丰富的资源,帮助用户更好地理解和使用PowerWorld软件。它包括软件的详细说明、操作指南和具体示例等。通过PowerWorld PDF,用户可以了解PowerWorld软件的各种功能、工具和技术,以便更好地进行电力系统的建模、仿真和分析。 PowerWorld软件以其强大的功能和易用性而闻名,广泛应用于电力行业。它可以对电力系统进行各种建模和仿真,包括潮流分析、稳态和暂态稳定性分析、潮流优化、短路分析等。同时,PowerWorld软件还提供了可视化的界面,让用户可以直观地了解电力系统的运行状况、故障等。 PowerWorld PDF的存在使用户能够更加全面地学习和使用PowerWorld软件。无论是初学者还是有经验的电力系统工程师,都可以通过PowerWorld PDF了解如何使用PowerWorld软件进行电力系统分析和研究。它是一个非常有用的参考资料,帮助用户解决各种与电力系统相关的问题。 总之,PowerWorld PDF是一种电力系统应用手册的电子版本,为用户提供了对PowerWorld软件的详细说明和操作指南。通过PowerWorld PDF,用户可以更好地理解和使用PowerWorld软件,进行电力系统建模和分析。这对于电力行业的专业人士和学习者来说是非常有益的。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值