I’m trying to addtext (7 lines) to the lower right corner of an existing pdf (portrait A4). However, I can’t get the text positioned to the lower right corner. Do you have a some simpe example code?
Hi,
Thank you for considering Aspose.
Please check the following link and the code:
http://www.aspose.com/Wiki/default.aspx/Aspose.Pdf.Kit/AdhereText.html
[C#]
string inputFile = @“E:\AsposeTest\BACKFLOW.pdf”; ;
string outputFile = @“E:\AsposeTest\BACKFLOWFileMend.pdf”; ;
//Instantiate PdfFileInfo object
PdfFileInfo fileInfo = new PdfFileInfo(@inputFile);
//Call GetPageHeight, GetPageWidth and GetPageRotation methods to get height, width and rotation of the page
float height = fileInfo.GetPageHeight(1);
float width = fileInfo.GetPageWidth(1);
//Instantiate PdfFileMend object
PdfFileMend mendor = new PdfFileMend(@inputFile, @outputFile);
//Instantiate an object of FormattedText class
FormattedText fTxt = new FormattedText(“PdfFileMend testing! 0 rotation. Line 0”, new FontColor(0, 200, 0), FontStyle.TimesRoman, EncodingType.Winansi, false, 12);
fTxt.AddNewLineText(“PdfFileMend testing! 0 rotation. Line 1”);
fTxt.AddNewLineText(“PdfFileMend testing! 0 rotation. Line 2”);
fTxt.AddNewLineText(“PdfFileMend testing! 0 rotation. Line 3”);
fTxt.AddNewLineText(“PdfFileMend testing! 0 rotation. Line 4”);
fTxt.AddNewLineText(“PdfFileMend testing! 0 rotation. Line 5”);
fTxt.AddNewLineText(“PdfFileMend testing! 0 rotation. Line 6”);
fTxt.AddNewLineText(“PdfFileMend testing! 0 rotation. Line 7”);
mendor.AddText(fTxt, 1, width-200, 100, width-10, 10);
//Close PdfFileMendor object
mendor.Close();
Hope it helps.
Thanks.