Vyvíjejte software pro zpracování DOC v Node.js Pomocí DOC Optimization API. Toto výkonné řešení Node.js vám pomůže bez námahy optimalizovat a zmenšit velikost souborů DOC. Otestujte možnosti komprese DOC online zdarma!
Zmenšit velké DOC soubory bez ztráty kvality. Odstraňte nepotřebná a nepoužívaná data. Zmenšete velikost DOC souboru v kódu. Knihovna JavaScript poskytuje vývojářům integrované API pro optimalizaci obsahu DOC.
JavaScript knihovna je samostatné řešení a nevyžaduje instalaci žádného softwaru třetích stran.
Bezeztrátová komprese a hluboká optimalizace obsahu usnadněná s 'Aspose.Words for Node.js via .NET'. Následující příklad ukazuje, jak optimalizovat obsah DOC souboru v JavaScript:
npm install @aspose/words Kopírovat const aw = require('@aspose/words'); var doc = new aw.Document("Input.doc"); doc.cleanup(); var shapes = doc.getChildNodes(aw.NodeType.Shape, true) for (var shape of shapes) { if (shape.hasImage()) { // Je na vývojáři, aby si vybral knihovnu pro kompresi obrazu. const imageData = shape.getImageData().toStream(); // ... // Komprimujte obrázek a nastavte jej zpět do tvaru. shape.getImageData().setImage(compressedImageBuffer); } } doc.save("Output.doc") const aw = require('@aspose/words'); var doc = new aw.Document("Input.doc"); doc.cleanup(); var shapes = doc.getChildNodes(aw.NodeType.Shape, true) for (var shape of shapes) { if (shape.hasImage()) { // Je na vývojáři, aby si vybral knihovnu pro kompresi obrazu. const imageData = shape.getImageData().toStream(); // ... // Komprimujte obrázek a nastavte jej zpět do tvaru. shape.getImageData().setImage(compressedImageBuffer); } } var saveOptions = new aw.Saving.PdfSaveOptions() saveOptions.cacheBackgroundGraphics = true doc.save("Output.doc", saveOptions) const aw = require('@aspose/words'); var doc = new aw.Document("Input.doc"); doc.cleanup(); var shapes = doc.getChildNodes(aw.NodeType.Shape, true) for (var shape of shapes) { if (shape.hasImage()) { // Je na vývojáři, aby si vybral knihovnu pro kompresi obrazu. const imageData = shape.getImageData().toStream(); // ... // Komprimujte obrázek a nastavte jej zpět do tvaru. shape.getImageData().setImage(compressedImageBuffer); } } doc.save("Output.doc") const aw = require('@aspose/words'); var doc = new aw.Document("Input.doc"); doc.cleanup(); var shapes = doc.getChildNodes(aw.NodeType.Shape, true) for (var shape of shapes) { if (shape.hasImage()) { // Je na vývojáři, aby si vybral knihovnu pro kompresi obrazu. const imageData = shape.getImageData().toStream(); // ... // Komprimujte obrázek a nastavte jej zpět do tvaru. shape.getImageData().setImage(compressedImageBuffer); } } var saveOptions = new aw.Saving.OoxmlSaveOptions() saveOptions.compressionLevel = aw.Saving.CompressionLevel.Maximum doc.save("Output.doc", saveOptions) const aw = require('@aspose/words'); var doc = new aw.Document() var builder = new aw.DocumentBuilder(doc) shape = builder.insertImage("Input.doc") var saveOptions = new aw.Saving.ImageSaveOptions(aw.SaveFormat.Doc) shape.getShapeRenderer().save("Output.doc", 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.
Můžete optimalizovat soubory v mnoha dalších formátech souborů: