1

I want to add itextg via gradle to avoid having to maintain a set of library jars. Maybe it's me but I can't find the correct gradle compile statement anywhere.

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:20.0.0'
    compile 'com.google.code.gson:gson:2.3.1'
    compile 'com.itextg:itextg:5.4.3'
}

Regular itext works just fine but I'm trying to do stuff with images.

compile 'com.itextpdf:itextpdf-5.5.6'
G_V
  • 2,396
  • 29
  • 44

1 Answers1

8

I think that's because we released iText as a jar on Maven Central (which Gradle also uses as a repository) and also as a download from various sites (GitHub, SourceForge); but iTextG only as a download on various sites, not on Maven Central. iTextG uses the same namespace as iText: com.itextpdf:itextpdf so having it on Maven Central too would create conflicts. Something like com.itextg:itextg simply does not exist (as far as I know - and I am supposed to know because I am QA Engineer at iText Software). In fact, the main difference between iText and iTextG, is that we have stripped all AWT dependencies from iTextG. For the rest they are exactly the same codebase.

So, to finally answer your question after all this background information: you'll have to download the iTextG jar and manually add it to your libs folder.

As of iText 5.5.9, you can add this to your Gradle file:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:20.0.0'
    compile 'com.google.code.gson:gson:2.3.1'
    compile 'com.itextpdf:itextg:5.5.9'
}
Amedee Van Gasse
  • 7,280
  • 5
  • 55
  • 101
  • Yep, that's what I did and while it's not ideal for maintenance purposes, I surmise that there are no plans to change this in the near future so I'll just deal with it. Thanks! – G_V Aug 11 '15 at 09:10
  • 1
    Feedback is always welcome! iTextG is not a separate product, it is a stripped down version of iText (AWT references removed). Indeed no plans to change this in iText 5.x – Amedee Van Gasse Aug 11 '15 at 09:29
  • 1
    You will be glad to hear that I am currently working on getting a mavenized version of iTextG. To be expected for version 5.5.9, to be released later this month. – Amedee Van Gasse Mar 01 '16 at 10:30
  • 1
    As of `5.5.9`, you can use Gradle as the OP intended. There is an artifact `com.itextpdf:itextg:5.5.9`. Previous versions will not be uploaded to Maven Central, since we haven't seen that specific request from our customers. See http://mvnrepository.com/artifact/com.itextpdf/itextg/5.5.9 for the artifact. – Amedee Van Gasse Mar 17 '16 at 09:49
  • 3
    I tried adding 5.5.11 but did not work, 5.5.9 it is. works like a charm – Mal Apr 21 '17 at 00:41
  • Just wait a bit for 5.5.11, I know it's behind a bit but it will arrive soon enough. – Amedee Van Gasse Apr 21 '17 at 05:30