I have a word document with margins setup as needed.
On creation of PDF the left margin increases.
The entire content moves right by few points.
As in the image, evaluation warning is the start of left margin, the content is not aligned at center along with page number.
Here is the code,
- Code: Select all
{
//Create a pdf document.
PdfPageBase page1 = docToPdf.Pages[0];
PdfDocument pdfDoc = new PdfDocument();
PdfMargins defaultMargins = new PdfMargins(0, 0, 0, 40);
PdfPageBase firstPage = pdfDoc.Pages.Add(PdfPageSize.A4, defaultMargins);
firstPage.Canvas.DrawTemplate(page1.CreateTemplate(), new PointF(0, 0));
return pdfDoc;
}
The docToPdf is a PdfDocument, it has same margins as the word doc.
On creation of "firstPage" using Canvas, the result is as shown in the image.
Please let me know where the issue is.