Aspose.Pdf for .NET文档处理控件发布了新的11.7版本

作者:控件中国网   出处:控件中国网   2016-07-04 11:01:04   阅读:8

ASPOSE公司对旗下产品Aspose.Pdf for .NET控件又发布了新的11.7版本,为了满足广大客户的需求,该PDF文档处理和转换控件在持续的更新和增强,下面就来看下这次更新的主要内容:
1、由于一个PDF文档很有可能包含了不同的数据层,新版本支持在转换PDF为HTML时呈现PDF文档层
// Open the PDF file
Document doc = new Document(“input.pdf”);
// Instantiate HTML SaveOptions object
HtmlSaveOptions htmlOptions = new HtmlSaveOptions();
// Specify to render PDF document layers separately in output HTML
htmlOptions.ConvertMarkedContentToLayers = true;
// Save the document
doc.Save(“output.html”, htmlOptions);
2、为ColumnAdjustment枚举新增了一个AutoFitToWindows值,用于调整表格列先自适应窗口
//Instntiate the Pdf object by calling its empty constructor
Document doc = new Document();
//Create the section in the Pdf object
Page sec1 = doc.Pages.Add();
//Instantiate a table object
Aspose.Pdf.Table tab1 = new Aspose.Pdf.Table();
//Add the table in paragraphs collection of the desired section
sec1.Paragraphs.Add(tab1);
//Set with column widths of the table
tab1.ColumnWidths = “50 50 50″;
tab1.ColumnAdjustment = ColumnAdjustment.AutoFitToWindow;
//Set default cell border using BorderInfo object
tab1.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.1F);
//Set table border using another customized BorderInfo object
tab1.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 1F);
//Create MarginInfo object and set its left, bottom, right and top margins
Aspose.Pdf.MarginInfo margin = new Aspose.Pdf.MarginInfo();
margin.Top = 5f;
margin.Left = 5f;
margin.Right = 5f;
margin.Bottom = 5f;
//Set the default cell padding to the MarginInfo object
tab1.DefaultCellPadding = margin;
//Create rows in the table and then cells in the rows
Aspose.Pdf.Row row1 = tab1.Rows.Add();
row1.Cells.Add(“col1″);
row1.Cells.Add(“col2″);
row1.Cells.Add(“col3″);
Aspose.Pdf.Row row2 = tab1.Rows.Add();
row2.Cells.Add(“item1″);
row2.Cells.Add(“item2″);
row2.Cells.Add(“item3″);
//Save the Pdf
doc.Save(“ResultantFile.pdf”);
3.支持使用虚线创建图形对象,在为PDF文档添加对象时很多时候客户需要是用虚线来绘制图形,那么新发布的Aspose.Pdf 11.7为开发人员提供了该功能
// instantiate Document instance
Document doc = new Document();
// add page to pages collection of Document object
Page page = doc.Pages.Add();
// create Drawing object with certain dimensions
Aspose.Pdf.Drawing.Graph canvas = new Aspose.Pdf.Drawing.Graph(100, 400);
// add drawing object to paragraphs collection of page instance
page.Paragraphs.Add(canvas);
// create Line object
Aspose.Pdf.Drawing.Line line = new Aspose.Pdf.Drawing.Line(new float[] { 100, 100, 200, 100 });
// set color for Line object
line.GraphInfo.Color = Aspose.Pdf.Color.Red;
// specify dash array for line object
line.GraphInfo.DashArray = new int[] { 0, 1, 0 };
// set the dash phase for Line instance
line.GraphInfo.DashPhase = 1;
// add line to shapes collection of drawing object
canvas.Shapes.Add(line);
// save PDF document
doc.Save(“DashLineInBlack.pdf”);
4.增强了XPS转换为PDF时的性能
5.增强了插入PDF文件的图片质量
Copyright© 2006-2015 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 渝ICP备12000264号 法律顾问:元炳律师事务所
客服软件
live chat