BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
//Initialize PDF document.
PdfDocument doc = new PdfDocument();
//Add pages to the PDF document.
PdfPage page = doc.Pages.Add();
//Initialize PdfUnitConverter.
PdfUnitConvertor converter = new PdfUnitConvertor();
//Convert Millemeter to Point
float x = converter.ConvertUnits(54, PdfGraphicsUnit.Millimeter, PdfGraphicsUnit.Point);
float y = converter.ConvertUnits(11, PdfGraphicsUnit.Millimeter, PdfGraphicsUnit.Point);
//Font size.
float fontSize = converter.ConvertUnits(12f, PdfGraphicsUnit.Millimeter, PdfGraphicsUnit.Point);
//Create PdfFont.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, fontSize, PdfFontStyle.Regular);
page.Graphics.DrawString("Hello World", font, PdfBrushes.Black, new PointF(x,y));
//Initialize memorystream
MemoryStream ms = new MemoryStream();
//Save the document to stream
doc.Save(ms);
|