翻譯|使用教程|編輯:安雯斯|2023-05-18 17:28:07.697|閱讀 129 次
概述:本章介紹如何操作 XPS 和 EPS 文檔,歡迎查閱!
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
Aspose.Words是一種高級Word文檔處理API,用于執行各種文檔管理和操作任務。API支持生成,修改,轉換,呈現和打印文檔,而無需在跨平臺應用程序中直接使用Microsoft Word。
Aspose API支持流行文件格式處理,并允許將各類文檔導出或轉換為固定布局文件格式和最常用的圖像/多媒體格式。
Aspose技術交流群(761297826)
Aspose.Page 允許文檔轉換。例如,您可以將 XPS 轉換為 PDF。讓我們試試轉換的例子。
// For complete examples and data files, please go to //github.com/aspose-page/Aspose.Page-for-.NET // The path to the documents directory. string dataDir = RunExamples.GetDataDir_WorkingWithDocumentConversion(); // Initialize PDF output stream using (System.IO.Stream pdfStream = System.IO.File.Open(dataDir + "input.xps", System.IO.FileMode.Create, System.IO.FileAccess.Write)) // Initialize XPS input stream using (System.IO.Stream xpsStream = System.IO.File.Open(dataDir + "XPStoPDF.pdf", System.IO.FileMode.Open, System.IO.FileAccess.Read)) { // Load XPS document form the stream XpsDocument document = new XpsDocument(xpsStream, new XpsLoadOptions()); // or load XPS document directly from file. No xpsStream is needed then. // XpsDocument document = new XpsDocument(inputFileName, new XpsLoadOptions()); // Initialize options object with necessary parameters. Aspose.Page.XPS.Presentation.Pdf.PdfSaveOptions options = new Aspose.Page.XPS.Presentation.Pdf.PdfSaveOptions() { JpegQualityLevel = 100, ImageCompression = Aspose.Page.XPS.Presentation.Pdf.PdfImageCompression.Jpeg, TextCompression = Aspose.Page.XPS.Presentation.Pdf.PdfTextCompression.Flate, PageNumbers = new int[] { 1, 2, 6 } }; // Create rendering device for PDF format Aspose.Page.XPS.Presentation.Pdf.PdfDevice device = new Aspose.Page.XPS.Presentation.Pdf.PdfDevice(pdfStream); document.Save(device, options);
// For complete examples and data files, please go to //github.com/aspose-page/Aspose.Page-for-Java // The path to the documents directory. String dataDir = Utils.getDataDir(); // Initialize PDF output stream FileOutputStream pdfStream = new FileOutputStream(dataDir + "XPStoPDF.pdf"); // Load XPS document XpsDocument document = new XpsDocument(dataDir + "input.xps"); // Initialize options object with necessary parameters. com.aspose.xps.rendering.PdfSaveOptions options = new com.aspose.xps.rendering.PdfSaveOptions(); options.setJpegQualityLevel(100); options.setImageCompression(com.aspose.xps.rendering.PdfImageCompression.Jpeg); options.setTextCompression(com.aspose.xps.rendering.PdfTextCompression.Flate); options.setPageNumbers(new int[] { 1, 2, 6 }); // Create rendering device for PDF format com.aspose.xps.rendering.PdfDevice device = new com.aspose.xps.rendering.PdfDevice(pdfStream); document.save(device, options);
以上便是本篇文章的所有內容,要是您還有其他關于產品方面的問題,歡迎咨詢我們,或者加入我們官方技術交流群。
歡迎下載|體驗更多Aspose產品
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn