Hi. I am trying to convert a pdf page into a png file.
Only the first trial after launching the project is different.
For example, the first outcome is 1,182KB after then always 1,199KB.
I suspect memory leaks because it works fine only the first or second time after I re-launch the project.
I am sharing a code snippet. It is .net framework, c#.
using (Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(strFilePath))
{
Aspose.Pdf.PageCollection pageCollection = pdfDocument.Pages;
Aspose.Pdf.Page pdfPage = pageCollection[selectedPage];
using (MemoryStream imageStream = new MemoryStream())
{
int quality = GetResulutionValueByProject(projectInfo);
Resolution resolution = new Resolution(quality);
PngDevice pngDevice = new PngDevice(resolution);
pngDevice.Process(pdfPage, imageStream);
using (Bitmap img = new Bitmap(imageStream))
{
//Console.WriteLine(string.Format("rectHeight : {0} rectWidth{1}", rect.Height, rect.Width));
Console.WriteLine(string.Format("imageHeight : {0} imageWidth{1}", img.Height, img.Width));
img.Save(strOutFilePath);
You may be available duplicating the same problem if you convert the same file in a loop.
If you need further information, Please let me know.