Open JorgelGtzGtz opened 5 years ago
@JorgelGtzGtz I know this is old. But why even check for the orientation change on the page if you're just going to execute the exact same code, with the exact same values in the variables?
@ThomasHoevel You may want to mark this issue as closed.
Hello I try to put text in Landscape page in the bottom, but not work. I attach example and I mark with yellow without text where is the correct position to put the text.
This is my code : public static bool PdfSharpStampPdf(string[] files, string textStamp, out string message) { bool result = false; message = string.Empty; try { foreach (var file in files) { // Open the document using (PdfDocument inputDocument = PdfReader.Open(file, PdfDocumentOpenMode.Import)) { PdfDocument PDFNewDoc = new PdfDocument(); // Iterate pages foreach (PdfPage page in inputDocument.Pages) { PdfPage pp = PDFNewDoc.AddPage(page); string stampText = Path.GetFileNameWithoutExtension(file) + " " + textStamp; XGraphics gfx = XGraphics.FromPdfPage(pp); XRect rect = new XRect(); if (page.Orientation == PdfSharp.PageOrientation.Landscape) { rect.X = 0; rect.Y = 0; rect.Width = pp.Width; rect.Height = pp.Height; } else { rect.X = 0; rect.Y = 0; rect.Width = pp.Width; rect.Height = pp.Height; }