Error large file / high dpi

Error large file / high dpi

Forum member · Oct 8, 2011
Hi, I'm testing the Rasterizer component, when using a to high dpi setting I get an Error when using a specific file: ceTe.DynamicPDF.Rasterizer.PdfRasterizerException {"Error while creating image.This may be due to unsupported image size or image resolution."} This is indeed a very large pdf file. Is there a way to know your limit? I want to try using the best dpi setting without getting an error. Regards, PL

Re: Error large file / high dpi

Support · Oct 10, 2011
Hello PL, Yes, the DynamicPDF Rasterizer for .NET product API throws exception when the resolution and the file size huge. It is not possible to know the exact limit using our DynamicPDF Rasterizer for .NET and you will have to set the ImageSize and resolution to the image. You can set the image size using ImageSize enumerator while drawing the image. Below is the sample code for it. InputPdf pdf = new InputPdf(@"F:\temporary\Rasterizer\Test.pdf"); PdfRasterizer rasterizer = new PdfRasterizer(pdf); rasterizer.Draw(@"F:\temporary\Rasterizer\testImage.jpg", ImageFormat.Jpeg, ImageSize.Dpi96); You can also use the FixedImageSize class to set the image size. Below is the sample code for it. InputPdf pdf = new InputPdf(@"F:\temporary\Rasterizer\Test.pdf"); PdfRasterizer rasterizer = new PdfRasterizer(pdf); FixedImageSize imageSize = new FixedImageSize(5000, 5000, 300, 300, UnitType.Point); rasterizer.Draw(@"F:\temporary\Rasterizer\testImage.jpg", ImageFormat.Jpeg, imageSize); If you continue getting the error then please send over the input PDF document and the sample code which you are using to our support team at: [^a|mailto:support@cete.com|opennewiwndow|support@cete.com^] so that they can look into it further. Thanks, ceTe Software Support Team.

Re: Error large file / high dpi

Forum member · Oct 10, 2011
Hi, Thanks for your answer. Is it possible to retrieve the papersize of the pdf (in mm or inch), before drawing the page to an image or memorystream? Regards, PL

Re: Error large file / high dpi

Support · Oct 10, 2011
Hello PL, Yes, you can retrieve the page height and width of the input PDF document. You will need to use the Height and Width properties of the InputPdf class to do this. The retrieved values will be in points. Please refer the documentation on coordinate system which our DynamicPDF API uses at: http://www.DynamicPDF.com/Support/NET_Help_Library_11_01/Coordinate%20System.html . Below is the sample code for it. InputPdf pdf = new InputPdf(@"F:\temporary\Test.pdf"); float ht = pdf.Pages[0].Height; float width = pdf.Pages[0].Width; Thanks, ceTe Software Support Team.