Fix pdf_page_from_fz_page
authorTor Andersson <[email protected]>
Fri, 19 Jul 2024 08:35:53 +0000 (10:35 +0200)
committerTor Andersson <[email protected]>
Fri, 19 Jul 2024 08:35:53 +0000 (10:35 +0200)
source/pdf/pdf-xref.c

index 9530df50e4dd86ae8503a17710a00ff194d9cf6b..e55cb92c52bf4304e394268995605163b768ca04 100644 (file)
@@ -3610,9 +3610,11 @@ pdf_document *pdf_document_from_fz_document(fz_context *ctx, fz_document *ptr)
        return (pdf_document *)((ptr && ptr->count_pages == pdf_count_pages_imp) ? ptr : NULL);
 }
 
-pdf_page *pdf_page_from_fz_page(fz_context *ctx, fz_page *ptr)
+pdf_page *pdf_page_from_fz_page(fz_context *ctx, fz_page *page)
 {
-       return (pdf_page *)((ptr && ptr->bound_page == (fz_page_bound_page_fn*)pdf_bound_page) ? ptr : NULL);
+       if (pdf_document_from_fz_document(ctx, page->doc))
+               return (pdf_page*) page;
+       return NULL;
 }
 
 pdf_document *pdf_specifics(fz_context *ctx, fz_document *doc)