But when we have a document which is normally in landscape mode and we add a page to the start of the document, it has been reported that it is printing out in portrait mode.
What is the correct way to load an existing pdf into a new instance of the document for manipulation following code has been extracted from the program;
- Code: Select all
PdfDocument documentDrawing = new PdfDocument();
PdfDocument origionalDrawing = new PdfDocument();
origionalDrawing.LoadFromFile(Properties.Settings.Default.WOPrintDrawings + PartNo + ".pdf");
PdfPageBase documentDrawingPage = documentDrawing.Pages.Insert(1, origionalDrawing.Pages[0].Size);
documentDrawing.InsertPage(origionalDrawing, 0);
documentWorksOrder.InsertPage(origionalWorksOrder, 0);
PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
PdfStringFormat format = new PdfStringFormat(PdfTextAlignment.Left);
PdfFont font = new PdfFont(PdfFontFamily.Helvetica, 13f);
PdfGraphicsState state = documentDrawingPage.Canvas.Save();
string datastring = @"Stock No : " + PartNo + @" Account No : " + AccountNo + @" Works Order No : " + WOrderNo;
SizeF size = font.MeasureString(datastring, format);
documentDrawingPage.Canvas.DrawString(Properties.Settings.Default.WOrderSpindleDrawing, font, brush, 55, 0, format);
documentDrawingPage.Canvas.DrawString(datastring, font, brush, 55, 20, format);
documentDrawingPage.Canvas.Restore(state);
documentDrawing.SaveToFile(Properties.Settings.Default.WOWorkingFolder + out2);
Thanks in advance