Render to Graphic Context

Hi Raphael,


Thanks for your patience.

We have further investigated the issue reported earlier as PDFNEWNET-38951 and in order to resolve this problem, please try using following code snippet. Please try using the latest release of Aspose.Pdf for .NET 11.0.0 and in the event of any further query, please feel free to contact.

[C#]

Document pdfDocument = new Document(@“c:\test.pdf”);<o:p></o:p>

for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)

{

string outputImageFile = TestSettings.GetInputFile("page-" + pageCount + ".png");

using (FileStream imageStream = new FileStream(outputImageFile, FileMode.Create))

{

//create Resolution object

Resolution resolution = new Resolution(300);

PngDevice pngDevice = new PngDevice(resolution); // or JpegDevice

//convert a particular page and save the image to stream

pngDevice.Process(pdfDocument.Pages[pageCount], imageStream);

using (System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(new Bitmap(imageStream)))

{

// Use graphics

}

//close stream

imageStream.Close();

}

}

Thanks but this is what i’m currently doing. It works but has quality issues. I need to output in a vector format.

My request is to render directly to Graphics context without creating a raster image first.

Best Regards,
Raphael

Hi Raphael,


Thanks for sharing the details.

Currently Aspose.Pdf renders the output using raster image format and it does not support generating output in Vector image format.