Konversi PDF ke PPTX di Node.js
Contents
[
Hide
]
Coba mengonversi PDF ke PowerPoint secara online
Aspose.PDF for Node.js mempersembahkan aplikasi gratis online “PDF ke PPTX”, di mana Anda dapat mencoba menyelidiki fungsionalitas dan kualitasnya.
Konversi PDF ke PPTX
Jika Anda ingin mengonversi dokumen PDF, Anda dapat menggunakan AsposePdfToPptX fungsi. Silakan periksa cuplikan kode berikut untuk melakukan konversi di lingkungan Node.js.
CommonJS:
- Panggilan
requiredan imporasposepdfnodejsmodul sebagaiAsposePdfvariabel. - Tentukan nama file PDF yang akan dikonversi.
- Panggilan
AsposePdfsebagai Promise dan lakukan operasi untuk mengonversi file. Terima objek jika berhasil. - Panggil fungsi AsposePdfToPptX.
- Konversi file PDF. Jadi, jika ‘json.errorCode’ bernilai 0, hasil operasi disimpan dalam “ResultPDFtoPptX.pptx”. Jika parameter json.errorCode tidak 0 dan, akibatnya, muncul error dalam file Anda, informasi error akan terdapat dalam ‘json.errorText’.
const AsposePdf = require('asposepdfnodejs');
const pdf_file = 'Aspose.pdf';
AsposePdf().then(AsposePdfModule => {
/*Convert a PDF-file to PptX and save the "ResultPDFtoPptX.pptx"*/
const json = AsposePdfModule.AsposePdfToPptX(pdf_file, "ResultPDFtoPptX.pptx");
console.log("AsposePdfToPptX => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
});
ECMAScript/ES6:
- Impor
asposepdfnodejsmodul. - Tentukan nama file PDF yang akan dikonversi
- Inisialisasi modul AsposePdf. Terima objek jika berhasil.
- Panggil fungsi AsposePdfToPptX.
- Konversi file PDF. Jadi, jika ‘json.errorCode’ bernilai 0, hasil operasi disimpan dalam “ResultPDFtoPptX.pptx”. Jika parameter json.errorCode tidak 0 dan, akibatnya, muncul error dalam file Anda, informasi error akan terdapat dalam ‘json.errorText’.
import AsposePdf from 'asposepdfnodejs';
const AsposePdfModule = await AsposePdf();
const pdf_file = 'Aspose.pdf';
/*Convert a PDF-file to PptX and save the "ResultPDFtoPptX.pptx"*/
const json = AsposePdfModule.AsposePdfToPptX(pdf_file, "ResultPDFtoPptX.pptx");
console.log("AsposePdfToPptX => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
