Displaying a PDF file using UMG 3D Widet.. possible?

Was wondering if this is possible? It seems likely that it is, but there are a couple of questions regarding it that I do have:

  • Ease of implementing the Adobe Reader API into the engine: API Documentation Reference
  • Text readability within the “game”… this is especially a question in regards to using VR HMD’s.

The next thing would be to create a file “directory” which would bring up a “Choose folder location”, and then set a “Document reader” type of thing to list all files within that directory. When the user selects the file, then the book opens up or something to allow the person to read the book while in VR. Seems like an interesting project at least.

I might be able to do this using the Web Browser widget. It occured to me after posting, although I’ll need to test it. Hopefully it has the ability to read PDF’s which all web browsers should be able to

Edit: After testing, the web browser widget does in fact show the directory, however, when the URL is pointed to the .pdf, nada, just a blank “screen”… or would that be a blank widget? Confusing, I know.

One other thing was that text readability in the web browser, at “book sizes” in VR makes the text almost unreadable. The DPI of the Rift just isn’t high enough :\

This is a really interesting idea, but I agree that the standard book font size may be too small to read and the rendering fidelity on text in general is only so-so in a VR headset.

Have you tried VaQuole to view the pdf files?

Interesting, I didn’t even know VaQuole existed :slight_smile: I’ll give it a shot.

I actually already tried it with no success. =( Now if only there were a standardized way to turn pdf, or any book/ebook pages into web pages…

You’d probably be better off using some web service to convert PDF files to images instead of trying to implement a PDF viewer in-engine.

Hi guys,

Is there a better solution for this now?

Thanks :slight_smile:

Maybe a command line tool that converts the PDF into images would be an easier approach? With the number of open source PDF rendering engines out there, surely something like that exists.

Any movement on this idea? It would appear there’s a few people looking to do just this.
Also Higher Res VR headsets are getting released now so this may have a lot more real world application these days

you can use ViewerJS for that. It works perfect. There is no UE4 side coding.

Quick Instruction:

  • Download “Viewer JS” ViewerJS Get ViewerJS
  • Install Wamp (you can use another server)
  • Create a folder in “www” with a name which you desire (mine is PDF_Viewer)
  • copy “ViewerJS” folder and its contents from zip to created folder in www
  • Create another folder in PDF_Viewer (or what you call your first created folder) (mine is PDFs)
  • start wamp
  • Point UE4 Web Browser Widget to “localhost/PDF_Viewer/ViewerJS/#…/PDFs/file.pdf”

NOTE:
With this JS, you can show “.pdf / .odt / .ods / .odp” files

ODT = Open source version of .docx. Word can export
ODS = Open source version of .xlsx. Excel can export
ODP = Open source version of .pptx. Power Point can export.

License of JS is Apache 2.0

2 Likes

I created a plugin to import pdf files at runtime. it has these features.

  • pdf to texture2d with sampling support
  • get all texts as string
  • get all web links as string
  • get texts at selected area
  • It has a sample function about blueprints about zoom and highlight
  • android support
  • pdf to base64

but there is a limitation with android.
I am using pdfium. Latest versions for Android using LibPNG 1.6.2 and it has very strict rules about iccp chunk. If Android founds a problem with that chunk, it gives crash. So, I am using a pdfium from 2018. So, if you use a PDF version newer than ones from 2018 and if they don’t have backwards compability, it won’t works.

Windows platform doesn’t have this limitation. It uses latest PDFium.
Also I wrote a pdf to base64 string and base64 string to texture2d function for it. So, If you save these strings to your save file and share it, you can import them at the runtime with every platform.

Right now I am looking to base64url encoding and decoding.

You can download it from here. When I finished base64url thing, I will update it.

1 Like

link is to 404 page

While displaying a PDF in UMG directly isn’t straightforward, utilizing plugins, converting to images, or leveraging web browser capabilities are practical workarounds. If you’re looking for specific plugins or libraries, checking the Unreal Engine Marketplace or forums can yield useful resources.