diff options
author | Lei Zhang <thestig@chromium.org> | 2018-05-08 19:20:57 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-08 19:20:57 +0000 |
commit | 9c6204fc6c23ab35ec234781df182da570f6faef (patch) | |
tree | 14170cb0685189648b99d6ca786029382d3384f9 /fpdfsdk/fpdf_view.cpp | |
parent | 5de481e71bcde25d31452b23a017bb783163a204 (diff) | |
download | pdfium-9c6204fc6c23ab35ec234781df182da570f6faef.tar.xz |
Add APIs to work with a FPDF_PAGERANGE.
After getting a FPDF_PAGERANGE from FPDF_VIEWERREF_GetPrintPageRange(),
one can now use FPDF_VIEWERREF_GetPrintPageRangeCount() to get the
number of elements in the FPDF_PAGERANGE. One can then use
FPDF_VIEWERREF_GetPrintPageRangeElement() to read the elements.
Change-Id: I33eeff9026d01991ae1424e05b67f163245a35f9
Reviewed-on: https://pdfium-review.googlesource.com/32173
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_view.cpp')
-rw-r--r-- | fpdfsdk/fpdf_view.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp index f5eea66125..22cb62ea6e 100644 --- a/fpdfsdk/fpdf_view.cpp +++ b/fpdfsdk/fpdf_view.cpp @@ -1003,6 +1003,21 @@ FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document) { return FPDFPageRangeFromCPDFArray(viewRef.PrintPageRange()); } +FPDF_EXPORT size_t FPDF_CALLCONV +FPDF_VIEWERREF_GetPrintPageRangeCount(FPDF_PAGERANGE pagerange) { + const CPDF_Array* pArray = CPDFArrayFromFPDFPageRange(pagerange); + return pArray ? pArray->GetCount() : 0; +} + +FPDF_EXPORT int FPDF_CALLCONV +FPDF_VIEWERREF_GetPrintPageRangeElement(FPDF_PAGERANGE pagerange, + size_t index) { + const CPDF_Array* pArray = CPDFArrayFromFPDFPageRange(pagerange); + if (!pArray || index >= pArray->GetCount()) + return -1; + return pArray->GetIntegerAt(index); +} + FPDF_EXPORT FPDF_DUPLEXTYPE FPDF_CALLCONV FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document) { CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); |