고정 페이지 형식으로 문서 저장
Contents
[
Hide
]
페이지 레이아웃이 작성되고 객체의 지오메트리와 페이지에서의 위치가 계산된 후,문서는 다음에서 지원하는 고정 페이지 형식으로 저장할 수 있습니다 Aspose.Words.
문서를 고정 페이지 형식으로 저장할 때 이러한 모든 형식에 공통된 렌더링 옵션을 사용할 수 있습니다. 그들은 통제 할 수 있습니다:
- 출력 문서에 포함된 페이지 수와 범위(PageIndex, PageCount).
- 페이지별 문서 저장 진행률(PageSavingCallback).
- 숫자 렌더링에 사용되는 문자 집합(NumeralFormat).
- 메타 파일 플레이어(MetafileRenderingOptions). 자세한 내용은 취급 Windows 메타파일 기사
- 재압축을 위한 질 비율 JPEG 선택한 저장 형식에 따라 값이 약간 다를 수 있는 이미지(JpegQuality).
- 벡터 그래픽 최적화 Aspose.Words 출력(OptimizeOutput).
- 그래픽 옵션을 저장할 때 사용할 수 있습니다.UseAntiAliasing, UseHighQualityRendering).
- 문서를 회색조로 저장)ColorMode).
- 도형과 대체 도형의 렌더링 간 전환(DmlRenderingMode).
- 사이 전환 DML 효과 렌더링 모드(DmlEffectsRenderingMode).
아래 예제에서는 다음에 문서를 저장하는 방법을 보여 줍니다 JPEG 형식을 사용하여 Save
메서드 및 렌더링 옵션:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C | |
// Open the document. | |
System::SharedPtr<Document> doc = System::MakeObject<Document>(inputDataDir + u"Rendering.doc"); | |
// Save as a JPEG image file with default options | |
System::String outputPathDefault = outputDataDir + u"Rendering.JpegDefaultOptions.jpg"; | |
doc->Save(outputPathDefault); | |
// Save document to stream as a JPEG with default options | |
System::SharedPtr<MemoryStream> docStream = new MemoryStream(); | |
doc->Save(docStream, SaveFormat::Jpeg); | |
// Rewind the stream position back to the beginning, ready for use | |
docStream->Seek(0, SeekOrigin::Begin); | |
// Save document to a JPEG image with specified options. | |
// Render the third page only and set the JPEG quality to 80% | |
// In this case we need to pass the desired SaveFormat to the ImageSaveOptions constructor | |
// to signal what type of image to save as. | |
System::SharedPtr<ImageSaveOptions> options = System::MakeObject<ImageSaveOptions>(SaveFormat::Tiff); | |
auto pageRange = System::MakeObject<PageRange>(0, 1); | |
options->set_PageSet(System::MakeObject<PageSet>(System::MakeArray<System::SharedPtr<PageRange>>({ pageRange }))); | |
options->set_JpegQuality(80); | |
System::String outputPath = outputDataDir + u"Rendering.JpegCustomOptions.jpg"; | |
doc->Save(outputPath, options); |