Below is an example concept how this can be done:
Code: Select all
private void AddTextString(Stream stream)
{
PdfDocument document = PdfDocumentController.OpenDocument(stream);
using (PdfGraphics g = PdfGraphics.FromPage(document.Pages[0]))
{
PdfFont font = PdfFont.CreateStandardFont(document, StandardFontType.TimesRoman);
PdfBrush brush = new PdfBrush(Color.Black);
// point coordinates should be specified in cartesian
// coordinates (X axis goes from left to right, Y axis goes from bottom to top)
g.DrawString("Test", font, 20, brush, new PointF(10, 20));
}
document.SaveChanges();
PdfDocumentController.CloseDocument(document);
}
...
AddTextString(stream);
imageViewer1.Add(stream);
...