tutorial · 2026-05-06
Loading Password-Protected PDFs in Unreal Engine
Pass an encrypted document's password to LoadPDF, catch the failure event, and read the exact error so a wrong password never fails silently.
The problem: an encrypted PDF that just won't appear
You drop a PDF onto a mesh in your level, hit Play, and nothing renders. The file is fine, the path is right, but the document is encrypted and you never told the viewer the password. If you want to know how to make Unreal Engine open an encrypted PDF with a password, the answer is a single optional argument plus two events worth wiring up so the failure is never silent.
Simple PDF Viewer renders PDF pages by rasterising them to a UTexture2D and showing them on an in-world mesh, with rendering powered by the bundled PDFium library. It supports encrypted documents through an optional password parameter on load, so the whole job comes down to passing that password and then deciding what happens when it is wrong.
The password parameter on LoadPDF
Both ways of using the plugin accept the password. On the drop-in 'PDF Viewer' actor (the APDFViewerActor), set 'PDF File Path' and then set the optional 'Password' field in the Details panel. With 'bAutoLoad' and 'bLoadOnStart' enabled by default, the actor loads on Play using whatever password you supplied, and auto-orients its display mesh from the page aspect ratio.
If you are driving the viewer yourself, add a 'PDF Renderer' component (the UPDFRenderComponent) to your actor and call the 'Load PDF' node. It takes the file path and a Password argument; for an unencrypted document you simply leave the password empty.
1. Add a 'PDF Renderer' (UPDFRenderComponent) to your actor, or reference an existing 'PDF Viewer' actor in the level.
2. Call 'Load PDF' and connect the absolute file path (or build one with the content/project-relative path helpers in the Blueprint library).
3. Fill the Password pin with the document's password. This is the same string a desktop reader would prompt you for; an encrypted PDF will not rasterise without it.
4. Bind 'OnPDFLoaded' so you know the page count once it succeeds, then drive 'Next Page', 'Previous Page' or 'Go To Page' to move through it.
Handling OnPDFLoadFailed
A wrong or missing password is a load failure, and the viewer surfaces it through the 'OnPDFLoadFailed' event, which fires with an ErrorMessage string. Bind this delegate before you call 'Load PDF' so you catch the very first attempt rather than discovering later that the mesh is showing the bundled NoPDFLoaded placeholder.
From the 'OnPDFLoadFailed' node, route the ErrorMessage into your UI. A practical pattern is to show a small prompt that lets the player re-enter the password and call 'Load PDF' again with the new value, instead of leaving them staring at a blank surface. Because 'OnPDFLoaded' reports the page count on success and 'OnPageChanged' reports the new and total page on navigation, you can keep your UI in sync with both outcomes from the same place you bound the failure.
Wiring the failure path is not optional polish. The plugin does no telemetry and operates offline, so the only signal that a password was wrong is the event you chose to listen to.
Reading GetLastError
When you need the failure reason outside the immediate event, call 'Get Last Error', which returns the last error message recorded by the renderer. This is useful when the code that triggered the load is not the code that needs to report the problem, for example a separate HUD widget that polls state after a load attempt, or a tools script that logs why a batch import failed.
Treat the ErrorMessage from 'OnPDFLoadFailed' and the string from 'Get Last Error' as human-facing diagnostics to display or log, not as machine-readable codes to branch on. Surface them, and your password handling becomes obvious to debug rather than a guessing game.
FAQ
How do I make Unreal Engine open an encrypted PDF with a password?
Call 'Load PDF' on a UPDFRenderComponent (or set the 'Password' field on the APDFViewerActor) and pass the document's password as the Password argument. The page will not rasterise without it. Bind 'OnPDFLoadFailed' first so a wrong password is reported rather than failing silently.
What happens if the password is wrong?
The load fails and 'OnPDFLoadFailed' fires with an ErrorMessage string describing the problem. Catch that event to prompt for the password again or show an error. You can also call 'Get Last Error' afterwards to retrieve the last recorded error message.
Where do I set the password on the drop-in viewer actor?
On the APDFViewerActor ('PDF Viewer'), set the optional 'Password' field in the Details panel alongside 'PDF File Path'. With 'bAutoLoad' and 'bLoadOnStart' on by default, it loads on Play using that password.
Is text from the encrypted PDF selectable or searchable once loaded?
No. Simple PDF Viewer rasterises each page to a texture and displays it as an image. There is no text selection, text extraction, form filling or hyperlink navigation in the public Blueprint API; the password only governs whether the page can be rasterised at all.
Which platforms and engine versions support this?
Simple PDF Viewer is Windows only (Win64), because PDFium is bundled for that platform. It ships live packages for Unreal Engine 5.5, 5.6 and 5.7.
Simple PDF Viewer
Display PDFs inside Unreal — render pages to textures on meshes and actors with page navigation, a Blueprint API for loading and querying documents, and editor utilities to preview and auto-build the display material. Powered by PDFium; no telemetry.