How to export pdf page as a image using pdfsharp .net library ?
- by vi.su.
How to export a pdf page as an image using pdfsharp .net library, for pixel level manipulation ?
for example, something like, System.Drawing.BitMap.GetPixel()
I am trying to find out empty area (all white, or of any colour) inside a pdf document, to write some graphics / image.
09, June 2010:
I have tried this, but it is not working.
why the following code is not working as expected ?
Bitmap.GetPixel always returns 0.
//
// PdfSharp.Pdf.PdfDocument
// PdfSharp.Pdf.PdfPage
// PdfSharp.Drawing.XGraphics
// System.Drawing.Bitmap
//
string srcPDF = @"C:\hcr\test\tmp\file1.pdf";
PdfDocument pdfd = PdfReader.Open(srcPDF);
XGraphics xgfx = XGraphics.FromPdfPage(pdfd.Pages[0]);
Bitmap b = new Bitmap((int) pdfp.Width.Point, (int) pdfp.Height.Point, xgfx.Graphics);
int rgb = b.GetPixel(0, 0).ToArgb();