Detecting page dimensions/orientation prior to rasterization

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Rasterizer for .NET (v2)  /  Detecting page dimensions/orientation prior to rasterization

DynamicPDF Rasterizer for .NET (v2) Forum

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?
Posted by a ceTe Software moderator
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.

All times are US Eastern Standard time. The time now is 12:10 AM.