품질 손실 없이 큰 파일을 작게 만드십시오. 불필요하고 사용하지 않는 데이터를 삭제하십시오. JavaScript 에서 Word 및 HTML 파일의 크기를 줄입니다. JavaScript 라이브러리는 개발자에게 다양한 형식의 문서를 최적화할 수 있는 통합 API를 제공합니다.
이 JavaScript 라이브러리는 독립 실행형 솔루션이며 타사 소프트웨어를 설치할 필요가 없습니다.
고해상도 이미지와 이러한 이미지가 포함된 문서를 최적화하면 최대 효과를 얻을 수 있습니다. JavaScript 라이브러리는 DOCX, DOC, RTF, ODT, EPUB, HTML, JPG, PNG 파일을 압축하는 데 도움이 됩니다.
'Aspose.Words for Node.js via .NET' 사용하면 품질 손실 없이 문서를 쉽게 최적화할 수 있습니다. 다음 예제는 JavaScript 에서 Word 문서의 크기를 줄이는 방법을 보여줍니다.
npm install @aspose/words
복사
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()) {
// 그것은 이미지 압축 라이브러리를 선택하는 개발자에 달려 있습니다.
const imageData = shape.getImageData().toStream();
// ...
// 이미지를 압축하고 모양으로 다시 설정합니다.
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()) {
// 그것은 이미지 압축 라이브러리를 선택하는 개발자에 달려 있습니다.
const imageData = shape.getImageData().toStream();
// ...
// 이미지를 압축하고 모양으로 다시 설정합니다.
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()) {
// 그것은 이미지 압축 라이브러리를 선택하는 개발자에 달려 있습니다.
const imageData = shape.getImageData().toStream();
// ...
// 이미지를 압축하고 모양으로 다시 설정합니다.
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()) {
// 그것은 이미지 압축 라이브러리를 선택하는 개발자에 달려 있습니다.
const imageData = shape.getImageData().toStream();
// ...
// 이미지를 압축하고 모양으로 다시 설정합니다.
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.