Bug 695351 - MuPDF does not evaluate page labels
Summary: MuPDF does not evaluate page labels
Status: RESOLVED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: mupdf (show other bugs)
Version: master
Hardware: PC Linux
: P4 enhancement
Assignee: MuPDF bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-04 06:13 UTC by Stefan Radermacher
Modified: 2023-02-16 15:21 UTC (History)
6 users (show)

See Also:
Customer:
Word Size: ---


Attachments
Implement page label evaluation in MuPDF (7.56 KB, patch)
2014-07-04 06:13 UTC, Stefan Radermacher
Details | Diff
Updated patch (8.46 KB, patch)
2014-07-06 10:28 UTC, Stefan Radermacher
Details | Diff
Updated patch (9.08 KB, patch)
2014-07-06 15:21 UTC, Stefan Radermacher
Details | Diff
Updated patch (9.11 KB, patch)
2014-07-11 12:33 UTC, Stefan Radermacher
Details | Diff
Here's a diff of what I've done to add support for page labels. (9.11 KB, text/plain)
2015-09-08 13:19 UTC, Albert Bloomfield
Details
Here's a diff of what I've done to add support for page labels. (19.26 KB, patch)
2015-09-09 13:01 UTC, Albert Bloomfield
Details | Diff
Patch for muPDF 1.18.0 (14.32 KB, patch)
2021-09-02 10:31 UTC, Stefan Radermacher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Radermacher 2014-07-04 06:13:58 UTC
Created attachment 11043 [details]
Implement page label evaluation in MuPDF

From PDF 1.3 on, pages in a PDF file can have labels that, if present, should be used instead of straight page numbers. MuPDF does not evaluate the PageLabels number tree in which these labels are stored in the PDF file.

I have implemented some code to facilitate this missing feature and updated mupdf-x11 to show the page label along the standard page number. (I have not added this to the various other platform viewers, as I cannot test this.)
Comment 1 Stefan Radermacher 2014-07-04 07:48:06 UTC
Note: I'm fixing up some memory leak problem and C99ism. I'll attach an updated patch later tonight.
Comment 2 Stefan Radermacher 2014-07-06 10:28:15 UTC
Created attachment 11045 [details]
Updated patch

New version of patch to fix memoriy issues and remove some C99isms.
Comment 3 Stefan Radermacher 2014-07-06 15:21:36 UTC
Created attachment 11046 [details]
Updated patch

correct patch file
Comment 4 Stefan Radermacher 2014-07-11 12:33:51 UTC
Created attachment 11054 [details]
Updated patch

Fixed a small bug that could result in all pages having "0" as the label.
Comment 5 Albert Bloomfield 2015-09-04 06:42:31 UTC
Is anyone doing anything with this?  I have fixed the code for this to work with the latest revision of the code.  I would really like an android pdf viewer that supports page labels.  I am still working on fixing it up, but I may have a patch to propose soon.  I would like to know though if there's any chance that it will get integrated.
Comment 6 Robin Watts 2015-09-04 07:58:05 UTC
We will consider all patches, as long as you're prepared to sign the Artifex Copyright Assignment stuff.

We are quite strict on style, and we won't take stuff on unless we feel it's maintainable. It also has to work nicely in a non-platform dependent way.

So, if you feel your code measures up to that, have at it! Thanks.
Comment 7 Stefan Radermacher 2015-09-04 08:01:00 UTC
FYI: When I created the original patch, I signed and sent that agreement and as directed by you made some adjustment to the code to comply with your coding standards.
Comment 8 Albert Bloomfield 2015-09-04 08:02:39 UTC
but it doesn't look like the original patch was ever integrated...
Comment 9 Robin Watts 2015-09-04 08:11:13 UTC
(In reply to Albert Bloomfield from comment #8)
> but it doesn't look like the original patch was ever integrated...

We simply may not have had time yet.
Comment 10 Albert Bloomfield 2015-09-08 13:19:16 UTC
Created attachment 11895 [details]
Here's a diff of what I've done to add support for page labels.
Comment 11 Albert Bloomfield 2015-09-08 13:20:57 UTC
I've been working on it at <https://github.com/asbloomf/mupdf> if anyone wants to look at that, or I uploaded a patch.  I would appreciate any comments or criticisms of the code and if I have time, I will try to clean it up.  But for my purposes, it seems to be working displaying the page labels correctly on Android and Windows.
Comment 12 Albert Bloomfield 2015-09-09 13:01:05 UTC
Created attachment 11897 [details]
Here's a diff of what I've done to add support for page labels.

Somehow I had uploaded the old patch that I had started from.  This is the real one.
Comment 13 Pablo Rodríguez 2017-02-19 08:32:39 UTC
I was about to report that page label aren’t used and I found this issue.

Will the updated patch be implemented or will it be another implementation for page labels?

Many thanks for your help.
Comment 14 Vinícius 2021-03-31 22:13:49 UTC
Hello.

Is there something that could be done about this?

It's been 6 years from the proposed patch and this is a nice feature for people (like me) who use koreader on e-ink devices.

Thanks in advance and if I could be of any help (don't have many technical skills but I'm a google fu master at gluing solutions together) just say it.
Comment 15 Stefan Radermacher 2021-09-02 10:31:54 UTC
Created attachment 21453 [details]
Patch for muPDF 1.18.0

In case anyone is still following this, here's a patch that adds page labels to muPDF 1.18. mupdf-x11 and mupdf-gl are updated, but no other platforms.
Comment 16 Tor Andersson 2023-02-16 15:21:12 UTC
Page Label support for PDF is available with the following two commits:

commit 9efcd63a1583339b76de524ffd12e9a85cabd267
Author: Tor Andersson <tor.andersson@artifex.com>
Date:   Mon Feb 13 12:41:18 2023 +0100

    Add page label accessor functions.

commit 0080801fd55a1cf24527cce9c8bb4eb0bb53def7
Author: Tor Andersson <tor.andersson@artifex.com>
Date:   Wed Feb 15 18:01:57 2023 +0100

    Add pdf_set_page_labels and adjust page labels on insert/delete page.