Free Support Forum -

Converting PDF pages to image formats in Mono

I’m having problems converting a PDF page to an image format (I’ve tried JPG, PNG, GIF and BMP). The procedure works well in Windows.NET, but when running in Mono.NET under Mac I am encountering problems.

My first problem was an OutOfMemoryException. After having changed it to a smaller image I strangely received an error in the String class:

Exception (ArgumentOutOfRangeException): Cannot be negative.

Parameter name: length

--------STACK TRACE-------

at System.String.Substring (Int32 startIndex, Int32 length) [0x00007] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System/String.cs:331

at .‡.ƒ () [0x00000] in :0

at .‡.€ () [0x00000] in :0

at .‡.€ () [0x00000] in :0

at ..€ () [0x00000] in :0

(Those 0x0 addresses look worrying).

Has anyone had success running this under Mono. Certainly could be an issue in the latest Mono engine, so I’ll go and download the source and see what’s up - but figured I’d see if anyone has had success with this on this forum.

For reference, here’s a code snippet that will demonstrate the problem:

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(localPath);

context.Response.ContentType = “image/jpeg”;

int width = 85;

int height = 110;

int sizefactor = 6;

Aspose.Pdf.Devices.JpegDevice jpg = new Aspose.Pdf.Devices.JpegDevice(width * sizefactor, height * sizefactor);

jpg.Process(pdfDocument.Pages [1], context.Response.OutputStream);

Hi Martyn,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the details.

To test your reported issue, we will setup a similar environment and check the issue. Please be patient and spare us some time to setup the environment and test the issue. We will share our test results soon.

Sorry for the inconvenience,