Cần chuyển đổi hình ảnh PNG sang Word theo chương trình? Với Aspose.Words for Node.js via .NET, bất kỳ nhà phát triển nào cũng có thể chuyển đổi định dạng tài liệu PNG sang Word chỉ bằng một vài dòng mã JavaScript.
API JavaScript xử lý hình ảnh hiện đại tạo tài liệu Word từ hình ảnh PNG với chất lượng chuyên nghiệp. Kiểm tra quá trình chuyển đổi PNG sang Word chất lượng cao nhất ngay trong trình duyệt của bạn. Thư viện JavaScript mạnh mẽ cho phép chuyển đổi hình ảnh PNG sang hầu hết các định dạng Word.
Ví dụ sau đây minh họa cách chuyển đổi định dạng tài liệu PNG sang Word trong JavaScript.
Thực hiện theo các bước đơn giản để chuyển hình ảnh PNG sang định dạng tài liệu Word. Đọc tệp PNG của bạn từ ổ đĩa cục bộ, sau đó chỉ cần lưu nó ở định dạng tài liệu, chỉ định định dạng tệp được yêu cầu bằng phần mở rộng tài liệu Word. Đối với cả việc đọc PNG và ghi tài liệu Word, bạn có thể sử dụng tên tệp đủ điều kiện.
npm install @aspose/words
Sao chép
const aw = require('@aspose/words');
var doc = new aw.Document()
var builder = new aw.DocumentBuilder(doc)
builder.insertImage("Input.png")
doc.save("Output.docx")
const aw = require('@aspose/words');
var doc = new aw.Document("Input.png")
doc.save("Output.docx")
const aw = require('@aspose/words');
var doc = new aw.Document("Input.png")
for (var page = 0; page < doc.pageCount; page++) {
var extractedPage = doc.extractPages(page, 1);
extractedPage.save(`Output_${page + 1}.docx`);
}
const aw = require('@aspose/words');
var doc = new aw.Document()
var builder = new aw.DocumentBuilder(doc)
builder.insertImage("Input.png")
doc.save("Output.docx")
const aw = require('@aspose/words');
var doc = new aw.Document()
var builder = new aw.DocumentBuilder(doc)
shape = builder.insertImage("Input.png")
shape.getShapeRenderer().save("Output.docx", new aw.Saving.ImageSaveOptions(aw.SaveFormat.docx))
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.
Bạn có thể chuyển đổi PNG sang nhiều định dạng tệp khác: