{"data":{"slug":"github-xberg-io-xberg-ai-rulez-skills-pdf-backends-3d09eef1bd63","title":"Select and Configure PDF Backend","summary":"Choose between Native and Pdfium backends for PDF processing, and configure their behavior for text extraction, rendering, and OCR.","url":"https:\/\/skillshunter.net\/skills\/github-xberg-io-xberg-ai-rulez-skills-pdf-backends-3d09eef1bd63","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-xberg-io-xberg-ai-rulez-skills-pdf-backends-3d09eef1bd63","markdown_url":"https:\/\/skillshunter.net\/skills\/github-xberg-io-xberg-ai-rulez-skills-pdf-backends-3d09eef1bd63.md","download_url":"https:\/\/skillshunter.net\/skills\/github-xberg-io-xberg-ai-rulez-skills-pdf-backends-3d09eef1bd63\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"The Native backend supports full Xberg PDF pipeline features including text extraction, rendering, OCR, tables, and metadata, while the Pdfium backend has a narrower capability surface and requires the `pdf-pdfium` Cargo feature.","instructions":"---\ntype: Playbook\ntitle: Pdf Backends\ndescription: \"Native\/Pdfium selection, rendering, encryption and OCR fallback for PDF work.\"\npaths:\n  - \"crates\/xberg\/src\/pdf\/**\"\n  - \"crates\/xberg\/src\/extractors\/pdf\/**\"\n  - \"crates\/xberg-native-pdf\/**\"\n  - \"crates\/xberg-pdfium-render\/**\"\nx-ai-rulez:\n  kind: skill\n  id: pdf-backends\n  metadata:\n    name: pdf-backends\n---\n\n# PDF backends\n\n`PdfConfig.backend` selects `PdfBackend::Native` (default) or `PdfBackend::Pdfium`. Backend choice is explicit: never\nsilently return native output when Pdfium was requested.\n\n## Native backend\n\n- The native engine is `xberg_native_pdf` and supports the full Xberg PDF pipeline: text and structure extraction,\n  page rendering\/OCR fallback, tables, annotations, images, attachments, and richer metadata.\n- `config.force_ocr` forces the whole document; `config.force_ocr_pages` selects pages. Otherwise, pages without usable\n  native text can enter the OCR stage inside `PdfExtractor`; OCR is not a second PDF extractor in the registry.\n- `PdfRenderSession` in `pdf\/render.rs` opens document bytes once and exposes page count and page rendering. Use it for\n  repeated page renders instead of reopening the same document for each page. It is a Rust primitive and need not be\n  exposed by every binding.\n\n## Pdfium backend\n\n- Pdfium requires the `pdf-pdfium` Cargo feature. Selecting it without that feature must return an actionable error.\n- Runtime dynamic loading honors `PDFIUM_DYNAMIC_LIB_PATH` as a directory containing the platform library. Build-time\n  static and dynamic link variables are not interchangeable with runtime discovery.\n- Pdfium binding is process-global and operations are serialized by the engine lock. Preserve that invariant when\n  changing concurrency.\n- The Pdfium implementation intentionally has a narrower capability surface: text, page count, and Info-dictionary\n  metadata. It warns about omitted native capabilities rather than pretending parity.\n\n## Verification\n\nTest backend selection separately from document semantics. A missing Pdfium runtime is infrastructure failure unless\nthe job promises to provision it; when `XBERG_REQUIRE_PDFIUM` is set, skipping because the library or fixture is\nabsent is a failure. Use corpus fixtures through the `test-corpus` skill and include Pdfium artifacts in benchmark\naggregation when the adapter is enabled.\n","use_cases":["Extract text and structure from PDFs using the Native backend for full feature support.","Render PDF pages efficiently using the Pdfium backend for lightweight operations.","Force OCR on specific pages when native text extraction is not sufficient."],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/xberg-io\/xberg\/blob\/ffbf7971796a126fc52f6bb8fb40418772071f61\/.ai-rulez\/skills\/pdf-backends\/SKILL.md","source_commit":"ffbf7971796a126fc52f6bb8fb40418772071f61","license":null,"version":null,"listing_approved_at":"2026-11-16","created_at":"2026-11-15T13:36:37.000000Z","updated_at":"2026-11-16T05:16:54.000000Z","seo_title":"Select PDF Backend for Text Extraction and Rendering","seo_description":"Configure PDF backends for text extraction, rendering, and OCR. Choose between Native and Pdfium with specific use cases and limitations.","seo_keywords":["PDF backend selection","PDF text extraction","PDF rendering configuration","OCR on specific pages","Pdfium vs Native backend"]}}