原創(chuàng)|其它|編輯:郝浩|2012-11-06 16:24:03.000|閱讀 2445 次
概述:Aspose.Pdf中含有一個(gè)PdfFileEditor類的ResizeContents方法,可以允許您調(diào)整PDF文件中的頁面內(nèi)容。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Aspose.Pdf中含有一個(gè)PdfFileEditor類的ResizeContents方法,可以允許您調(diào)整PDF文件中的頁面內(nèi)容。ContentsResizeParameters類用于指定要使用的參數(shù)來調(diào)整這個(gè)頁面。你可以使用ResizeContents方法調(diào)整所有的頁面或者一個(gè)頁面的特定內(nèi)容。
C#
//Create PdfFileEditor Object PdfFileEditor fileEditor = new PdfFileEditor(); //Open PDF Document Document doc = new Document("input.pdf"); //Specify Parameter to be used for resizing PdfFileEditor.ContentsResizeParameters parameters = new PdfFileEditor.ContentsResizeParameters( //left margin = 10% of page width PdfFileEditor.ContentsResizeValue.Percents(10), //new contents width calculated automatically as width - left margin - right margin (100% - 10% - 10% = 80%) null, //right margin is 10% of page PdfFileEditor.ContentsResizeValue.Percents(10), //top margin = 10% of height PdfFileEditor.ContentsResizeValue.Percents(10), //new contents height is calculated automatically (similar to width) null, //bottom margin is 10% PdfFileEditor.ContentsResizeValue.Percents(10) ); //Resize Page Contents fileEditor.ResizeContents(doc, new int[] { 1, 2, 3 }, parameters); //save document into new location. doc.Save("output.pdf");
VB.NET
'Create PdfFileEditor Object Dim fileEditor As New PdfFileEditor() 'Open PDF Document Dim doc As New Document("input.pdf") 'Specify Parameter to be used for resizing 'left margin = 10% of page width 'new contents width calculated automatically as width - left margin - right margin (100% - 10% - 10% = 80%) 'right margin is 10% of page 'top margin = 10% of height 'new contents height is calculated automatically (similar to width) 'bottom margin is 10% Dim parameters As New PdfFileEditor.ContentsResizeParameters(PdfFileEditor.ContentsResizeValue.Percents(10), Nothing, PdfFileEditor.ContentsResizeValue.Percents(10), PdfFileEditor.ContentsResizeValue.Percents(10), Nothing, PdfFileEditor.ContentsResizeValue.Percents(10)) 'Resize Page Contents fileEditor.ResizeContents(doc, New Integer() { 1, 2, 3 }, parameters) 'save document into new location. doc.Save("output.pdf")
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都控件網(wǎng)