Specifying margins in inches

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v6)  /  Re: Specifying margins in inches

DynamicPDF CoreSuite for .NET (v6) Forum

 Feb 06 2012 3:55 PM
Hi,

I need to set the top and bottom margins of the page to 1 inch and the left and right to .75 inch. The Coordinate System help says that 72 points = 1 inch. My page size is A4 and the orientation is portrait. So if I set the top and bottom to 72 and the left and right to 54 I should get the right margins? But when I print the pdf, I see that top and bottom are 1.5 inch and the left and right 1.2 inches.
 Feb 06 2012 4:59 PM
Posted by a ceTe Software moderator
Hello,

Below is the code to create an A4 portrait document as per you requirements.

            Document document = new Document();

            PageDimensions dimensions = new PageDimensions(PageSize.A4, PageOrientation.Portrait);
            dimensions.BottomMargin = 72;
            dimensions.TopMargin = 72;
            dimensions.LeftMargin = 54;
            dimensions.RightMargin = 54;
           
            Page page = new Page(dimensions);            
            document.Pages.Add(page);
            document.Draw("test.pdf");

When you print the document using a PDF Viewer, please make sure to select the “Actual Size” and “Choose paper source by PDF page size” to print the page with the actual dimensions. If you continue experiencing this issue even after you are printing the PDF with actual dimensions, please send over the PDF file and the code used to create the file to support@cete.com so we can look into it further.

Thanks,
ceTe Software Support Team.
 Feb 06 2012 6:12 PM
I still have some problems. Have sent the code and pdf file in an email to support@cete.com

thanks,

shabnam
 Feb 07 2012 11:13 AM
Posted by a ceTe Software moderator
Hello  Shabnam,

We did some testing on our end and we are able to print the PDF document with correct page margins on paper having A4 size. There is nothing in our Generator API which is causing this behavior.

You are seeing this behavior on your end because you are selecting 8.5 by 11 paper size and these dimensions are for Letter page size. Please refer the documentation on different page sizes and their dimensions at: http://msdn.microsoft.com/en-us/library/dd319099%28VS.85%29.aspx.

Please try setting the correct page size in your printer settings so that the document prints with A4 page dimensions. This will work for you.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 1:22 AM.