# topdf **Repository Path**: hong_ej/topdf ## Basic Information - **Project Name**: topdf - **Description**: 使用Aspose插件将xls,xlsx,doc,docx,ppt,pptx,图片等文件转换成PDF文件,保真高,最大程度还原原始文件样式。 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 4 - **Forks**: 2 - **Created**: 2024-07-05 - **Last Updated**: 2025-10-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # topdf #### 介绍 使用Aspose插件将xls,xlsx,doc,docx,ppt,pptx,图片等文件转换成PDF文件,保真高,最大程度还原原始文件样式。 #### Linux安装教程 1. 创建目录:mkdir /usr/share/fonts/chinese 2. 上传Window下的全部字体(C:\Windows\Fonts)到/usr/share/fonts/chinese #### 使用说明 1. Word转PDF ``` java try (OutputStream outputStream = Files.newOutputStream(Paths.get("C:\\Users\\Admin\\Desktop\\test.pdf"))) { ConvertFactory.toPdf(new File("C:\\Users\\Admin\\Desktop\\xxxx.docx"), outputStream); } ``` 2. Excel转PDF ``` java try (OutputStream outputStream = Files.newOutputStream(Paths.get("C:\\Users\\Admin\\Desktop\\test.pdf"))) { ConvertFactory.toPdf(new File("C:\\Users\\Admin\\Desktop\\xxxx.xlsx"), outputStream); } ``` 3. Power Point转PDF ``` java try (OutputStream outputStream = Files.newOutputStream(Paths.get("C:\\Users\\Admin\\Desktop\\test.pdf"))) { ConvertFactory.toPdf(new File("C:\\Users\\Admin\\Desktop\\xxxx.pptx"), outputStream); } ``` 4. 图片转PDF ``` java try (OutputStream outputStream = Files.newOutputStream(Paths.get("C:\\Users\\Admin\\Desktop\\test.pdf"))) { ConvertFactory.toPdf(new File("C:\\Users\\Admin\\Desktop\\xxxx.png"), outputStream); } ```