Change PDF Viewer Preferences in C++
Contents
[
Hide
]
Use PdfContentEditor for this task. The examples below retain the original C++ code and API Reference steps.
Change viewer preferences
Read the existing viewer-preference flags and set the additional bit represented by 1.
- Create PdfContentEditor.
- Bind the PDF input with Facade::BindPdf().
- Set the viewer flags with PdfContentEditor::ChangeViewerPreference().
- Read the viewer flags with PdfContentEditor::GetViewerPreference().
- Save the resulting PDF with PdfContentEditor::
Save().
#include <Aspose.PDF.Cpp/Facades/PdfContentEditor.h>
#include <system/string.h>
namespace Facades::Examples::PDF_ContentEditor
{
using namespace System;
using namespace Aspose::Pdf;
using namespace Aspose::Pdf::Facades;
void ChangeViewerPreferences(String inputFile, String outputFile)
{
auto editor = MakeObject<PdfContentEditor>();
editor->BindPdf(inputFile);
editor->ChangeViewerPreference(editor->GetViewerPreference() | 1);
editor->Save(outputFile);
}
} // namespace Facades::Examples::PDF_ContentEditor