Ngonversi HTML dadi PDF ing JavaScript

Dhuwur-kacepetan Node.js perpustakaan kanggo nindakake HTML kanggo PDF

Ngonversi HTML dadi PDF kanthi terprogram nggunakake Node.js. Jelajahi kekuwatan Node.js kanggo konversi HTML nganti PDF sing efisien lan bisa diukur.

Ndeleng potongan kode

Ngonversi HTML menyang PDF ing JavaScript

Kanggo pangembang JavaScript sing nggoleki solusi sing lancar kanggo ngowahi HTML dadi PDF, Aspose.Words for Node.js via .NET nyedhiyakake API konversi file sing intuisi lan langsung. Solusi kita ngidini pangembang JavaScript gampang ngowahi file saka format siji menyang format liyane, dadi alat sing penting kanggo ngotomatisasi tugas konversi file.

Apa sampeyan nggarap HTML, PDF utawa format file liyane, Aspose.Words for Node.js via .NET nyakup kabeh lan njamin asil sing paling dhuwur. Tes carane kode JavaScript bisa digunakake karo file HTML sampeyan saiki.

Simpen HTML minangka PDF ing JavaScript

Conto ing ngisor iki nduduhake carane ngowahi HTML dadi PDF kanthi mung sawetara baris kode JavaScript. Mulai kanthi nyakup spasi jeneng Aspose.Words ing proyek JavaScript. Sabanjure, nemtokake path menyang file input lan nggawe obyek Document kanggo mbukak isi HTML. Sampeyan banjur kudu nemtokake path menyang file output PDF lan nggunakake metode save() kanggo nyimpen asil minangka PDF. API konversi bakal nemtokake format file output adhedhasar ekstensi file sing ditemtokake.

Conto kode ing JavaScript kanggo ngowahi HTML format dadi PDF
Unggah file sing pengin diowahi
Kode roto
Pilih format target saka dhaptar
npm install @aspose/words
Nyalin
const aw = require('@aspose/words');

var doc = new aw.Document("Input.html")
doc.save("Output.pdf")
const aw = require('@aspose/words'); var doc = new aw.Document("Input.html") doc.save("Output.pdf") const aw = require('@aspose/words'); var doc = new aw.Document("Input.html") for (var page = 0; page < doc.pageCount; page++) { var extractedPage = doc.extractPages(page, 1); extractedPage.save(`Output_${page + 1}.pdf`); } const aw = require('@aspose/words'); var doc = new aw.Document() var builder = new aw.DocumentBuilder(doc) builder.insertImage("Input.html") doc.save("Output.pdf") const aw = require('@aspose/words'); var doc = new aw.Document() var builder = new aw.DocumentBuilder(doc) shape = builder.insertImage("Input.html") shape.getShapeRenderer().save("Output.pdf", new aw.Saving.ImageSaveOptions(aw.SaveFormat.pdf))
Kode roto
Nuduhake kode ing media sosial:

Carane ngowahi HTML dadi PDF ing JavaScript

  1. Pasang Aspose.Words for Node.js via .NET.
  2. Tambah referensi perpustakaan (ngimpor perpustakaan) menyang proyek JavaScript.
  3. Bukak HTML berkas JavaScript.
  4. Nelpon metode save(), menehi jeneng file output nganggo ekstensi PDF.
  5. Entuk asil konversi HTML PDF.

JavaScript kanggo ngowahi HTML dadi PDF

We host our Node.js via .Net packages in NPM repositories. Please follow the step-by-step instructions on how to install "Aspose.Words for Node.js via .NET" to your developer environment.

System Requirements

This package is compatible with Node.js 14.17.0 or higher.

Konversi HTML Liyane sing Didhukung

Sampeyan bisa ngowahi HTML menyang akeh format file liyane:

5%

Langganan kanggo Aspose Update Product

Entuk buletin saben wulan lan tawaran langsung dikirim menyang kothak layang.

© Aspose Pty Ltd 2001-2024. Kabeh hak dilindhungi undhang-undhang.