原創|產品更新|編輯:龔雪|2014-10-27 09:36:13.000|閱讀 430 次
概述:Aspose.Pdf 9.7發布,涵蓋120多項更新
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Aspose.Pdf 9.7主要更新內容:
好消息!慧都控件網年終大促即將拉開大幕。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");
// 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();
// 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");
// 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");
// 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");
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網