Free Support Forum - aspose.com

Two problems with document to PNG conversion

Hi,

I have two problems with PDF files:

1. The converting of “Deutsche Telekom.pdf” was generally corrected, but it seems like the line height were’nt calculated correctly, resulting in overwritten text on the bottom of the generated picture. I had similar problem by using the System.Drawing.Graphics.DrawString as I converted some text files (outside Aspose libraries) to images. If I’d chosen a wrong line height - it resulted in overwritten text. The original document and the resulting image can be found in the attached archive.

2. During the converting of “WIKIMEDIUM-04-2010.pdf” I’d got an “Out of memory error”. Of course no correct image was generated. After some investigations, it seems like a memory leak in the image devices ( I tried PngDevice, JpegDevice and BmpDevice - same results).
Here is the code I used for creating a PNG from PDF:

try
{
pdfDoc = new Aspose.Pdf.Document(this.fileStream);
}
catch (OutOfMemoryException outOfMem)
{
Console.WriteLine("Error by loading the PDF stream: " + outOfMem.Message);
}

PdfPageEditor pEdit = new PdfPageEditor();
pEdit.BindPdf(this.fileStream);
PageSize size = pEdit.GetPageSize(1);

double scale = (double)this.ImageWidth / (double)size.Width;
double height = System.Convert.ToDouble(size.Height);
int imageheight = System.Convert.ToInt32(height * scale);

FileStream image = new FileStream(this.savefile, FileMode.Create);

try
{
PngDevice pngDevice = new PngDevice(this.imageWidth, imageheight, new Aspose.Pdf.Devices.Resolution(73));
pdfDoc.Pages[1].SendTo(pngDevice, image);
}
catch (OutOfMemoryException outOfMem)
{
Console.WriteLine("Memory allocation error by creating a PNG using PNGDevice: " + outOfMem.Message);
Environment.Exit(-1);
}

The PDF file (WIKIMEDIUM-04-2010.pdf) and the empty generated picture can be find also in the attachment.

I’m using the newest available Aspose.Pdf DLL (version 7.4.0.0)

Greetings,
Lucas

Binserv:
1. The converting of “Deutsche Telekom.pdf” was generally corrected, but it seems like the line height were’nt calculated correctly, resulting in overwritten text on the bottom of the generated picture. I had similar problem by using the System.Drawing.Graphics.DrawString as I converted some text files (outside Aspose libraries) to images. If I’d chosen a wrong line height - it resulted in overwritten text. The original document and the resulting image can be found in the attached archive.

Hi Lucas,

Thanks for contacting support.

I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-34461. We
will investigate this issue in details and will keep you updated on the status
of a correction.

Binserv:
2. During the converting of “WIKIMEDIUM-04-2010.pdf” I’d got an “Out of memory error”. Of course no correct image was generated. After some investigations, it seems like a memory leak in the image devices ( I tried PngDevice, JpegDevice and BmpDevice - same results).

I have separately logged this issue as PDFNEWNET-34462 in our issue tracking system. Once these problems are resolved, we would be more than happy to update you with the status of correction. Please be patient and spare us little time.

We are sorry for your inconvenience.

The issues you have found earlier (filed as PDFNEWNET-34462) have been fixed in Aspose.Pdf for .NET 7.6.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as PDFNEWNET-34461) have been fixed in Aspose.Pdf for .NET 7.7.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.