项目作者: alaeddinejebali
项目描述 :
How to convert a document to a PDF using iText and Aspose?
高级语言: Java
项目地址: git://github.com/alaeddinejebali/Android-ConvertToPDF.git
To use the library.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" ></uses-permission>
- The project is “/ConvertToPdf-Aspose/“
- Download Aspose zip from http://www.aspose.com/community/files/74/android-components/aspose.pdf-for-android/default.aspx
- When you extract it you’ll find:
- “Aspose.Words.zip” offers the feature to convert word files to PDF. For further details, please check Convert word file to PDF Furthermore, it supports variety of document formats i.e. DOC, DOCX, ODT, RTF, EPUB etc. Please check Supported file formats for more information.
- “Aspose.Cells.zip” offers the feature to convert Excel worksheets to PDF. For further details, please visit Convert Excel files to PDf please check
- “Aspose.Slides.zip” offers the feature to convert PowerPoint presentations to PDF. For further details, please check Convert Presentations to PDf
- “Aspose.Pdf.zip” offers the feature to convert Text, Image, HTML, XML files to Pdf format.
- Add “aspose-words-x.xx-android-jdkxx.jar” to your “lib” folder (with Android-Studio, you may need to right-click the “lib/aspose-words-x.xx-android-jdkxx.jar” -> “Add as Library…”)
- Add “aw-classes_dex2jar.jar” to your “lib” folder (with Android-Studio, you may need to right-click the “lib/aw-classes_dex2jar.jar” -> “Add as Library…”)
- Add permission and MultiDex to your AndroidManifest
<application android:name="android.support.multidex.MultiDexApplication"
(...)
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" ></application>
- Copy/paste "resources" folder to "/main/assets/"
- Convert your files
```java
try{
Document document = new Document(filePath);
document.save(outputPath);
} catch (Exception e) {
e.printStackTrace();
}