Phát triển PHẦN mềm XỬ lý EPUB trong Node.js sử dụng EPUB Optimization API. Giải pháp Node.js mạnh mẽ này giúp bạn tối ưu hóa và giảm kích thước của các tệp EPUB một cách dễ dàng. Kiểm tra KHẢ năng NÉN EPUB trực tuyến miễn phí!
Chúng tôi hiện không chấp nhận tệp DOCX làm đầu vào. Nhưng chúng tôi có thể sản xuất các tệp DOCX như một sự bổ sung. Chúng tôi mong muốn được ủng hộ DOCX đầy đủ trong thời gian sắp tới.
Thư viện JavaScript là một giải pháp độc lập và không yêu cầu cài đặt bất kỳ phần mềm bên thứ ba nào.
Thu nhỏ tệp DOCX mà không làm giảm chất lượng. Thư viện JavaScript cung cấp cho các nhà phát triển một API tích hợp để tối ưu hóa nội dung DOCX. Tối ưu hóa DOCX xảy ra bằng cách nén hình ảnh bên trong tệp DOCX, cũng như bằng cách xóa dữ liệu không sử dụng.
Việc nén không mất dữ liệu điện tử và tối ưu hóa nội dung trở nên dễ dàng với 'Aspose.Words for Node.js via .NET'. Ví dụ sau minh họa cách tối ưu hóa nội dung của tệp DOCX trong JavaScript:
npm install @aspose/words
Sao chép
const aw = require('@aspose/words');
var doc = new aw.Document("Input.docx");
doc.cleanup();
var shapes = doc.getChildNodes(aw.NodeType.Shape, true)
for (var shape of shapes) {
if (shape.hasImage()) {
// Tùy thuộc vào nhà phát triển để chọn thư viện để nén hình ảnh.
const imageData = shape.getImageData().toStream();
// ...
// Nén hình ảnh và đặt nó trở lại hình dạng.
shape.getImageData().setImage(compressedImageBuffer);
}
}
doc.save("Output.epub")
const aw = require('@aspose/words');
var doc = new aw.Document("Input.docx");
doc.cleanup();
var shapes = doc.getChildNodes(aw.NodeType.Shape, true)
for (var shape of shapes) {
if (shape.hasImage()) {
// Tùy thuộc vào nhà phát triển để chọn thư viện để nén hình ảnh.
const imageData = shape.getImageData().toStream();
// ...
// Nén hình ảnh và đặt nó trở lại hình dạng.
shape.getImageData().setImage(compressedImageBuffer);
}
}
var saveOptions = new aw.Saving.PdfSaveOptions()
saveOptions.cacheBackgroundGraphics = true
doc.save("Output.epub", saveOptions)
const aw = require('@aspose/words');
var doc = new aw.Document("Input.docx");
doc.cleanup();
var shapes = doc.getChildNodes(aw.NodeType.Shape, true)
for (var shape of shapes) {
if (shape.hasImage()) {
// Tùy thuộc vào nhà phát triển để chọn thư viện để nén hình ảnh.
const imageData = shape.getImageData().toStream();
// ...
// Nén hình ảnh và đặt nó trở lại hình dạng.
shape.getImageData().setImage(compressedImageBuffer);
}
}
doc.save("Output.epub")
const aw = require('@aspose/words');
var doc = new aw.Document("Input.docx");
doc.cleanup();
var shapes = doc.getChildNodes(aw.NodeType.Shape, true)
for (var shape of shapes) {
if (shape.hasImage()) {
// Tùy thuộc vào nhà phát triển để chọn thư viện để nén hình ảnh.
const imageData = shape.getImageData().toStream();
// ...
// Nén hình ảnh và đặt nó trở lại hình dạng.
shape.getImageData().setImage(compressedImageBuffer);
}
}
var saveOptions = new aw.Saving.OoxmlSaveOptions()
saveOptions.compressionLevel = aw.Saving.CompressionLevel.Maximum
doc.save("Output.epub", saveOptions)
const aw = require('@aspose/words');
var doc = new aw.Document()
var builder = new aw.DocumentBuilder(doc)
shape = builder.insertImage("Input.docx")
var saveOptions = new aw.Saving.ImageSaveOptions(aw.SaveFormat.Docx)
shape.getShapeRenderer().save("Output.epub", saveOptions)
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.