Closed justinmchase closed 1 year ago
See FAQ No. 3: http://pdfsharp.net/wiki/PDFsharpFAQ.ashx#Can_PDFsharp_show_PDF_files_Print_PDF_files_Create_images_from_PDF_files_3
It'll take some effort on your side to render PDF using the XGraphics class. But this would be an interesting extension.
Ok so I see this sample: http://pdfsharp.net/wiki/Preview-sample.ashx
But it's not clear to me how it's being previewed based on that sample code. The sample seems incomplete, the creation of the XGraphics instance is not included for example, and I can't seem to find a full version in the code base.
It says in the code in the example:
"• draw in a bitmap image"
This is what I want I think, but how can I do this? I don't see the API that would allow it.
The complete source code can be found on - surprise, surprise - GitHub: https://github.com/empira/PDFsharp-samples/tree/master/samples/gdi/GraphicsPreview
XGraphics can draw on PDF pages and on any DC, including DCs for printers and bitmaps.
You see a red X on the preview window because PDFs are not rendered there. The PDF shows in the Adobe Reader screen shot.
Suppose I load a PDF using PDFsharp, how can I then render the entire document as a Tiff, or alternately render each page as an image and save to disk?
If I had each page as an image I could figure out how to build a tiff from those images, but I'm struggling to see how to use the XGraphics api to render a page to an image. All the examples I've seen so far do the reverse of rendering an image into the page.
Any help would be greatly appreciated, thanks.