The first example of PdfSharpCore at index doesn't work when copy and paste.
// You’ll first need a PDF document:
PdfDocument document = new PdfDocument();
// And you need a page:
PdfPage page = document.AddPage();
// Drawing is done with an XGraphics object:
XGraphics gfx = XGraphics.FromPdfPage(page);
// Then you'll create a font:
XFont font = new XFont("Verdana", 20, XFontStyle.Bold);
// And you use that font to draw a string:
gfx.DrawString(
"Hello, World!", font, XBrushes.Black,
new XRect(0, 0, page.Width, page.Height),
XStringFormat.Center);
// When drawing is done, write the file:
string filename = "HelloWorld.pdf";
document.Save(filename);
In the example XStringFormat calls Center, but it doesn't exist in the class.
The first example of PdfSharpCore at index doesn't work when copy and paste.
In the example
XStringFormat
callsCenter
, but it doesn't exist in the class.