Free Support Forum - aspose.com

Text is cut off using AddText

I just recently updated to Aspose.Pdf.Kit 5.9.0.0 from a version about two years ago.

My AddText is cutting off the top of the text when adding to the pdf.

See attachments. 23.pdf is the document I am inserting text into. sample_output.pdf shows the text cut off.

Here is my code:

string sLicense = @"c:\program files\cooper power systems\eagle admin install\Aspose.Total.lic";

string sFileNameIN = @"c:\pdf_kit_test\23.pdf";

string sFilenameOUT = @"c:\pdf_kit_test\sample_output.pdf";

string sValueIn = "Customer: Cooper Power Systems";

Aspose.Pdf.Kit.License license = new Aspose.Pdf.Kit.License();

license.SetLicense(sLicense);

PdfPageEditor pe = new PdfPageEditor();

pe.BindPdf(sFileNameIN);

pe.Rotation = 270;

pe.Save(sFileNameIN + "2");

PdfFileInfo fileInfo = new PdfFileInfo(sFileNameIN + "2");

float height = fileInfo.GetPageHeight(1);

float width = fileInfo.GetPageWidth(1);

PdfFileMend mendor = new PdfFileMend(sFileNameIN + "2", sFilenameOUT);

int iFontSize = 6;

int iWidth = 450;

int iHeight = 46;

FormattedText txtInsert = new FormattedText(sValueIn, new FontColor(0, 0, 0), Aspose.Pdf.Kit.FontStyle.Helvetica, EncodingType.Winansi, false, iFontSize);

mendor.AddText(txtInsert, 1, iWidth, height - iHeight, width, height);

mendor.Close();

Hi Scott,

I have tested this issue at my end using merged Aspose.Pdf for .NET and it worked fine; the text is not cut off in this case. I would also like to share with you that Aspose.Pdf.Kit for .NET will be discontinued from October 2011. We have merged this component with Aspose.Pdf for .NET. You can use Aspose.Pdf for .NET 6.2.0 to test this issue. You can use Aspose.Pdf.Facades namespace instead of Aspose.Pdf.Kit namespace.

Please try it at your end. If you find any question or concerns, please do let us know.
Regards,

Very strange. I reverted back to aspose.pdf.kit from 2009 and everything is working fine. In the future I will eliminate/convert the pdf.kit code to pdf.

Hi Scott,

I’m glad to know that the issue is resolved at your end. However, I would recommend you to upgrade to the merged version as soon as time allows, because we’ll be providing any further fixes and features in this merged version only.

If you find any further questions, please do let us know.
Regards,