ต้องการแปลงเอกสารจากรูปแบบหนึ่งเป็นอีกรูปแบบหนึ่งโดยทางโปรแกรมหรือไม่? ด้วย Aspose.Words สำหรับ Node.js via .NET คุณสามารถแปลงไฟล์โดยใช้โค้ด JavaScript.
Node.js via .NET อันทรงพลังช่วยให้สามารถแปลงเอกสารเป็นรูปแบบยอดนิยมมากมายด้วยคุณภาพระดับมืออาชีพ:
ตัวอย่างต่อไปนี้สาธิตวิธีการแปลงเอกสารใน JavaScript โหลดไฟล์จากไดรฟ์ในเครื่อง จากนั้นบันทึกโดยระบุรูปแบบไฟล์ที่ต้องการในส่วนขยาย สำหรับไฟล์อินพุตและเอาต์พุต คุณสามารถใช้ชื่อไฟล์แบบเต็มได้ เนื้อหาเอาต์พุตและการจัดรูปแบบจะเหมือนกับเอกสารต้นฉบับ
npm install @aspose/words
สำเนา
const aw = require('@aspose/words');
var doc = new aw.Document("Input.docx")
doc.save("Output.pdf")
const aw = require('@aspose/words');
var doc = new aw.Document("Input.docx")
doc.save("Output.pdf")
const aw = require('@aspose/words');
var doc = new aw.Document("Input.docx")
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.docx")
doc.save("Output.pdf")
const aw = require('@aspose/words');
var doc = new aw.Document()
var builder = new aw.DocumentBuilder(doc)
shape = builder.insertImage("Input.docx")
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.