使用Aspose.PDF更改PDF文件的内容
2012-11-06 16:26
726 查看
来源:慧都控件网 http://www.evget.com/zh-CN/Info/catalog/18035.html
Aspose.Pdf中含有一个PdfFileEditor类的ResizeContents方法,可以允许您调整PDF文件中的页面内容。ContentsResizeParameters类用于指定要使用的参数来调整这个页面。你可以使用ResizeContents方法调整所有的页面或者一个页面的特定内容。
C#
[b]VB.NET[/b]
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");
[b]VB.NET[/b]
'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")
相关文章推荐
- 使用Aspose.Pdf在PDF文件中添加附件
- 使用Aspose.Cells将工作表保存为不同的PDF文件
- 使用xpdf读取PDF文件内容
- 使用Aspose.Pdf删除PDF文件中的图片
- 使用Aspose.Pdf从PDF文件中获取个别的附件
- android使用ant自动打包(包括更改文件中的内容)
- 使用iText7----生成纯文本、图片、表格内容的pdf文件
- 使用Aspose.Pdf从PDF文件中获取注释
- Android使用iText生成pdf文件并读取pdf内容
- 修改pdf文件内容可以使用什么编辑工具
- 使用Aspose.word生成.pdf和.doc(word)报告文件
- 使用Aspose.Pdf将PDF文件转换成TeX格式
- 使用Aspose.Pdf在PDF文件中添加表格字段
- 使用Aspose.Pdf删除PDF文件中的指定表格字段
- 使用Aspose.Pdf修改PDF文件中的表格字段
- 使用Aspose.Pdf从PDF文件中获取注释
- JAVA 使用Aspose.Words组件生产Word或PDF文件
- android使用ant自动打包(包括更改文件中的内容)
- 使用Aspose.Pdf在PDF文件中添加图片
- 使用Aspose.Pdf获取PDF文件中的所有附件