Ate*_*eeq 5 pdf pdfsharp cgpdfdocument
我想在pdf文档上逐行编写我的代码是在页面中心写文本我怎么能逐行写?
// Create a new PDF document
PdfDocument document = new PdfDocument();
document.Info.Title = "Created with PDFsharp";
// Create an empty page
PdfPage page = document.AddPage();
// Get an XGraphics object for drawing
XGraphics gfx = XGraphics.FromPdfPage(page);
// Create a font
XFont font = new XFont("Verdana", 20, XFontStyle.BoldItalic);
// Draw the text
gfx.DrawString("Hello, World!", font, XBrushes.Black,
new XRect(0, 0, page.Width, page.Height),
XStringFormats.TopCenter);
Run Code Online (Sandbox Code Playgroud)
随new XRect(0, 0, page.Width, page.Height)您指定将绘制文本的位置.
使用较小的矩形并逐行增加第二个值.
PDFsharp包括几个例子:
http://pdfsharp.net/wiki/PDFsharpSamples.ashx
特别检查文本布局.PDFsharp源包中包含的示例代码.
还可以查看MigraDoc,因为它会自动添加分页.
http://pdfsharp.net/wiki/MigraDocSamples.ashx
| 归档时间: |
|
| 查看次数: |
4115 次 |
| 最近记录: |