PDFBox would be your best option considering how easy it is to use. You can have a look at the examples and get going immediately..

EDIT : As @Adinia pointed it out, PDFBox is not working on Android. The reason being PDFBox uses AWT and Swing even for the non-ui related tasks and Android does not support these.

You could have a go at PDFjet and here are some examples to get you started.

EDIT 2: PDFBox-Android (as the name suggests) is now available for Android, as @Theo was so kind to inform.

Answer from Swayam on Stack Overflow
🌐
Stack Overflow
stackoverflow.com › questions › 21934346 › edit-pdf-file-programmatically
android - Edit PDF file programmatically - Stack Overflow
I don't know what you are up to but yes you can edit,read,write it by using itext library for android i have did not edit any pdf but i have write and view it with this library ... edit PDF - what exactly do you want to do? There are certain things you can easily do to a PDF (e.g. adding or filling form fields, adding new pages with new content) and there are certain things which are really difficult (e.g. changing existing text content and expect paragraph or page reflows). ... I want to add my text in form fields.
🌐
Stack Overflow
stackoverflow.com › questions › 60691883 › kotlin-edit-a-pdf-programmatically-or-an-html
android - Kotlin : Edit a pdf programmatically or an html - Stack Overflow
Edit PDF file programmatically I have to say that I am not looking for paid libraries or something. Because in my search I found one solution with paid library.
🌐
Quora
quora.com › What-are-the-ways-to-edit-the-pdf-file-in-android
What are the ways to edit the pdf file in android? - Quora
Answer (1 of 4): On an Android device, you may want to highlight important points, add an explanation here and there, and delete unnecessary points. These 10 apps below can help you do just that. * iAnnotate PDF * Qiqqa * Mantano Ebook Reader * Xodo - PDF Reader * EzPDF Reader * Adobe Acro...
🌐
Android Developers
developer.android.com › api reference › pdfdocument
PdfDocument | API reference | Android Developers
Skip to main content · English · Deutsch · Español – América Latina · Français · Indonesia · Polski · Português – Brasil · Tiếng Việt · 中文 – 简体
🌐
Nutrient
nutrient.io › android › editor › edit text
Edit PDF text on Android: Edit text, font, size, more | Nutrient
July 2, 2025 - You can enter content editing mode in your code by calling PdfFragment#enterContentEditingMode: ... Adding new text and changing existing text using the colors and font types supported by Nutrient Android SDK.
🌐
Apryse
docs.apryse.com › documentation › samples › android › java › ElementEditTest
Edit PDF with Java | Apryse documentation
Here is a complete PDF and DOCX editing guide using Java. Modify properties, edit text, bookmarks,annotation and lot more using COS API
🌐
YouTube
youtube.com › watch
How to Edit PDF in Android | 2021 - YouTube
This video is all about how to edit any PDF files in android in just a couple of minutes using MS word android app, no PC needed.1. First, convert PDF file ...
Published   August 3, 2018
Find elsewhere
🌐
viveksb007
viveksb.dev › posts › using itext to edit pdf in android
Using iText To Edit PDF In Android | viveksb007
August 13, 2018 - Now the you have integrated iText in your project, you can use its APIs to open and modify PDFs. I didn’t found a separate API documentation for Android, but iText7 examples can be referred to get basic understanding of how things work. I wanted to make an Android App to remove watermark “Scanned by CamScanner” from PDFs which were created by CamScanner App.
🌐
GitHub
github.com › regmishailendra › pdf-editor
GitHub - regmishailendra/pdf-editor
You need to install Jdk 8(might work with Jdk 7 too) or more or tick option of use embedded jdk. After it is installed clone this repo to your studio from the options shown in android studio.
Starred by 3 users
Forked by 3 users
Languages   Java 100.0% | Java 100.0%
Top answer
1 of 4
23

So apparently the code I was using wasn't compatible with android, hence the error I was getting. Below you'll find the correct code that actually works right (for creating a pdf file, putting some content in it, saving in and the opening the newly created file):

PS: For this you'll need to add the jar of iTextG to your project:

// Method for creating a pdf file from text, saving it then opening it for display
    public void createandDisplayPdf(String text) {
        
        Document doc = new Document();

        try {
            String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Dir";

            File dir = new File(path);
            if(!dir.exists())
                dir.mkdirs();

            File file = new File(dir, "newFile.pdf");
            FileOutputStream fOut = new FileOutputStream(file);

            PdfWriter.getInstance(doc, fOut);

            //open the document
            doc.open();

            Paragraph p1 = new Paragraph(text);
            Font paraFont= new Font(Font.COURIER);
            p1.setAlignment(Paragraph.ALIGN_CENTER);
            p1.setFont(paraFont);

            //add paragraph to document
            doc.add(p1);    

        } catch (DocumentException de) {
            Log.e("PDFCreator", "DocumentException:" + de);
        } catch (IOException e) {
            Log.e("PDFCreator", "ioException:" + e);
        }
        finally {
            doc.close();
        }

        viewPdf("newFile.pdf", "Dir");
    }

    // Method for opening a pdf file
    private void viewPdf(String file, String directory) {

        File pdfFile = new File(Environment.getExternalStorageDirectory() + "/" + directory + "/" + file);
        Uri path = Uri.fromFile(pdfFile);

        // Setting the intent for pdf reader
        Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
        pdfIntent.setDataAndType(path, "application/pdf");
        pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

        try {
            startActivity(pdfIntent);
        } catch (ActivityNotFoundException e) {
            Toast.makeText(TableActivity.this, "No application has been found to open PDF files.", Toast.LENGTH_SHORT).show();
        }
    }
2 of 4
17

PdfDocument class enables generating a PDF document from native Android content. By using this class we can create pdf and also open it by using PdfRenderer. Sample code for creating a pdf file

 public void stringtopdf(String data)  {
    String extstoragedir = Environment.getExternalStorageDirectory().toString();
    File fol = new File(extstoragedir, "pdf");
    File folder=new File(fol,"pdf");
    if(!folder.exists()) {
        boolean bool = folder.mkdir();
    }
    try {
        final File file = new File(folder, "sample.pdf");
        file.createNewFile();
        FileOutputStream fOut = new FileOutputStream(file);


        PdfDocument document = new PdfDocument();
        PdfDocument.PageInfo pageInfo = new 
        PdfDocument.PageInfo.Builder(100, 100, 1).create();
        PdfDocument.Page page = document.startPage(pageInfo);
        Canvas canvas = page.getCanvas();
        Paint paint = new Paint();

        canvas.drawText(data, 10, 10, paint);



        document.finishPage(page);
        document.writeTo(fOut);
        document.close();

    }catch (IOException e){
        Log.i("error",e.getLocalizedMessage());
    }
🌐
Android Authority
androidauthority.com › home › mobile › android apps › how to edit a pdf on android (for free)
How to edit a PDF on Android (for free) - Android Authority
September 30, 2024 - ... To edit a PDF file on your Android for free, you can use the Adobe Acrobat Reader: Edit PDF app. While you can’t modify existing text or images with a free account, you can add new text, annotations, and signatures.
🌐
GitHub
github.com › HamidrezaAmz › MagicalPdfEditor
GitHub - HamidrezaAmz/MagicalPdfEditor: This is a small PDF editor based on OpenPdf core and AndroidPdfViewer · GitHub
This is a small PDF editor based on OpenPdf core and AndroidPdfViewer - HamidrezaAmz/MagicalPdfEditor
Starred by 33 users
Forked by 12 users
Languages   Java
🌐
ComPDF
compdf.com › blog › build-an-android-pdf-viewer-or-editor-in-java
How to Build a Java Android PDF Viewer or Editor
Guide developers in integrating PDF SDK to build a Java Android PDF Reader and Editor. Take ComPDF Java Android PDF SDK as an example.
🌐
YouTube
youtube.com › watch
This Crazy Android App Makes PDF Editing Simple! - YouTube
#androidapps #pdfeditor #arsquad Check out PDF Element here and save up to 79% OFF: https://pdfelement.go.link/4i8QIIn today's video, we take a look at this ...
Published   March 9, 2026
🌐
Nutrient
nutrient.io › blog › sdk › programmatically editing a pdf using java
Programmatically editing a PDF using Java
March 2, 2022 - How to use Nutrient Java PDF library to perform various editing operations on a PDF document programmatically.
🌐
pdfFiller
guides.pdffiller.com › home › how to guides catalog › edit › how to edit pdf files in mobile
How to Edit PDF Files in Mobile | pdfFiller
July 1, 2025 - Learn how to edit pdf files in mobile in a few simple steps with pdfFiller. Step-by-step guide, useful tips, and the best ways to use PDF, sign and AI features.
🌐
Pdfgear
pdfgear.com › home › pdf editor reader › how to edit a pdf on android for free and easily
How to Edit a PDF on Android for Free and Easily
October 11, 2024 - Learn about free and easy methods to edit PDFs on Android, with/without an app. ... Unlike iOS which offers built-in PDF markup features, the Android mobile operating system doesn’t natively support editing PDF files, thus you need a dedicated app or service for the job.
🌐
Quora
quora.com › What-are-the-possibilities-to-read-and-edit-sdcard-pdf-file-within-android-application-I
What are the possibilities to read and edit sdcard pdf file within android application? I - Quora
December 28, 2014 - Answer: Try itext pdf editor for android iText, Programmable PDF software i used it for a pdf editing app With it you can edit pdfs, view em and do much more like insert images etc. I guess if u need to make apps with it u need some kind of liscence. it doesnt come under gpl