{"id":20347797,"url":"https://github.com/itext/itext-android-ui","last_synced_at":"2026-02-27T12:34:06.303Z","repository":{"id":37274253,"uuid":"481632970","full_name":"itext/itext-android-ui","owner":"itext","description":null,"archived":false,"fork":false,"pushed_at":"2022-06-20T23:51:05.000Z","size":38398,"stargazers_count":51,"open_issues_count":0,"forks_count":5,"subscribers_count":10,"default_branch":"develop","last_synced_at":"2025-04-12T01:02:49.368Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itext.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-14T14:20:40.000Z","updated_at":"2025-01-15T04:53:53.000Z","dependencies_parsed_at":"2022-09-06T13:21:10.420Z","dependency_job_id":null,"html_url":"https://github.com/itext/itext-android-ui","commit_stats":null,"previous_names":["itext/itext-android-ui"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itext%2Fitext-android-ui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itext%2Fitext-android-ui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itext%2Fitext-android-ui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itext%2Fitext-android-ui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itext","download_url":"https://codeload.github.com/itext/itext-android-ui/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501870,"owners_count":21114683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T22:18:08.868Z","updated_at":"2026-02-27T12:34:01.255Z","avatar_url":"https://github.com/itext.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Table of Contents\n1. [Setup](#setup)\n   1. [Toubleshooting](#troubleshooting)\n2. [Using the SDK](#third-example)\n   1. [Create PDFFragment via code](#create-pdffragment-via-code)\n   2. [Inflate PDFFragment via XML](#inflate-pdffragment-via-xml)\n   3. [Split PDF](#split-pdf)\n   4. [Manipulate PDF directly (without UI)](#manipulate-pdf-directly-without-ui)\n   5. [Receiving results](#receiving-pdf-results)\n\n# Setup\n\nThe SDK depends on forked versions of [PdfiumAndroid](https://github.com/itext/PdfiumAndroid) and \n[AndroidPdfViewer](https://github.com/itext/AndroidPdfViewer) whose artifacts are stored on \n[iText Artifactory](https://repo.itextsupport.com/ui/repos/tree/General/android/com/itextpdf/android). Artifacts will\nbe loaded during the SDK build by gradle.\n\nIf you want to build SDK with custom version of PdfiumAndroid or\\and AndroidPdfViewer you need to clone repositories, \nmake necessary changes and then publish them to local maven storage. So SDK will use custom local artifacts as dependencies.\n\n## Troubleshooting\n\n### No whitespaces in your paths\nDo not use spaces in your local paths/directories, as it can lead to all sorts of errors related to Android NDK, ndk-build or cmake.\n\n### NDK setup\nIf you are having problems related to Android NDK, make sure to follow the correct setup procedure:\nhttps://developer.android.com/studio/projects/install-ndk\n\n\n# Using the SDK\n\nThe SDK provides different Fragments and classes to manipulate PDF files.\n\n## Create PDFFragment via code\n\nYou can create a new instance of PdfFragment via code:\n\n```kotlin\nprivate fun showPdfFragment(pdfUri: Uri) {\n    \n    // See PdfConfig for all available customization options\n    val config = PdfConfig(pdfUri = pdfUri, showScrollIndicator = true)\n    \n    // Create PdfFragment\n    val pdfFragment = PdfFragment.newInstance(pdfConfig)\n\n    // show fragment, e.g. via supportFragmentManager\n\n}\n```\n\n## Inflate PDFFragment via XML\n\nYou can also inflate a PDF fragment via XML. In thise case, the fragment is customizable via different styleables, such as app:enable_split_view, etc.\n\n```xml\n\n    \u003c!-- The PDF fragment can be configured in XML via different styleables, such as app:enable_split_view, etc. --\u003e\n    \u003candroidx.fragment.app.FragmentContainerView\n        android:id=\"@+id/pdf_fragment_container\"\n        android:name=\"com.itextpdf.android.library.fragments.PdfFragment\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        app:background_color=\"#F4EFBB\"\n        app:display_file_name=\"true\"\n        app:file_name=\"sample_1.pdf\"\n        app:file_uri=\"file:///storage/emulated/0/Android/data/com.itextpdf.android.app/cache/sample_1_copy.pdf\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\"\n        app:enable_split_view=\"false\"\n        app:page_spacing=\"400\"\n        app:primary_color=\"#217C12\"\n        app:secondary_color=\"#C6E6C1\" /\u003e\n```\n\n## Split PDF via Fragment\n\nYou can directly launch fragment to split PDF documents via...\n\n```kotlin\nprivate fun showSplitFragment(pdfUri: Uri) {\n\n    val config = PdfConfig(pdfUri = pdfUri, showScrollIndicator = true)\n    val splitFragment = SplitDocumentFragment.newInstance(config)\n    // show fragment, e.g. via supportFragmentManager\n}\n```\n\n## Manipulate PDF directly (without UI)\n\nYou can directly manipulate PDF files without showing a Fragment-UI by using the PDFManipulator:\n\n```kotlin\nval manipulator = PdfManipulator.create(requireContext(), pdfUri)\n\nmanipulator.addTextAnnotationToPdf(...)\nmanipulator.splitPdfWithSelection(...) \nmanipulator.addMarkupAnnotationToPdf(...) \n// etc...\n```\n\n## Receiving PDF results\n\nYou can receive fragment results by registering a fragment result listener to your fragmentManager.\n\n```kotlin\nprivate fun listenForPdfFragmentResult(fragmentManager: FragmentManager) {\n    \n    fragmentManager.setFragmentResultListener(PdfFragment.REQUEST_KEY, this) { requestKey: String, bundle: Bundle -\u003e\n\n        // Retrieve fragment result from bundle\n        val result: PdfResult? = bundle.getParcelable(PdfFragment.RESULT_FILE)\n\n        when (result) {\n            is PdfResult.CancelledByUser -\u003e // ...\n            is PdfResult.PdfEdited -\u003e // ...\n            is PdfResult.PdfSplit -\u003e // ...\n            is PdfResult.NoChanges -\u003e // ...\n            null -\u003e // ...\n        }\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitext%2Fitext-android-ui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitext%2Fitext-android-ui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitext%2Fitext-android-ui/lists"}