OK, I'm going to go ahead and make this publicly available. I still haven't remembered completely how it works (I need to go back and review some code).
Here's what I remember (so this is the reader's digest version).
1) Derive the Web Form from ithPDFPage.ithPrintPageWithIText (that would mean “inherits ithPDFPage.ithPrintPageWithIText“ in VB.Net)
2) In the Page_Load event call the SetPdfPrintableControls with a list of ClientIDs to include (This is an paramarray in VB, so you do something like this: SetPdfPrintableControls(“Label1“, “Table1“, “Label3“)
3) When you want to render a PDF simply call “PDFMode()“ and it will render your page as a PDF. I know that I don't have all controls defined as of yet. It should work with Labels, Text boxes, tables, and datagrids.
Oh yeah here's the URL, http://workspaces.gotdotnet.com/ithPDFPage (source code only release). You'll also need ItextSharp which you can get here. It also uses SharpZip (but you don't need to go get it; I believe that ItextSharp ships with an old version... but if you want to build everything from scratch, so you can use the latest SharpZip...)
There's a test web site that doesn't work all the way yet in the workspace. When I recover everything I know about this project I'll post it here. There's also another component that can be used to handle user controls that you have created/
BTW, “Adventures in OOP” readers here's a decent example of why you might want to derive a base page class (also I think the implementation is fairly decent as well).
Print | posted on Thursday, July 01, 2004 10:35 AM