From 33a47d5c3c4402d8d94b00ed9b3aa2c339203d2f Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 2 Nov 2021 18:12:39 -0400 Subject: Make QPDF::findPage public (fixes #516) This was originally not public because I wanted to get rid fo the pages cache, but I recently realized there were deep reasons not to do that, and the author of pikepdf wanted this, so I decided to make it public. --- include/qpdf/QPDF.hh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 48b92137..941004cc 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -605,6 +605,15 @@ class QPDF QPDF_DLL std::vector const& getAllPages(); + // These methods, given a page object or its object/generation + // number, returns the 0-based index into the array returned by + // getAllPages() for that page. An exception is thrown if the page + // is not found. + QPDF_DLL + int findPage(QPDFObjGen const& og); + QPDF_DLL + int findPage(QPDFObjectHandle& page); + // This method synchronizes QPDF's cache of the page structure // with the actual /Pages tree. If you restrict changes to the // /Pages tree, including addition, removal, or replacement of @@ -990,8 +999,6 @@ class QPDF std::set& visited, std::set& seen); void insertPage(QPDFObjectHandle newpage, int pos); - int findPage(QPDFObjGen const& og); - int findPage(QPDFObjectHandle& page); void flattenPagesTree(); void insertPageobjToPage(QPDFObjectHandle const& obj, int pos, bool check_duplicate); -- cgit v1.2.3-70-g09d2