ต้องการแปลงไฟล์เว็บเป็น PDF โดยทางโปรแกรม? ด้วย Aspose.Words สำหรับ Node.js via .NET คุณสามารถแปลง MD เป็นรูปแบบ PDF โดยใช้โค้ด JavaScript.
JavaScript API ของเราสร้าง PDF จาก MD ด้วยคุณภาพระดับมืออาชีพ ทดสอบการแปลง MD เป็น PDF คุณภาพสูงสุดในเบราว์เซอร์ของคุณ Node.js via .NET อันทรงพลังช่วยให้แปลงไฟล์ MD เป็นรูปแบบยอดนิยมมากมาย
ตัวอย่างต่อไปนี้สาธิตวิธีการแปลง MD เป็น PDF ใน JavaScript.
ทำตามขั้นตอนง่าย ๆ เพื่อเปลี่ยนไฟล์ MD เป็นรูปแบบ PDF อ่านไฟล์ MD ของคุณจากไดรฟ์ในเครื่อง จากนั้นบันทึกในรูปแบบ Portable Document Format โดยระบุรูปแบบไฟล์ที่ต้องการด้วยนามสกุล PDF สำหรับทั้งการอ่าน MD และการเขียน PDF คุณสามารถใช้ชื่อไฟล์แบบเต็มได้ เนื้อหา PDF ที่ส่งออกและการจัดรูปแบบจะเหมือนกับเอกสาร MD ดั้งเดิม
npm install @aspose/words
สำเนา
const aw = require('@aspose/words');
var doc = new aw.Document("Input.md")
doc.save("Output.pdf")
const aw = require('@aspose/words');
var doc = new aw.Document("Input.md")
doc.save("Output.pdf")
const aw = require('@aspose/words');
var doc = new aw.Document("Input.md")
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.md")
doc.save("Output.pdf")
const aw = require('@aspose/words');
var doc = new aw.Document()
var builder = new aw.DocumentBuilder(doc)
shape = builder.insertImage("Input.md")
shape.getShapeRenderer().save("Output.pdf", new aw.Saving.ImageSaveOptions(aw.SaveFormat.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.
This package is compatible with Node.js 14.17.0 or higher.