https://github.com/alaeddinejebali/android-converttopdf
How to convert a document to a PDF using iText and Aspose?
https://github.com/alaeddinejebali/android-converttopdf
android aspose itext java pdf-generation
Last synced: 5 months ago
JSON representation
How to convert a document to a PDF using iText and Aspose?
- Host: GitHub
- URL: https://github.com/alaeddinejebali/android-converttopdf
- Owner: alaeddinejebali
- Created: 2015-04-02T16:41:14.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-08-15T13:33:23.000Z (over 7 years ago)
- Last Synced: 2023-08-07T06:21:51.940Z (over 1 year ago)
- Topics: android, aspose, itext, java, pdf-generation
- Language: Java
- Homepage:
- Size: 23.5 MB
- Stars: 20
- Watchers: 2
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Using [iText]
To use the library.
- The project is "/ConvertToPdf-iText/"
- Download Jar file from http://sourceforge.net/projects/itext/files/latest/download?source=files
- Add it to your "lib" folder (with Android-Studio, you may need to right-click the lib/itextpdf-x.x.x.jar -> "Add as Library...")
- Add permission to your AndroidManifest
```xml```
# Using [Aspose]
- 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
```xml```
- Add those lines to your "app/build.gradle"
```xml
(...)
defaultConfig {
multiDexEnabled true
}
(...)
dexOptions {
javaMaxHeapSize "4g"
}
(...)
dependencies {
provided files('libs/aw-classes_dex2jar.jar')
compile 'com.google.code.gson:gson:2.3'
compile 'com.android.support:multidex:1.0.0'
}
```
- 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();
}
```
[iText]: http://itextpdf.com
[Aspose]: https://downloads.aspose.com/pdf/android
[convert word files to PDF]: http://www.aspose.com/docs/display/wordsjava/How+to++Convert+a+Document+to+PDF
[Supported file formats for more information]: http://www.aspose.com/docs/display/wordsjava/File+Formats+and+Conversions
[convert Excel worksheets to PDF]: http://www.aspose.com/docs/display/cellsjava/Converting+to+PDF+Files
[convert PowerPoint presentations to PDF]: http://www.aspose.com/docs/display/slidesjava/Converting+to+PDF+File