Get PDF Viewer Preferences in C++

Use PdfContentEditor for this task. The examples below retain the original C++ code and API Reference steps.

Get viewer preferences

Print the current viewer-preference flags.

  1. Create PdfContentEditor.
  2. Bind the PDF input with Facade::BindPdf().
  3. Read the viewer flags with PdfContentEditor::GetViewerPreference().
  4. Print the results or diagnostic messages shown in the example.
#include <Aspose.PDF.Cpp/Facades/PdfContentEditor.h>
#include <iostream>
#include <system/string.h>

namespace Facades::Examples::PDF_ContentEditor
{
using namespace System;
using namespace Aspose::Pdf;
using namespace Aspose::Pdf::Facades;

void GetViewerPreferences(String inputFile)
{
    auto editor = MakeObject<PdfContentEditor>();

    editor->BindPdf(inputFile);
    std::cout << "Current viewer preference: " << editor->GetViewerPreference() << std::endl;
}
} // namespace Facades::Examples::PDF_ContentEditor