Skip to content
How to convert a document to a PDF using iText and Aspose?
Branch: master
Clone or download
Latest commit 8f52e47 Aug 15, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ConvertToPdf-Aspose Add documentation Apr 6, 2015
ConvertToPdf-iText Update layout Apr 3, 2015
README.md Update README.md Aug 15, 2017

README.md

Using iText

To use the library.

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

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:
  • 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" />
  • Add those lines to your "app/build.gradle"
	(...)
	
    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

    try{
        Document document = new Document(filePath);
        document.save(outputPath);
    } catch (Exception e) {
        e.printStackTrace();
    }
You can’t perform that action at this time.