gpt4 book ai didi

c# - PDFsharp自动换行

转载 作者:太空狗 更新时间:2023-10-29 17:41:56 31 4
gpt4 key购买 nike

如何使用 PDFsharp 在矩形内包裹文本?

在我的尝试中,文本仍然超出了 PDF 的页面。这是尝试过的:

rect = new XRect(20, 300, 400, 100);
tf.Alignment = XParagraphAlignment.Left;
gfx.DrawString("\t • Please call the borrower prior to closing and confirm your arrival time and the closing location. \n", font, XBrushes.Black, rect, XStringFormats.TopLeft);
rect = new XRect(20, 320, 100, 100);
gfx.DrawString("\t • If the borrower needs to change the closing appointment time or date for any reason please have them call McDonnell Law Firm at 866-931-8793 \n", font, XBrushes.Black, rect, XStringFormats.TopLeft);
rect = new XRect(20, 340, 100, 100);
gfx.DrawString("\t • Completed documents must be received same day. Fax back to 888-612-4912 or email ClosingDocs@appliedtechres.com \n", font, XBrushes.Black, rect, XStringFormats.TopLeft);
rect = new XRect(20, 360, 100, 100);
gfx.DrawString("\t • Documents are to be returned via Fedex or UPS with shipping label provided. Documents must be dropped same day. \n", font, XBrushes.Black, rect, XStringFormats.TopLeft);

这就是它正在做的> enter image description here

最佳答案

根据您的代码片段,我假设 tf 是 XTextFormatter 类的一个对象,而 gfx 是一个 XGraphics 对象。

XGraphics.DrawString 不支持换行。

XTextFormatter.DrawString 支持换行。

您的代码中的错误:您在本应调用 tf.DrawString 的地方调用了 gfx.DrawString

关于c# - PDFsharp自动换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22724607/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com