Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 05-21-2023, 03:23 AM   #1
gonzalo_diaz
Junior Member
gonzalo_diaz began at the beginning.
 
Posts: 5
Karma: 10
Join Date: May 2023
Device: Kindle
EPUB links to PDF page numbers

Hello,

I wrote a book originally in EPUB flowable format, and now I am working on converting in to a PDF version.

At the end, the book has a custom alphabetical list of subjects. In the EPUB version, besides each item there is a link to the corresponding document and anchor, for example:

Alphabetical index

Subject A .......<a href="chapter1.xhtml#suba">Go</a>
Subject B .......<a href="chapter2.xhtml#subb">Go</a>

When converting to PDF, the "Go" hyperlinks are kept, and still point correctly to the right page. But I would like to change each Go for the actual page number resulting from the PDF conversion.

Alphabetical index

Subject A ....... page 1
Subject B ....... page 5

Is that possible? I plan to offer a printed version of the book's PDF, and the "Go" hyperlinks aren't that useful.

I see that, after the conversion from EPUB to PDF, Calibre "knows" the right page numbers, and stores them in anchors that look like, for example

<a href="#p20"></a>

But you can't specify that in the original EPUB to PDF Search & Replace page.

You can take the resulting PDF and do a second PDF to PDF conversion, in which you can do a regex replacement of the resulting of these <a href="#p20"> ... tags, but that type of conversion destroys the books format.

So, is there any wey to achieve this "link to page number" effect in one step?

I am pretty good with programming, HTML and JavaScript.
Thanks in advance for any comment or answer.
gonzalo_diaz is offline   Reply With Quote
Old 05-21-2023, 12:21 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,881
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No not directly. You can have calibre insert a table of contents at the end of the pdf with page numbers specifically for print. See the relevant option under the PDF Output section of the conversion dialog. However there is no facility for calibre to replace link text with the page number of the link target.
kovidgoyal is offline   Reply With Quote
Old 05-21-2023, 12:59 PM   #3
gonzalo_diaz
Junior Member
gonzalo_diaz began at the beginning.
 
Posts: 5
Karma: 10
Join Date: May 2023
Device: Kindle
OK, thanks for the answer.
gonzalo_diaz is offline   Reply With Quote
Old 05-21-2023, 05:38 PM   #4
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,190
Karma: 85874891
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
If you want publication quality PDF:
Export the epub (docx or if a problem use RTF) and edit in Word or LO Writer. Add page styles, header, footer, page numbers, contents, index etc.

If using Writer:
import the docx or RTF
Save As odt
Edit/save cycle only in odt
Export PDF direct from Writer.

If using Writer to make a PDF, then you do an extra Save As in docx as Calibre works better with docx than odt. Also don't user Writer2epub plugin (Writer 5.x) or built in epub export (later LO Writers) as Calibre is far better.

Last edited by Quoth; 05-21-2023 at 05:40 PM.
Quoth is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
epub to pdf - no page numbers on first pages berchas Conversion 3 05-03-2023 11:39 AM
Page numbers in Epub->PDF conversion ghmerrill Conversion 13 12-03-2020 09:44 AM
pdf (with page numbers) to epub crill Workshop 13 01-12-2019 09:13 AM
Removing page footers and numbers [PDF 2 EPUB] Radium Conversion 7 06-15-2014 08:36 AM
calibre EPUB->PDF: page numbers in printed TOC? dancal Conversion 13 06-13-2013 08:32 PM


All times are GMT -4. The time now is 09:10 PM.


MobileRead.com is a privately owned, operated and funded community.