Foxit pdf SDK for Android

Creating, viewing and editing PDF files on Android devices has never been easier than with our modern, easy-to-use PDF SDK for Android. Alongside Foxit’s powerful Core API, our built-in UI Extension component helps to ship products quickly, even if your team of developers has limited knowledge of PDF. Powered by Fx Core™ technology, PDF SDK for Android has never been as fast or precise as it is now.

DEVELOPING WITH OUR ANDROID PDF SDK

Using Android Studio developers can use our Android PDF SDK in a variety of languages such as Java, Kotlin or C++. With JavaScript you can use our Cordova or React Native binding libraries for more native development. Foxit provides all the essentials for an Android developer to use our technology with ease. Simply put, our core API makes our product easily accessible for developers of all levels and experience.

Android PDF SDK

FEATURES

PDF Page View Android
Ink Signatures Android
Form filling Android

PDF Viewing

Our core API provides for high-fidelity rendering of PDF documents with optimized performance for Android and other mobile platforms.

Digital Signature

Use ink signatures to let customers sign documents in their android device. No need to print a file to sign again!

PDF Forms

Give users the ability to fill out digital forms on the go with their android device. Mobile apps have never been more productive!

PDF Password Android
Strikeout annotation
Full Text Search

Rights Management

Our Android PDF SDK can generate secure PDFs with native encryption/decryption or integrate with customized DRM or IRM security systems. Our technology integrates with Microsoft RMS.

PDF Annotations

Our Android PDF SDK provides full support for annotating and marking up content with an extensive range of functions for creating, editing or importing/exporting annotations.

Full-Text Search

Fast full-text search for any PDF document, language, or encoding type. The SQLite-based full-text search delivers near-instant results, even for repositories on any Android device.

New!

Introducing PDF SDK 6.1

Foxit PDF SDK 6.1 introduces full support for Xamarin, Cordova, and React Native on Android and iOS, and Kotlin on Android, as well as support for Associated Files, Embedded fonts, and improvements to our Redaction features. Try it today for free for 15 days!

ADVANCED TECHNOLOGY

XFA FORMS

XFA Forms are XML-based forms wrapped inside a PDF. Securely capture, present, move, process, output, update and print information associated with static and dynamic XFA forms. Simplify your data sharing, transportation and availability with XFA.

RIGHTS MANAGEMENT

Keep your PDF documents secure by connecting your application and files to Microsoft's Rights Management Services platform natively. Foxit PDF SDK also integrates with your IRM and DRM solution.

OCR

Convert scanned documents to searchable text PDFs with our highly accurate enterprise optical character recognition (OCR) software. Designed for scanning, and archiving, our robust functionality outputs 13 different file formats including PDF & PDF/A.

REDACTION

Programmatically search and sensor sensitive information in a document for legal or security purposes to keep your customer and employee information safe.XFA.
Achieve full GDPR-compliance.

CONNECTED PDF

Leverage Foxit's cutting-edge technology that powers document intelligence, security and collaboration services, programmatically, for PDF files. Secure files, access analytics, and collaborate in real time, all within one SDK.

CONVERSION

Leverage our conversion and compression technology to speed up file conversion and archiving. Convert TIFF, JPEG, Word, Email, HTML, ASCII text and more to file formats including PDF and PDF/A.

XFA FORMS

XFA Forms are XML-based forms wrapped inside a PDF. Securely capture, present, move, process, output, update and print information associated with static and dynamic XFA forms. Simplify your data sharing, transportation and availability with XFA.

Rights Management

Keep your PDF documents secure by connecting your application and files to Microsoft's Rights Management Services platform natively. Foxit PDF SDK also integrates with your IRM and DRM solution.

OCR

Convert scanned documents to searchable text PDFs with our highly accurate enterprise optical character recognition (OCR) software. Designed for scanning, and archiving, our robust functionality outputs 13 different file formats including PDF & PDF/A.

REDACTION

Programmatically search and sensor sensitive information in a document for legal or security purposes to keep your customer and employee information safe. Achieve full GDPR-compliance.

CONNECTEDPDF

Leverage Foxit's cutting-edge technology that powers document intelligence, security and collaboration services, programmatically, for PDF files. Secure files, access analytics, and collaborate in real time, all within one SDK.

CONVERSION

Leverage our conversion and compression technology to speed up file conversion and archiving. Convert TIFF, JPEG, Word, Email, HTML, ASCII text and more to file formats including PDF and PDF/A.

FOXIT ANDROID PDF SDK

Our Android PDF Reader is built with our PDF SDK for Android and free to download from the Google Play Store. 

BENEFITS

Native UI

Our Android PDF SDK is built with developers in mind. We provide a built in PDF viewer which will half your development while allowing you to customize your viewer accordingly.

GOOGLE PLAY READY

Our Android PDF library is fully compliant with Google’s policies for app developers using third-party components, meaning your apps will be approved on Play Store faster.

Device agnostic

Anything from smart watches, to phones, to Chromebooks, to even cars – Foxit PDF SDK renders documents inside your application just like you expected them.

Powered by Foxit's Core Technology

The core technology of Foxit PDF SDK has been around for years and is trusted by a large number of well-known companies. Foxit’s powerful engine makes document viewing fast and consistent across all platforms.

SYSTEM REQUIREMENTS

  • Android 4.x or newer
  • 32/64-bit ARM (armeabi-v7a/arm64-v8a) or 32-bit Intel x86 CPU

Sample Code in Android Studio

public class Outline {
    private String mFilePath = "";
    private Context mContext = null;
    private static int index = 0;

    public Outline(Context context, String pdfFilePath) {
        mFilePath = pdfFilePath;
        mContext = context;
    }

    public void modifyOutline() {
        int indexPdf = mFilePath.lastIndexOf(".");
        int indexSep = mFilePath.lastIndexOf("/");

        String filenameWithoutPdf = mFilePath.substring(indexSep + 1, indexPdf);
        String outputFilePath = Common.GetOutputFilesFolder(Common.outlineModuleName) + filenameWithoutPdf + "_edit.pdf";

        PDFDoc doc = null;
        doc = Common.loadPDFDoc(mContext, mFilePath, null);
        if (doc == null) {
            return;
        }
        try {
            Bookmark bookmarkRoot = doc.getRootBookmark();
            if (bookmarkRoot == null) {
                return;
            }

            Bookmark firstChild = bookmarkRoot.getFirstChild();
            modifyOutline(firstChild);

            if (false == doc.saveAs(outputFilePath, PDFDoc.e_SaveFlagNormal)) {
                Toast.makeText(mContext, "Save document error!", Toast.LENGTH_LONG).show();
                return;
            }
        } catch (PDFException e) {
            Toast.makeText(mContext, "Outline demo run error. " + e.getMessage(), Toast.LENGTH_LONG).show();
            return;
        } finally {
            Common.releaseDoc(mContext, doc);
        }
        Toast.makeText(mContext, Common.runSuccesssInfo + outputFilePath, Toast.LENGTH_LONG).show();
    }

    private void modifyOutline(Bookmark bookmark) {
        try {
            if (bookmark.isEmpty())
                return;

            if (index % 2 == 0) {
                bookmark.setColor(0xFFFF0000);
                bookmark.setStyle(Bookmark.e_StyleBold);
            } else {
                bookmark.setColor(0xFF00FF00);
                bookmark.setStyle(Bookmark.e_StyleItalic);
            }

            bookmark.setTitle("foxitbookmark" + index);
            index++;

            //Traverse the brother nodes and modify their appearance and titles.
            Bookmark nextSibling = bookmark.getNextSibling();
            modifyOutline(nextSibling);

            //Traverse the children nodes and modify their appearance and titles.
            Bookmark child = bookmark.getFirstChild();
            modifyOutline(child);

        } catch (PDFException e) {
            Toast.makeText(mContext, "Outline demo run error. " + e.getMessage(), Toast.LENGTH_LONG).show();
        }
    }
} 
public class Render {
    private Context mContext = null;
    private String mPath = null;

    public Render(Context context, String path) {
        mContext = context;
        mPath = path;
    }

    public void renderPage(int index) {
        PDFDoc doc = Common.loadPDFDoc(mContext, mPath, null);
        if (doc == null) return;

        try {
            int pageCount = doc.getPageCount();
            if (index > pageCount || index < 0) {
                Toast.makeText(mContext, String.format("The page index is out of range!"), Toast.LENGTH_LONG).show();
                return;
            }

            String name = mPath.substring(mPath.lastIndexOf("/") + 1, mPath.lastIndexOf("."));
            String outputFilePath = String.format("%s_index_%d.jpg", Common.GetOutputFilesFolder(Common.renderModuleName).concat(name), index);
            PDFPage pdfPage = Common.loadPage(mContext, doc, index, PDFPage.e_ParsePageNormal);
            if (pdfPage == null) {
                return;
            }

            //Create the bitmap and erase its background.
            Bitmap bitmap = Bitmap.createBitmap((int) pdfPage.getWidth(), (int) pdfPage.getHeight(), Bitmap.Config.ARGB_8888);

            //If the page has transparency, the bitmap should be erased "Color.TRANSPARENT".
            if (pdfPage.hasTransparency()){
                bitmap.eraseColor(Color.TRANSPARENT);
            }
            else {
                bitmap.eraseColor(Color.WHITE);
            }

            Matrix2D matrix = pdfPage.getDisplayMatrix(0, 0, (int)pdfPage.getWidth(), (int)pdfPage.getHeight(), Constants.e_Rotation0);

            Renderer renderer = new Renderer(bitmap,true);

            //Render the page to bitmap.
            Progressive progressive = renderer.startRender(pdfPage, matrix, null);
            int state = Progressive.e_ToBeContinued;
            while (state == Progressive.e_ToBeContinued) {
                state = progressive.resume();
            }
            progressive.delete();
            if (state == Progressive.e_Error) {
                Toast.makeText(mContext, String.format("Failed to render the page No.%d failed!", index), Toast.LENGTH_LONG).show();
                return;
            }

            //Save the render result to the jpeg image.
            if (false == Common.SaveImageFile(bitmap, Bitmap.CompressFormat.JPEG, outputFilePath)) {
                Toast.makeText(mContext, String.format("Failed to Save Image File!"), Toast.LENGTH_LONG).show();
                return;
            }

            renderer.delete();
            pdfPage.delete();
            Toast.makeText(mContext, Common.runSuccesssInfo + outputFilePath, Toast.LENGTH_LONG).show();
        } catch (PDFException e) {
            Toast.makeText(mContext, String.format("Failed to render the page No.%d! %s", index, e.getMessage()), Toast.LENGTH_LONG).show();
        } finally {
            Common.releaseDoc(mContext, doc);
        }
    }
}