From 077f6439954cdbb5061a78b59be95ebf2277ac26 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Mon, 16 Oct 2017 13:32:01 -0400 Subject: Add FPDFCatalog_IsTagged to public API. The new fpdf_catalog.h will contains functions to access entries in the catalog (root) dict in a PDF. Bug: chromium:768986 Change-Id: I6e1d4a479d6f8742981e89f07bab98ee96dc3763 Reviewed-on: https://pdfium-review.googlesource.com/15970 Reviewed-by: dsinclair Commit-Queue: Henrique Nakashima --- fpdfsdk/fpdfcatalog.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 fpdfsdk/fpdfcatalog.cpp (limited to 'fpdfsdk/fpdfcatalog.cpp') diff --git a/fpdfsdk/fpdfcatalog.cpp b/fpdfsdk/fpdfcatalog.cpp new file mode 100644 index 0000000000..493e5aea43 --- /dev/null +++ b/fpdfsdk/fpdfcatalog.cpp @@ -0,0 +1,22 @@ +// Copyright 2017 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "public/fpdf_catalog.h" + +#include "core/fpdfapi/parser/cpdf_document.h" +#include "fpdfsdk/fsdk_define.h" + +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFCatalog_IsTagged(FPDF_DOCUMENT document) { + CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); + if (!pDoc) + return false; + + const CPDF_Dictionary* pCatalog = pDoc->GetRoot(); + if (!pCatalog) + return false; + + const CPDF_Dictionary* pMarkInfo = pCatalog->GetDictFor("MarkInfo"); + return pMarkInfo && pMarkInfo->GetIntegerFor("Marked") != 0; +} -- cgit v1.2.3