HTML JPG PDF XML DOCX
  Product Family
PDF

Konversi PDF ke HTML di Node.js SDK

Ekspor dokumen PDF ke berbagai format termasuk HTML dengan Aspose.PDF Cloud Node.js SDK

Get Started

Cara Mengonversi PDF ke HTML Menggunakan Node.js SDK

Untuk mengonversi PDF ke HTML, kita akan menggunakan Aspose.PDF Cloud Node.js SDK Cloud SDK ini membantu programmer 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 pengelola paket, cari Aspose.PDF Cloud, dan instal. Anda juga dapat menggunakan perintah berikut dari Console Pengelola Paket.

Perintah Console Pengelola Paket


     
    npm install asposepdfcloud --save
     
     

Langkah-langkah Mengonversi PDF ke HTML melalui Node.js

Pengembang Aspose.PDF Cloud Node.js dapat dengan mudah memuat & mengonversi file PDF ke HTML hanya dalam beberapa baris kode.

  1. Muat Rahasia Aplikasi dan Kunci Anda dari file JSON atau atur kredensial dengan cara lain
  2. Buat objek untuk menghubungkan ke Cloud API
  3. Unggah file dokumen Anda
  4. Lakukan konversi menggunakan getPdfInStorageToHtml
  5. Unduh hasilnya jika diperlukan
 

Kode contoh ini menunjukkan Konversi PDF ke HTML Cloud Node.js SDK


    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 convertPDFtoHTML() {
        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.getPdfInStorageToHtml(storageFileName);
            fs.writeFileSync("sample.zip", convertResult.body);
            const buffer = await pdfApi.downloadFile(STORAGE_FILENAME);
        } catch (error) {
            console.error(error.response.text);
        }
    }
 
  • Konversi Lain yang Didukung

    Anda juga dapat mengonversi MD ke banyak format file lainnya 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 (Hyper Text Markup Language)
    JPEG KE PDF (Kelompok Pakar Fotografi Bersama)
    LATEX KE PDF (Teks Output LaTeX)
    PCL KE PDF (Bahasa Perintah Printer)
    MD KE PDF (Markdown)
    PDF KE BMP (Gambar Bitmap)
    PDF KE EPUB (Format E-book)
    PDF KE GIF (Format Pertukaran Grafis)
    PDF KE HTML (Hyper Text Markup Language)
    PDF KE JPEG (Kelompok Pakar Fotografi Bersama)
    PDF KE PDF/A (Format Dokumen Portabel)
    PDF KE PNG (Grafik Jaringan Portabel)
    PDF KE PPTX (Microsoft PowerPoint)
    PDF KE SVG (Grafik Vektor yang Dapat Diskalakan)
    PDF KE TEX (Sistem Grafis Komputer)
    PDF KE TIFF (Format Gambar Berlabel)
    PDF KE WORD (Format Biner Microsoft Word)
    PDF KE XLSX (Berkas Spreadsheet Format 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 yang Dapat Diskalakan)
    TEKS KE PDF (Dokumen Teks)
    TIFF KE PDF (Format Gambar Berlabel)
    XPS KE PDF (Spesifikasi Kertas XML)