Detecting page dimensions/orientation prior to rasterization

Detecting page dimensions/orientation prior to rasterization

Forum member · May 19, 2017
I am using DynamicPDF Rasterizer for .NET to rasterize PDF files to TIFF format, and using the MaxImageSize class to limit the size to a 8.5 inches wide and 14 inches tall (standard legal size paper) at 300 dpi. I want to be able to detect the dimensions to determine the orientation of each page in the PDF prior to converting so that I can switch the width/height values, but I do not see a property or method to get the dimensions or orientation in the PdfRasterizerPage class. What is your recommended approach to determining the PDF page dimensions prior to rasterizing?

Re: Detecting page dimensions/orientation prior to rasterization

Support · May 19, 2017
Hello, Here is the sample code that shows how to retrieve the height and width of a PDF page. InputPdf doc = new InputPdf("Input.pdf"); PdfRasterizer rast = new PdfRasterizer(doc); //Get the height and width of the page. float width = (float)doc.Pages[0].Width; float height = (float)doc.Pages[0].Height; rast.Draw("documentd.tiff", ImageFormat.TiffWithLzw, DpiImageSize.Dpi300); Thanks, ceTe Software Support Team.