PDF control Spire.PDF for .NET [Conversion] Tutorial: Convert XPS to PDF format

Spire.Doc  is a class library specialized in manipulating Word documents. It helps developers create, edit, convert and print Microsoft Word documents easily, quickly and efficiently without installing Microsoft Word. With nearly 10 years of professional development experience, the Spire series of office document development tools focus on creating, editing, converting and printing Word/PDF/Excel and other file formats, compact and convenient. 

The E-iceblue  function class library Spire series document processing components are all developed by local Chinese teams, do not rely on third-party software, are not restricted by technology or laws and regulations of other countries, and are also compatible with domestic operating systems such as Zhongke Fangde, Winning Kirin, etc. Compatible with domestic document processing software WPS (such as .wps/.et/.dps and other formats

XPS is the abbreviation of XML Paper Specification developed by Microsoft Corporation, which is a specification of page description language and fixed document format. It was developed by Microsoft's initiative in its Windows operating system to link the creation and reading of files. Like PDF, XPS plays an important role in document preservation by providing a device-independent appearance of the document. Editing in XPS or PDF seems difficult.

As a flexible and professional component, Spire.PDF for .NET provides a wide variety of conversions, among which the conversion from XPS to PDF is one of its popular functions. In addition, Spire.PDF for .NET can be applied to WinForm, ASP.NET and console applications.

The following code example demonstrates how to convert an XPS file to a PDF document.

Step 1: Introduce a class named pdfDocument to initialize Spire.PDF.PdfDocument, and load XPS files by calling the method LoadForm File.

[C#]

PdfDocument doc = new PdfDocument();
doc.LoadFromFile(xpsFile,FileFormat.XPS);

Step 2: Only one line of simple code is required. Call the SavetoFile method of Spire.PDF.pdfDocument to save all data in PDF format.

[C#]

doc.SaveToFile(pdfFile, FileFormat.PDF);

After executing this code, run the application and you will see the PDF converted from XPS.

Screenshot before converting XPS to PDF:

Screenshot after converting XPS to PDF:

The above is how to convert XPS to PDF format. If you have other questions, you can continue to browse this series of articles to get related tutorials. You can also leave me a message or join our official technical exchange group

おすすめ

転載: blog.csdn.net/m0_67129275/article/details/131432336
おすすめ