FORGE KUI / docs

PDF viewing and export

The PDF viewer is a PDFium-based kui_ext_pdf element extension.

Version 3.61.7

Integration

The PDF viewer is a PDFium-based kui_ext_pdf element extension. Core document export and PDF viewing are different interfaces. Give the viewer an explicit display mode and size. Check loading, page count, zoom, text extraction and search in the target package.

Constraints and troubleshooting

The viewer page attribute is one-based, while Lua gotoPage(n) is zero-based. Convert business-layer page numbers explicitly to avoid errors at the first and last pages. Deploy matching PDFium dependencies and avoid mixing DLL architectures.

Embed a PDF element

Deploy kui_ext_pdf and PDFium, load the element extension, then create kui-pdf. src points to an application-provided file, with dimensions set by layout. This markup illustrates structure; the application supplies the document file.

html
<kui-pdf src="documents/manual.pdf"
  style="width:100%;height:640px"></kui-pdf>

Pages, zoom and text

Registered methods include getPageCount, getPageSize, gotoPage, nextPage, prevPage, getZoom, setZoom, getPageText and findText. Check index conventions, return values and loading errors for each method. Reading support does not establish PDF forms, editing, signatures or every font scenario.

Check reading and export separately

Verify a minimal scenario in this order before integrating the full application.

  1. Open a known PDF and check pages, zoom, scrolling and close.
  2. Provide clear feedback for damaged, encrypted or very large files.
  3. Check export page size, fonts, pagination and destination separately; a screenshot is not a PDF export.
  4. Test both paths from the copied deliverable to expose missing dependencies.