Skip to content

Commit

Permalink
Merge pull request #378 from diegodrf/fix/code-example
Browse files Browse the repository at this point in the history
Fix code example
  • Loading branch information
ststeiger authored Aug 26, 2023
2 parents 2d31ef5 + 8f9ab97 commit 1441e0d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/PdfSharpCore/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,17 @@ 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:
// And you'll create an alignment to your text
XStringFormat stringFormat = new XStringFormat
{
Alignment = XStringAlignment.Center
};

// And you use that font and alignment to draw a string:
gfx.DrawString(
"Hello, World!", font, XBrushes.Black,
new XRect(0, 0, page.Width, page.Height),
XStringFormat.Center);
stringFormat);

// When drawing is done, write the file:
string filename = "HelloWorld.pdf";
Expand Down

0 comments on commit 1441e0d

Please sign in to comment.