HTML
JPG
PDF
XML
DOCX
PDF
Konversi PDF ke XPS di Node.js SDK
Ekspor dokumen PDF ke berbagai format termasuk XPS dengan Aspose.PDF Cloud Node.js SDK
Get StartedCara Mengonversi PDF ke XPS Menggunakan Node.js SDK
Untuk mengonversi PDF ke XPS, kita akan menggunakan Aspose.PDF Cloud Node.js SDK Cloud SDK ini membantu pemrogram Node.js dalam mengembangkan aplikasi pembuat, anotator, editor, dan konverter PDF berbasis cloud menggunakan bahasa pemrograman Node.js melalui Aspose.PDF REST API. Buka NPM manajer paket, cari Aspose.PDF Cloud, dan instal. Anda juga dapat menggunakan perintah berikut dari Konsol Manajer Paket.
Perintah Konsol Manajer Paket
npm install asposepdfcloud --save
Langkah-langkah untuk Mengonversi PDF ke XPS melalui Node.js
Pengembang Aspose.PDF Cloud Node.js dapat dengan mudah memuat & mengonversi file PDF ke XPS hanya dalam beberapa baris kode.
- Muat Rahasia Aplikasi dan Kunci Anda dari file JSON atau atur kredensial dengan cara lain
- Buat objek untuk terhubung ke Cloud API
- Unggah file dokumen Anda
- Lakukan konversi menggunakan getPdfInStorageToXps
- Unduh hasilnya jika diperlukan
Kode contoh ini menunjukkan Konversi Cloud Node.js SDK dari PDF ke XPS
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);
}
}
Konversi Lain yang Didukung
Anda juga dapat mengonversi MD ke banyak format file lain termasuk beberapa yang tercantum di bawah ini.
BMP KE PDF (Gambar Bitmap)
CGM KE PDF (Format Biner Microsoft Word)
EMF KE PDF (Dokumen Words Office 2007+)
EPUB KE PDF (Format Metafile yang Ditingkatkan)
GIF KE PDF (Format Pertukaran Grafis)
HTML KE PDF (Bahasa Markup Teks Hiper)
JPEG KE PDF (Kelompok Ahli Fotografi Gabungan)
LATEX KE PDF (Teks Keluaran LaTeX)
PCL KE PDF (Bahasa Perintah Printer)
MD KE PDF (Markdown)
PDF KE BMP (Gambar Bitmap)
PDF KE EPUB (Format Buku Elektronik)
PDF KE GIF (Format Pertukaran Grafis)
PDF KE HTML (Hyper Text Markup Language)
PDF KE JPEG (Kelompok Ahli Fotografi Bergabung)
PDF KE PDF/A (Format Dokumen Portabel)
PDF KE PNG (Grafik Jaringan Portabel)
PDF KE PPTX (Microsoft PowerPoint)
PDF KE SVG (Grafik Vektor Skalabel)
PDF KE TEX (Sistem Grafik Komputer)
PDF KE TIFF (Format Gambar Berlabel)
PDF KE WORD (Format Biner Microsoft Word)
PDF KE XLSX (File Format Spreadsheet Microsoft Excel Open XML)
PDF KE XPS (Spesifikasi Kertas XML)
PNG KE PDF (Grafik Jaringan Portabel)
PS KE PDF (PostScript)
SVG KE PDF (Grafik Vektor Skalabel)
TEXT KE PDF (Dokumen Teks)
TIFF KE PDF (Format Gambar Berlabel)
XPS KE PDF (Spesifikasi Kertas XML)