HTML JPG PDF XML DOCX
  Product Family
PDF

Konversi PDF ke DOCX di Node.js SDK

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

Get Started

Cara Mengonversi PDF ke DOCX Menggunakan Node.js SDK

Untuk mengonversi PDF ke DOCX, 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 Mengonversi PDF ke DOCX melalui Node.js

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

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

Kode sampel ini menunjukkan Konversi PDF ke DOCX 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 convertPDFtoDOCX() {
        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.getPdfInStorageToDoc(storageFileName, false, "docx");
            fs.writeFileSync("sample.docx", 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 berbagai format file lainnya termasuk yang tercantum di bawah ini.

    BMP KE PDF (Gambar Bitmap)
    CGM KE PDF (Format Biner Microsoft Word)
    EMF KE PDF (Dokumen Kata Office 2007+)
    EPUB KE PDF (Format File Metafile yang Ditingkatkan)
    GIF KE PDF (Format Pertukaran Grafis)
    HTML KE PDF (Bahasa Markup Hyper Text)
    JPEG KE PDF (Kelompok Ahli Fotografi Bersama)
    LATEX KE PDF (Teks Hasil 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 (Joint Photographic Experts Group)
    PDF KE PDF/A (Portable Document Format)
    PDF KE PNG (Portable Network Graphics)
    PDF KE PPTX (Microsoft PowerPoint)
    PDF KE SVG (Scalable Vector Graphics)
    PDF KE TEX (Computer Graphics System)
    PDF KE TIFF (Tagged Image Format)
    PDF KE WORD (Microsoft Word Binary Format)
    PDF KE XLSX (Microsoft Excel Open XML Format Spreadsheet file)
    PDF KE XPS (XML Paper Specifications)
    PNG KE PDF (Portable Network Graphics)
    PS KE PDF (PostScript)
    SVG KE PDF (Scalable Vector Graphics)
    TEKS KE PDF (Text Document)
    TIFF KE PDF (Tagged Image Format)
    XPS KE PDF (XML Paper Specifications)