Specifying margins in inches

Specifying margins in inches

Forum member · Feb 6, 2012
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.

Re: Specifying margins in inches

Support · Feb 6, 2012
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 [^a|mailto:support@cete.com|opennewwindow|support@cete.com^] so we can look into it further. Thanks, ceTe Software Support Team.

Re: Specifying margins in inches

Forum member · Feb 6, 2012
I still have some problems. Have sent the code and pdf file in an email to support@cete.com thanks, shabnam

Re: Specifying margins in inches

Support · Feb 7, 2012
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.