Having an issue using TextStamp with Courier font pt. 12. Any underscore in the text doesn’t print because the rendering box for the text doesn’t have enough height. If I edit the PDF to give more height to the Text element I can make the underscores appear. Code is below:
static void Main(string[] args)
{
// Open document
Document pdfDocument = new Document("");
//Draw text in private method
DrawText(“FLOOR AMENDMENT NO.____”, pdfDocument.Pages[1], 0.10732387f, 0.7249726f, “Courier”, false, 12f);
// Save output document
pdfDocument.Save(“C:\AddTextStamp_out.pdf”);
}
private static void DrawText(string text, Page page, float x, float y, string fontName, bool isUnderlined, float fontSize)
{
TextStamp stamp = new TextStamp(text);
// Specify font name for Stamp object
stamp.TextState.Font = FontRepository.FindFont(fontName);
// Specify Font size for TextStamp
stamp.TextState.FontSize = fontSize;
stamp.TextState.Underline = isUnderlined;
// Set the XIndent for Stamp
stamp.XIndent = x * page.CropBox.Width;
// Set the YIndent for Stamp
stamp.YIndent = y * page.CropBox.Height;
// Add textual stamp to page instance
page.AddStamp(stamp);
}
Seems to be an issue with any PDF used.