Display highlighted text in DynaPDFMBS

I have a highlighted PDF (its a play script with the actor’s lines already highlighted in another app)

If I use any of the ways I know to display the PDF pages in a canvas on a window (eg the various permutations of RenderPagePicture/ Image etc etc

then the highlighting is ignored.

Is there a flag for this sort of thing?

(Im starting on Windows and cannot use the built in Mac classes exposed by MBS)

These highlights are usually annotations.

  1. Load PDF
  2. Call FlattenAnnots method
  3. Render page

Then discard the PDF in memory.

Sounded plausible. Sadly, nothing happened there.

Nothing?

Something like this?

Var f1 As Integer = pdf.FlattenAnnots(pdf.kafNone)
If f1 < 0 Then Return

Var f2 As Boolean = pdf.FlattenForm
If f2 = False Then Return

with checking for errors?

These dont generate any errors.

But here is the PDF, side by side with Mac’s Preview (still ultimately targetting Windows..)

Solved:

The example code I had for displaying PDF includes this line:

Call pdf.SetImportFlags(pdf.kifImportAsPage) // important! It makes the rendering faster.

It also discards stuff like annotations. Commenting that line out works!

1 Like