현재 DOCX 파일을 입력으로 허용하지 않습니다. 그러나 DOCX 파일을 출력으로 생성할 수 있습니다. 가까운 시일 내에 완전한 DOCX 지원을 기대합니다.
JavaScript 라이브러리는 독립 실행형 솔루션이며 타사 소프트웨어를 설치할 필요가 없습니다.
품질 손실 없이 DOCX 파일을 작게 만드십시오. JavaScript 라이브러리는 개발자에게 DOCX 콘텐츠를 최적화하기 위한 통합 API를 제공합니다. DOCX 최적화는 DOCX 파일 내부의 이미지를 압축하고 사용하지 않는 데이터를 제거하여 발생합니다.
'Aspose.Words for Node.js via .NET' 으로 전자책 무손실 압축 및 콘텐츠 최적화가 쉬워졌습니다. 다음 예제는 JavaScript 에서 DOCX 파일의 내용을 최적화하는 방법을 보여줍니다.
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);
}
}
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()) {
// 그것은 이미지 압축 라이브러리를 선택하는 개발자에 달려 있습니다.
const imageData = shape.getImageData().toStream();
// ...
// 이미지를 압축하고 모양으로 다시 설정합니다.
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()) {
// 그것은 이미지 압축 라이브러리를 선택하는 개발자에 달려 있습니다.
const imageData = shape.getImageData().toStream();
// ...
// 이미지를 압축하고 모양으로 다시 설정합니다.
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()) {
// 그것은 이미지 압축 라이브러리를 선택하는 개발자에 달려 있습니다.
const imageData = shape.getImageData().toStream();
// ...
// 이미지를 압축하고 모양으로 다시 설정합니다.
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.
다른 많은 파일 형식으로 파일을 최적화할 수 있습니다.