我用MigraDoc创建PDF文档。 我为所有页面添加了一个完整大小的“标题”:
Image bg = section.Headers.FirstPage.AddImage(@"\\server\header.bmp"); bg.Height = "29.7cm"; bg.Width = "21cm"; bg.RelativeVertical = RelativeVertical.Page; bg.RelativeHorizontal = RelativeHorizontal.Page; bg.WrapFormat.Style = WrapStyle.Through;现在我想将文本框中的文本添加到该页面:
Paragraph paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "7.5cm"; paragraph.Format.SpaceAfter = "5"; paragraph.Format.Font.Color = Color.FromCmyk(100, 100, 100, 100); FormattedText ft = paragraph.AddFormattedText(this.gMailItem.Body);我遇到的问题是我添加的文本可能比一页更大。 如果发生这种情况,文本将打印在“全尺寸标题”/文具上。 有没有办法限制文档的高度(强制分页)?
编辑:这是我的问题的图片: http : //img4host.net/upload/1014244953be8611defa9.PNG
Im creating a PDF-Document with MigraDoc. I added a full size "Header" to all Pages:
Image bg = section.Headers.FirstPage.AddImage(@"\\server\header.bmp"); bg.Height = "29.7cm"; bg.Width = "21cm"; bg.RelativeVertical = RelativeVertical.Page; bg.RelativeHorizontal = RelativeHorizontal.Page; bg.WrapFormat.Style = WrapStyle.Through;Now i want to add Text from a Textbox to that Page:
Paragraph paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "7.5cm"; paragraph.Format.SpaceAfter = "5"; paragraph.Format.Font.Color = Color.FromCmyk(100, 100, 100, 100); FormattedText ft = paragraph.AddFormattedText(this.gMailItem.Body);The problem i have is that the text Im adding could be bigger than one page is. If this happens, the text is printed over the "full size header"/stationery. Is there a way to limit the height of a Document (to force a page break)?
EDIT: Here is a picture of my problem: http://img4host.net/upload/1014244953be8611defa9.PNG
最满意答案
文档的“客户区”由页面大小和边距(顶部,底部,左侧,右侧)定义,MigraDoc将在此区域已满时添加分页符。
我不完全明白问题是什么,但可能你必须增加上边距(而不是将SpaceBefore设置为7.5厘米 - SpaceBefore只在段落的开头工作,而TopMargin适用于每个新页面)。
编辑:另见: 发表于PDFsharp论坛
The "client area" of the document is defined by the page size and the margins (top, bottom, left, right) and MigraDoc will add page breaks when this area is full.
I do not fully understand what the problem is, but probably you have to increase the top margin (instead of setting SpaceBefore to 7.5 cm - SpaceBefore works only at the start of the paragraph while TopMargin works for each new page).
Edit: See also: Post in PDFsharp Forum
更多推荐
发布评论