3

I'm coding an application on Android Studio using Kotlin. For now, I have one fragment where the user has to fill some fields (like "Client", "Date", etc) and I'd like to put these information in an editable PDF that already exists when the user clicks on a "Validate" button. I searched for hours, but the only solution I found is called "Pdftron", but I couldn't make it work without the (4000$/year) license. Is there any way I can fill the PDF using Kotlin? Does anyone know how to use properly the demo version of Pdftron?

Thank you in advance.

Here is a screenshot of the existing editable PDF as an example:

IMAGE

EDIT: Someone sent me this: https://pdfbox.apache.org/, that could help me. I'll dig that tomorrow, but I'm still open to any suggestion :)

marie
  • 43
  • 6
  • "Does anyone know how to use properly the demo version of Pdftron?" If Branden's answer did not answer your question, could you elaborate on what you mean by this. What exactly did not work for you in the demo? – Ryan Sep 18 '20 at 17:24
  • When I tried to access and modify my pdf, I couldn't make it work, as it was showing as an error that I needed a key license :/ But I think I've found another way to do what I want, with "Pdfbox" – marie Sep 19 '20 at 12:57

2 Answers2

2

You can try the demo version of PDFTron by integrating via Gradle: https://www.pdftron.com/documentation/android/get-started/integration/gradle/ (the demo version does not require any trial license key, simply add it to your app to try out).

For your app, it looks like your editable PDF contains text fields and you are trying to populate these text fields. In this case, you can use PDFTron's FieldIterator API to traverse the text fields and insert your information.

For reference, you can check out this Kotlin sample (specifically "Example 2: Fill-in forms / Modify values of existing fields"): https://www.pdftron.com/documentation/samples/kt/InteractiveFormsTest?platforms=android

Branden
  • 41
  • 2
  • Thank you for your answer, but I've found another way to do what I want, with "Pdfbox". Thanks though, I think your answer will be helpful to others! – marie Sep 19 '20 at 12:57
1

I finally managed to do what I wanted, with a lib called "iText 7", and it works perfectly with Android. Doc is here: https://api.itextpdf.com/iText7/java/7.1.12/

marie
  • 43
  • 6