Forum Bugs

When a link wraps across pages it breaks

ThePrintingSquirrel
When a text URL wraps across pages in a PDF, it breaks:

– The first segment is still linked, but the clickable URL is truncated to match only the segment that's on the first page.

– The second segment which is on the next page is not linked or clickable.
The text is styled with "word-wrap: break-word;" to fit long links into the column width.

Example:
Given the link is "http://www.example.com/some/link/goes/here.html", and assuming it wraps across pages like this:
First page: "http://www.example.com/some/"
Second page: "link/goes/here.html"

=> "http://www.example.com/some/" is clickable and links to http://www.example.com/some/.
=> "link/goes/here.html" is not clickable and doesn't link to anything.

Is this a known bug?
mikeday
Is it actually an <a href=""> element or just the text? Because some PDF viewers attempt to make text that looks like URLs clickable, and they will not realise that it continues on the next page.
ThePrintingSquirrel
It is both. It's in the reference section of an article:

"Available at <http://www.example.com/some/link/goes/here.html>."

With the link bit linked to the same URL with an anchor tag.
ThePrintingSquirrel
After a bit of research in the Adobe forums this seems to be a known issue.
Various fixes have been suggested, all suggesting to fix it in the authoring software (e.g. InDesign) prior to converting to PDF.
Since I'm creating the PDFs with Prince, I have no such option.

There is an option in Adobe Acrobat though: Preferences > General > Create links from URL, which is enabled by default. Does Prince emulate a similar setting?

EDIT: Only links that didn't have a proper anchor tag were affected by this issue. It is related to Adobe's buggy auto-detection of links: if there is a CRLF character it will stop parsing the link and use what it parsed so far.

Solution 1: Turn off the "Create links from URL" option and re-run your conversion with Prince.

Solution 2: Always wrap links in proper anchor tags. That way, Adobe won't try to auto-detect them and they properly wrap across lines.

Edited by ThePrintingSquirrel

mikeday
Right, wrapping URLs as actual links is the best option; technically I suppose this could be done with JavaScript if it's not convenient to modify the original markup.
ThePrintingSquirrel
Hi Mike,
that's what I ended up doing – wrapping an anchor tag around the textual links.
ricardopressbooks
Hey there!
we have a similar issue. When we have a link and it's long enough to breaks the link in two rows (see the attached screenshot), only the first row is linked, and also the link is incompleted.
Example:
<a href="https://pressbooks.test/iamalongurlforthisinteractivecontentbook?p=19#oembed-1">
https://pressbooks.test/iamalongurlforthisinteractivecontentbook?p=19#oembed-1
</a>

In a particular case with particular style it will render the link in 2 rows, as:
https://pressbooks.test/ <-- this row links to https://pressbooks.test/
iamalongurlforthisinteractivecontentbook?p=19#oembed-1 <-- this row is not clickeable
  1. Screenshot from 2021-11-17 12-26-12.png13.4 kB
    Link in 2 rows
mikeday
That sounds like it's not actually a link at all, can you please compare with the attached HTML and PDF which works fine.
  1. link.html0.2 kB
  2. link.pdf23.8 kB