簡體   English   中英

如何使用syncfusion pdf獲取剩余頁面大小

[英]How to get the remaining page size using syncfusion pdf

我正在使用xamarin形式的synfusion pdf插件創建pdf,如果我打印pdf會發生什么,那么頁面上會有很多剩余空間,因此我如何使用syncfusion pdf來獲取pdf頁面的剩余空間 請查看此屏幕截圖,紅色框中的區域仍然是我如何獲得該區域

我們可以使用PdfLayoutResult來獲取PDF文檔頁面中的空白區域。 請參考下面的代碼片段以獲取更多詳細信息,

C#:

//Create a text element with the text and font
PdfTextElement textElement = new PdfTextElement(text, font);
PdfLayoutFormat layoutFormat = new PdfLayoutFormat();
layoutFormat.Layout = PdfLayoutType.Paginate;

//Draw the paragraph
PdfLayoutResult result = textElement.Draw(page, new RectangleF(0, 0, 
page.GetClientSize().Width, page.GetClientSize().Height), layoutFormat);

//Get the blank space of PDF using PdfLayoutResult and page height 
float blankSpaceHeight = page.GetClientSize().Height - result.Bounds.Bottom;

我們已經為該示例創建了示例,可以從以下鏈接下載該示例,

樣本以獲取PDF文檔的剩余頁面大小

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM