HTML
JPG
PDF
XML
DOCX
PDF
Convert PDF to XPS in Node.js SDK
Export PDF documents to multiple formats including XPS with Aspose.PDF Cloud Node.js SDK
Get StartedHow to Convert PDF to XPS Using Node.js SDK
To convert PDF to XPS, we’ll use Aspose.PDF Cloud Node.js SDK This Cloud SDK SDK assists Node.js programmers in developing cloud-based PDF creator, annotator, editor, and converter apps using Node.js programming language via Aspose.PDF REST API. Open NPM package manager, search for Aspose.PDF Cloud, and install. You may also use the following command from the Package Manager Console.
Package Manager Console Command
npm install asposepdfcloud --save
Steps to Convert PDF to XPS via Node.js
Aspose.PDF Cloud Node.js developers can easily load & convert PDF files to XPS in just a few lines of code.
- Load your Application Secret and Key from the JSON file or set credentials in another way
- Create an object to connect to the Cloud API
- Upload your document file
- Perform the conversion using getPdfInStorageToXps
- Download the result if needed it
This sample code shows PDF to XPS Cloud Node.js SDK Conversion
const fs = require("fs");
const credentials = require("./credentials.json");
const { PdfApi } = require("asposepdfcloud");
// Load your Application Secret and Key from the JSON file or set credentials in another way
async function convertPDFtoXPS() {
const localFileName = "C:\\Samples\\sample.pdf";
const storageFileName = "sample.pdf";
const pdfApi = new PdfApi(credentials.id, credentials.key);
let fileData = await fs.readFile(localImageFileName);
try {
let uploadResult = await pdfApi.uploadFile(storageFileName, fileData);
console.log(uploadResult.response.text);
}
catch (error) {
console.error(error.response.text);
}
try {
let convertResult = await pdfApi.getPdfInStorageToXps(storageFileName + "1");
fs.writeFileSync("sample.xps", convertResult.body);
const buffer = await pdfApi.downloadFile(STORAGE_FILENAME);
} catch (error) {
console.error(error.message);
}
}
Other Supported Conversions
You can also convert MD into many other file formats including few listed below.
BMP TO PDF (Bitmap Image)
CGM TO PDF (Microsoft Word Binary Format)
EMF TO PDF (Office 2007+ Words Document)
EPUB TO PDF (Enhanced Metafile Format)
GIF TO PDF (Graphical Interchange Format)
HTML TO PDF (Hyper Text Markup Language)
JPEG TO PDF (Joint Photographic Experts Group)
LATEX TO PDF (LaTeX Output Text)
PCL TO PDF (Printer Command Language)
MD TO PDF (Markdown)
PDF TO BMP (Bitmap Image)
PDF TO EPUB (E-book Format)
PDF TO GIF (Graphical Interchange Format)
PDF TO HTML (Hyper Text Markup Language)
PDF TO JPEG (Joint Photographic Experts Group)
PDF TO PDF/A (Portable Document Format)
PDF TO PNG (Portable Network Graphics)
PDF TO PPTX (Microsoft PowerPoint)
PDF TO SVG (Scalable Vector Graphics)
PDF TO TEX (Computer Graphics System)
PDF TO TIFF (Tagged Image Format)
PDF TO WORD (Microsoft Word Binary Format)
PDF TO XLSX (Microsoft Excel Open XML Format Spreadsheet file)
PDF TO XPS (XML Paper Specifications)
PNG TO PDF (Portable Network Graphics)
PS TO PDF (PostScript)
SVG TO PDF (Scalable Vector Graphics)
TEXT TO PDF (Text Document)
TIFF TO PDF (Tagged Image Format)
XPS TO PDF (XML Paper Specifications)