Feature: shift for page numbers in pdf

Bug #1796902 reported by Sergey Maksimov on 2018-10-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

I need an option in ebook-convert to shift page numbers in generated pdf. I've attached patch with my changes. Is it possible to add this?

Kovid Goyal (kovid) wrote :

There is no need for this. You can use arbitrary javascript to generate page numbers, see the examples here: https://manual.calibre-ebook.com/conversion.html#converting-to-pdf

Changed in calibre:
status: New → Won't Fix

Yes, I know about that. But it will not change page numbers in table of contents. So with this script table of contents will show wrong page numbers.

Kovid Goyal (kovid) wrote :

Hmmwell in principle, OK. But you need to add the option to the GUI and the content server conversion UIs as well, nit just the command line tool. If you need pointers on that, simply grep for the name of another option to see how to implement it in those UIs. Or feel free to ask for more clarification.

OK. I will do that. Thank you.

Is this right?

Kovid Goyal (kovid) wrote :

You also need to add it to gui2/convert/pdf_output.py

Thinking about it, it would probably be better to implement this as an arbitrary expression rather than as a shift. That way one could do more sophisticated processing of the page number. For example,

--pdf-page-number-map "if (n < 3) 0 else n - 3;"

it could be implemented as a javascript expression, evaluated using evaljs for safety.

I've changed shift to expression, but I'm not sure where I need to add it to gui2/convert/pdf_output.py.

Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.

 status fixreleased

Changed in calibre:
status: Won't Fix → Fix Released

Thank you.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers