彩票走势图

使用Aspose.PDF更改PDF文件的内容

原创|其它|编辑:郝浩|2012-11-06 16:24:03.000|阅读 2412 次

概述:Aspose.Pdf中含有一个PdfFileEditor类的ResizeContents方法,可以允许您调整PDF文件中的页面内容。

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

Aspose.Pdf中含有一个PdfFileEditor类的ResizeContents方法,可以允许您调整PDF文件中的页面内容。ContentsResizeParameters类用于指定要使用的参数来调整这个页面。你可以使用ResizeContents方法调整所有的页面或者一个页面的特定内容。

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")


标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@pclwef.cn

文章转载自:慧都控件网

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP