Introduction
I use the acrobat reader activex control to show pdf’s in my winforms application. And yesterday I was bitching about it on twitter because it for some reason was blocking a folder on my buildserver every time I ran a build. At that point in time I could either choose to avoid the tests that made this happen or just use a hammer and get rid of the adobe acrobat reader at the end of my build. So I bitched about this on twitter, as one always does, and I got some very useful replies.
And did you see the suggestion by the ever brilliant Jeremiah Peschka. So I did what he said and checked that project out.
Pdfviewernet
You can find pdfviewernet on google code. First thing you’ll note is that it is written in VB.Net which is brilliant. Second thing to note is that the downloads have a very old date on them. So I decided to install tortoisesvn again and compile against the trunk.
Sadly it isn’t on nuget (yet).
This is very easy and if you then open and run it you even get a little demo app to play with.
I opened a pdf with it.
And I did the OCR thing on that pdf file.
I must say that the sample app didn’t do the OCR. I had to change the click event for that button to this. But that was a minor thing.
Private Sub btOCR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btOCR.Click
MsgBox(PdfViewer1.OCRCurrentPage)
End Sub
Over all it works great and fast and easy.
Just place the viewer control on your form. Add a browsebutton and do this in click event of that button.
vbnet
PdfViewer1.SelectFile()
And that’s it. Just works.
Conclusion
When I was looking for a solution for showing my pdf files in an easy and fast way I never came across pdfviewernet, but now I’m happy I bitched about acrobat reader activex on twitter.
I love it already. I just wish it was on nuget. Many thanks to Jeremiah Peschka, Mladen Prajdic, Rob Sullivan and Mark S. Rasmussen. You guys and twitter in general are awesome.