I am trying to add itext-7 to android, after adding the following in gradle
compile 'com.itextpdf:root:7.0.0'
I am still not able to find the classes of itext e.g PDFWriter etc.
Please let me know if there's separate version for itext-7 for Android also how to add it.
P.S: I have added itext-5 successfully, but i want to work with itext-7 now.
The root artifact is a mere parent pom and does not contain iText 7 classes at all.
If you want to include all iText 7 Core functionality, you should try
compile 'com.itextpdf:itext7-core:7.0.2'
If this does not work out of the box (e.g. due to missing Java classes in Android), or if you simply want a leaner installation, note that in contrast to iText 5 the newer iText 7 is not distributed as one big jar but as a set of modules.
For Maven you would use the following dependencies (or more likely a subset from them); you can easily build gradle compile
statements from them:
<dependencies>
<!-- always needed -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
<version>7.0.2</version>
</dependency>
<!-- always needed -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>io</artifactId>
<version>7.0.2</version>
</dependency>
<!-- always needed -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>layout</artifactId>
<version>7.0.2</version>
</dependency>
<!-- only needed for forms -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>forms</artifactId>
<version>7.0.2</version>
</dependency>
<!-- only needed for PDF/A -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>pdfa</artifactId>
<version>7.0.2</version>
</dependency>
<!-- only needed for digital signatures -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>sign</artifactId>
<version>7.0.2</version>
</dependency>
<!-- only needed for barcodes -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>barcodes</artifactId>
<version>7.0.2</version>
</dependency>
<!-- only needed for Asian fonts -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>font-asian</artifactId>
<version>7.0.2</version>
</dependency>
<!-- only needed for hyphenation -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>hyph</artifactId>
<version>7.0.2</version>
</dependency>
</dependencies>
(Getting started with iText 7 on developers.itextpdf.com)
As for Android: currently iText 7 is not compatible with Android and you will get compilation errors iText 7 works out of the box when used on a device with an Android API level 24 or higher (Android Nougat). If you would like to support devices that run on a lower version of Android you could write a Xamarin app, which will run on any version of Android, but Xamarin means writing in .NET.