Feature: shift for page numbers in pdf

Bug #1796902 reported by Sergey Maksimov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
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?

Revision history for this message
Sergey Maksimov (sergeymaksimov) wrote :
Revision history for this message
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
Revision history for this message
Sergey Maksimov (sergeymaksimov) wrote :

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.

Revision history for this message
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.

Revision history for this message
Sergey Maksimov (sergeymaksimov) wrote :

OK. I will do that. Thank you.

Revision history for this message
Sergey Maksimov (sergeymaksimov) wrote :

Is this right?

Revision history for this message
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.

Revision history for this message
Sergey Maksimov (sergeymaksimov) wrote :

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

Revision history for this message
Kovid Goyal (kovid) wrote : Fixed in master

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
Revision history for this message
Sergey Maksimov (sergeymaksimov) wrote :

Thank you.

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.