R – Embedded PDF Viewer in a WinForms Control

netpdfwinforms

I'm trying to embed a pdf viewer in a WinForms Control in such a way that I can display the pdf to the user within the context of my application. I also need to prevent the user from copying text, printing, or saving a copy (sensitive data).

Thus far I've tried using a WebBrowser to host the Acrobat Reader activex control. This gets me close but leaves me with 2 problems.
1. Any pdfs I open seem to stay open from a file handle standpoint until the application shuts down. I've tried calling Dispose() and Navigate() to no avail.
2. I need to disable the toolbar in Reader. I can't set the viewer preferences in the original pdf files but I'm considering using iText to rewrite the files with the preferences set (if I can do that).

I'd also be happy with a well recommended 3rd party library that does this.

Best Answer

Re: 1. It kind of sucks but you could make a copy of the PDF to the temp folder

Path.GetTempPath()

and open that each time the user needed to see that PDF, so you let Reader lock that file all it wants.

Re: 2. Did you try appending

toolbar=0

to the URL? Ref (and example!) at:

see http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf#toolbar=0

Related Topic