Sukurkite Word apdorojimo programinę įrangą Node.js naudodami Word Optimization API. Šis galingas Node.js sprendimas padeda be vargo optimizuoti ir sumažinti Word failų dydį. Išbandykite Word glaudinimo galimybes internete nemokamai!
Sumažinkite didelius Word failus neprarandant kokybės. Ištrinkite nereikalingus ir nenaudojamus duomenis. Word failo dydį kode. JavaScript biblioteka suteikia kūrėjams integruotą API, skirtą Word turiniui optimizuoti.
JavaScript biblioteka yra atskiras sprendimas ir jai nereikia įdiegti jokios trečiosios šalies programinės įrangos.
Su 'Aspose.Words for Node.js via .NET' lengvas glaudinimas ir gilus turinio optimizavimas. Toliau pateiktame pavyzdyje parodyta, kaip optimizuoti Word failo JavaScript:
npm install @aspose/words
Kopijuoti
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()) {
// Kūrėjas turi pasirinkti vaizdų glaudinimo biblioteką.
const imageData = shape.getImageData().toStream();
// ...
// Suspausti vaizdą ir nustatykite jį atgal į formą.
shape.getImageData().setImage(compressedImageBuffer);
}
}
var saveOptions = new aw.Saving.OoxmlSaveOptions()
saveOptions.compressionLevel = aw.Saving.CompressionLevel.Maximum
doc.save("Output.docx", 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()) {
// Kūrėjas turi pasirinkti vaizdų glaudinimo biblioteką.
const imageData = shape.getImageData().toStream();
// ...
// Suspausti vaizdą ir nustatykite jį atgal į formą.
shape.getImageData().setImage(compressedImageBuffer);
}
}
var saveOptions = new aw.Saving.PdfSaveOptions()
saveOptions.cacheBackgroundGraphics = true
doc.save("Output.docx", 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()) {
// Kūrėjas turi pasirinkti vaizdų glaudinimo biblioteką.
const imageData = shape.getImageData().toStream();
// ...
// Suspausti vaizdą ir nustatykite jį atgal į formą.
shape.getImageData().setImage(compressedImageBuffer);
}
}
doc.save("Output.docx")
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()) {
// Kūrėjas turi pasirinkti vaizdų glaudinimo biblioteką.
const imageData = shape.getImageData().toStream();
// ...
// Suspausti vaizdą ir nustatykite jį atgal į formą.
shape.getImageData().setImage(compressedImageBuffer);
}
}
var saveOptions = new aw.Saving.OoxmlSaveOptions()
saveOptions.compressionLevel = aw.Saving.CompressionLevel.Maximum
doc.save("Output.docx", 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.docx", 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.
Galite optimizuoti daugelio kitų failų formatų failus: