VL.PDFReader

TL;DR

If you want to check it out install via commandline as described here:

nuget install VL.PDFReader


VL.CEF

First of all if you need a plain PDF viewer inside vvvv you can just use VL.CEF.

You will get:

  • a preview pane
  • navigatable TOC
  • easy page rotation and zoom
  • document properties

Unfortunately there is also a print dialog which can be used to “climb out of the sandbox”. There seems to be no easy way to just disable the print button.
One can append #toolbar=0 to the file URL but this disables everything except for the page view.



VL.PDF

If you want / have to create something that’s a bit less traditional @qbic recently provided another option. It’s based on PDFium and PDFiumCore.

From my limited testing it seems to load all pages at once which can potentially lead to problems with RAM when loading PDFs with a lot of pages and bigger page sizes. But this should be an easy thing to fix, just as well as the loading happening synchronously on the mainloop leading to framerate hickups.
Currently it only renders Skia images, there is no Stride texture option but I guess that can be amended. Not sure about the last issue I encountered though:
It sometimes crashed vvvv on reloading / changing the PDF file …
Maybe some Try regions and/or IsAssigneds will do the trick idk.

Application: vvvv.exe
CoreCLR Version: 8.0.724.31311
.NET Version: 8.0.7
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.


So here I am late to the party.

Started working on a the reader before @qbic released his version. TBH his release took the wind out of my sails and the thing has been pootling along since.
Initially I intended to somehow license it but the chances for monetizing were slim to begin with and most likely are 0 now .
Anyway.

The reader is based on PDFium and code from a PDFiumViewer fork and PDFtoImage. PDFtoImage seems also to be based on code from PDFiumViewer. It’s not mentioned anywhere though. While the former uses MIT the latter is Apache 2.0 licensed. Not quite sure how to deal with that yet.
All types have been adapted to ones used in VL (Stride.Core.Mathematics, Stride.Graphics, Skia) and the rendering parts changed accordingly.

There are four “high level” reader nodes (inspired by the ImagePlayer):

  • A Text version returning the text of the loaded pages.
  • A Skia version returning SKImages.
  • Two for Stride returning textures. One of them (currently marked experimental) offers less options but is a bit faster according to my tests. The “standard” Stride reader was able to “play back” PDFs (page size 1080 x 1920) @ 60 FPS on my desktop with a AMD Ryzen 9 7950X3D.

Afaict there aren’t any leaks anymore and I didn’t encounter any crashes.

PDFs can be searched for text.

And there is a bunch of options for rendering.

There are a couple of “lower level” nodes giving access to meta data for example.

Or you can go even lower and patch everything from scratch.


It’s not an editor.

PDFium offers some options to manipulate (mainly rotating and removing pages) loaded documents and save the changes either to the same files or as a copy. Those have intentionally been left out.

12 Likes

If you encounter any problems please create an issue on github.