Hello,
I'm trying to split my pdf page and convert each page into an image. However I only get a black empty image every time. Below is the code I was trying out.
Code:
PdfDocument inputDocument = PdfReader.Open(filename, PdfDocumentOpenMode.Modify);
var page = inputDocument.Pages[0];
XGraphics gfx = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Replace);
//var state = gfx.Save();
//gfx.Restore(state);
Image image = new Bitmap((int)gfx.Graphics.VisibleClipBounds.Width, (int)gfx.Graphics.VisibleClipBounds.Height, gfx.Graphics);
image.Save("image.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
The commented 2 lines, I was not sure if I needed it. Any suggestions on how I can get this working would be great.
Thanks and appreciate a quick response.