PDF Viewer
An extension for MIT App Inventor 2.Developed by The K Studio.
PDF Viewer Extension for AI2 β Load, View & Navigate PDFs Seamlessly! 
Bring professional PDF viewing to your AI2 apps with the PDF Viewer Extension! Whether you're displaying ebooks, invoices, reports, study materials, or user manuals, this extension ensures smooth, efficient, and customizable PDF rendering.
Key Features:
Load PDFs from Multiple Sources β Assets, Storage, URLs, and Content URIs
Single-Page & Continuous Scroll Modes β Perfect for reading long documents
Adjustable Render Quality β Balance between speed & clarity
Save PDF Pages as Images β Export selected pages or save all in one click!
Zoom & Pan Support β Easily zoom into details
Customizable Background Color β Adjust for dark mode or aesthetic needs
Page Navigation β Jump to specific pages instantly
Page Snap Feature β Enable or disable smooth swiping between pages
Total Page Count Retrieval β Get the number of pages dynamically
Optimized for Performance β Loads PDFs efficiently without lag
Works in Both Portrait & Landscape
Light Weight Extension β Since this does not uses any PDF Viewer library!
Specifications
Package: com.thekstudio.pdfviewer
Size: 64.00 KB
Version: 1.0
Minimum API Level: 7
Updated On: 2025-02-28T18:30:00Z
Built & documented using: FAST-CLI
v2.4.2
Events:
PDFViewer has total 7 events.
DownloadProgress
Triggered when download progress updates.
Parameter | Type |
---|---|
progress | number |
RenderProgress
Triggered to indicate rendering progress.
Parameter | Type |
---|---|
progress | number |
PDFLoaded
Triggered when a PDF is successfully loaded with the total number of pages.
Parameter | Type |
---|---|
totalPages | number |
pdfFileName | text |
PageChanged
Triggered when the page changes.
Parameter | Type |
---|---|
currentPage | number |
OnError
Triggered when an error occurs.
Parameter | Type |
---|---|
errorMessage | text |
PageSaved
Triggered when a page is successfully saved. Return saved page file path.
Parameter | Type |
---|---|
pageIndex | number |
filePath | text |
AllPagesSaved
Triggered when all pages are successfully saved. Returns the saved pages directory path.
Parameter | Type |
---|---|
outputDir | text |
Methods:
PDFViewer has total 10 methods.
LoadPDF
Loads a PDF from the given file path and loads PDF View in the given component layout. Supports loading from assets, storage, URL, or content URIs. Specify 'test.pdf' for assets, '/storage/emulated/0/test.pdf' for storage, 'http://example.com/test.pdf' for URL, and 'content://...' for content URIs.
Parameter | Type |
---|---|
filePath | text |
component | component |
orientation | Orientation (helper blocks) |
enableSnap | boolean |
ClosePDF
Closes the currently opened PDF.
GetTotalPages
Returns the total number of pages in the PDF.
GetCurrentPage
Returns the currently visible page index.
GoToPage
Jumps to a specific page in the PDF.
Parameter | Type |
---|---|
pageIndex | number |
GetASD
Returns the app's specific directory (ASD).
GetPDFFileName
Returns the file name of the currently opened PDF.
SavePage
Saves the PDF page to the given file path as an image.
Parameter | Type |
---|---|
pageIndex | number |
outputPath | text |
SaveAllPages
Saves all rendered PDF pages to the given directory.
Parameter | Type |
---|---|
outputDir | text |
GetRenderedPageCount
Returns the total number of pages rendered.
Setters:
PDFViewer has total 2 setter properties.
BackgroundColor
Specifies the background color of the PDF Viewer.
- Input type:
color
- Default value: WHITE (
&HFFFFFFFF
)
RenderQuality
Sets the rendering quality between 30 to 500. Default is 100. Set lower quality for better performance.
- Input type:
integer
- Default value:
100
USAGE:
Test APK:
Video:
DOWNLOAD:
v1.0 com.thekstudio.pdfviewer.aix (64.0 KB)
Test.aia (1.0 MB)
Note: Drag ListView AI2 component to the Screen1 to add RecyclerView library to the project which is required for the extension to work.
I'm looking for sponsors to support the release of this extension with a total contribution of $25.
Leave a like if found useful