彩票走势图

Aspose.Pdf 9.7发布,涵盖120多项更新

原创|产品更新|编辑:龚雪|2014-10-27 09:36:13.000|阅读 400 次

概述:Aspose.Pdf 9.7发布,涵盖120多项更新

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

点此下载最新版本的Aspose.Pdf 9.7

Aspose.Pdf 9.7主要更新内容:

  • PDFNEWNET-35794 创建内部链接到附件上
  • PDFNEWNET-36519 Ximage保存方法忽略了分辨率参数
  • PDFNEWNET-37240 PDF to HTML - 设置生成的文件大小(大小)
  • PDFNEWNET-37398 支持PDF to PDF/A-2A转换
  • PDFNEWNET-37515 在SQL SERVER CLR使用Aspose.Pdf API

好消息!慧都控件网年终大促即将拉开大幕。11月1日起本站产品将开展为期一个月的促销打折活动。其中Aspose.Pdf白金版,Aspose.Pdf黄金版更有八折优惠,敬请期待!

创建内部链接到附件上

// Load PDF document
  Document doc = new Document("c:/pdftest/output_attach.pdf"); 
// Create attachment annoation 
 FileAttachmentAnnotation fileAttachment = new FileAttachmentAnnotation(doc.Pages[1], new Aspose.Pdf.Rectangle(0, 0, 16, 16), doc.EmbeddedFiles[1]);
  // Add attachment to first page of PDF 
 doc.Pages[1].Annotations.Add(fileAttachment); 
 // Set title for attachment  fileAttachment.Title = "Attached file"; 
 // Save the PDF file  doc.Save("c:/pdftest/Attachmentlink.pdf");

PDF to HTML - 设置生成的文件大小(大小)

// Select desirable page size  float newPageWidth = 400f;  float newPageHeight = 400f;    // Tune PdfPageEditor class   Aspose.Pdf.Facades.PdfPageEditor pdfEditor = new Aspose.Pdf.Facades.PdfPageEditor();  // Bind source PDF file  pdfEditor.BindPdf("c:/pdftest/TextReplaced.pdf");  // Set the page dimensions   pdfEditor.PageSize = new Aspose.Pdf.PageSize(newPageWidth, newPageHeight);  // Set vertical alignment for page as center aligned  pdfEditor.VerticalAlignmentType = Aspose.Pdf.VerticalAlignment.Center;  // Set Horizontal alignment for page as center aligned  pdfEditor.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center;    // This scales page content to fit width,  // comment it out or set Zoom to 1.0F if You don't want to scale  // content and only want to change page's size(i.e. crop it)  float zoom = Math.Min((float)newPageWidth / (float)pdfEditor.Document.Pages[1].Rect.Width,                      (float)newPageHeight / (float)pdfEditor.Document.Pages[1].Rect.Height);  pdfEditor.Zoom = zoom;// (float)595;    // Create stream object to hold file with updated dimensions  MemoryStream output = new MemoryStream();  // Save file to stream object  pdfEditor.Save(output);    // Then reload scaled document and save it to HTML  Document exportDoc = new Document(output);  HtmlSaveOptions htmlOptions = new HtmlSaveOptions();  // This code shows page boreder in result - sometimes it comes in handy to see borders  SaveOptions.BorderPartStyle borderStyle = new SaveOptions.BorderPartStyle();  borderStyle.LineType = SaveOptions.HtmlBorderLineType.Dotted;  borderStyle.Color = System.Drawing.Color.Gray;  htmlOptions.PageBorderIfAny = new SaveOptions.BorderInfo(borderStyle);    // Conversion to HTML itself  exportDoc.Save(@"C:\pdftest\37240_Test1.html", htmlOptions);  // Close the stream object  output.Close();

PDF to PDF/A-2A 转换

// Load PDF file  Document doc = new Aspose.Pdf.Document("input.pdf");  // Set PDF/A compliance as PDF/A_1a  doc.Convert(new MemoryStream(), PdfFormat.PDF_A_2A, ConvertErrorAction.Delete);  // Save updated document  doc.Save("compliant.pdf");

添加SVG对象到表格单元格

// Instantiate Document object  Document doc = new Document();  // Create an image instance  Aspose.Pdf.Image img = new Aspose.Pdf.Image();  // Set image type as SVG  img.FileType = Aspose.Pdf.ImageFileType.Svg;  // Path for source file  img.File = "c:/pdftest/img_03.svg";  // Set width for image instance  img.FixWidth = 50;  // Set height for image instance  img.FixHeight = 50;  // Create table instance  Aspose.Pdf.Table table = new Aspose.Pdf.Table();  // Set width for table cells  table.ColumnWidths = "100 100";  // Create row object and add it to table instance  Aspose.Pdf.Row row = table.Rows.Add();  // Create cell object and add it to row instance  Aspose.Pdf.Cell cell = row.Cells.Add();  // Add textfragment to paragraphs collection of cell object  cell.Paragraphs.Add(new TextFragment("First cell"));  // Add another cell to row object  cell = row.Cells.Add();  // Add SVG image to paragraphs collection of recently added cell instance  cell.Paragraphs.Add(img);  // Create page object and add it to pages collection of document instance  Page page = doc.Pages.Add();  // Add table to paragraphs collection of page object  page.Paragraphs.Add(table);  // Save PDF file  doc.Save("c:/pdftest/SVG_in_TableCell.pdf");

TextFragment格式设置为下划线

// Instantiate Document instance  Document pdfDocument = new Document();  // Add page to PDF file  pdfDocument.Pages.Add();  // Create TextBuild object with first page as argument  TextBuilder tb = new TextBuilder(pdfDocument.Pages[1]);  // Create TextFragment instance with sample text  TextFragment fragment = new TextFragment("Test message");  // Set the font for TextFragment  fragment.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("Arial");  // Set font size  fragment.TextState.FontSize = 10;  // Set text formatting as underline  fragment.TextState.Underline = true;  // Specify position for TextFragment  fragment.Position = new Position(10, 800);  // Add TextFragment to Text Builder instance  tb.AppendText(fragment);  // Save the PDF file  pdfDocument.Save("c:/pdftest/UnderLine_output.pdf");

在组合框领域添加选择选项

Document doc = new Document("37348.pdf");  string[] fields = doc.Form.XFA.FieldNames;  XmlNode node = doc.Form.XFA.GetFieldTemplate(fields[0]);  XmlNode items = node.SelectSingleNode("tpl:items", doc.Form.XFA.NamespaceManager);  XmlNode item = items.OwnerDocument.CreateNode(XmlNodeType.Element, "text", items.NamespaceURI);  item.InnerText = "Choice # 4 ( New )";  items.AppendChild(item);  doc.Save("37348-out.pdf");

标签:文档管理PDFaspose

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

文章转载自:慧都控件网

为你推荐

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


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP