Jump to content

Website links adding space after line break in exported PDF


Recommended Posts

I'm using publisher to create a newsletter which needs links to sections of a website. I'm not trying to create hyperlinks. Some of these links are long and need to be broken to go over more than one line. The links can be copied and pasted from Publisher with no issue, but once exported to PDF then copied and pasted, a space is added at the end of each line which creates a 404 error when copied to a browser. There are no hidden special characters and it does it if I use a soft return or not.
I just need text that the reader can copy and paste to go to the required page regardless of how long the url is. I've attaches a sample

Link example.pdf

Link to comment
Share on other sites

Welcome to the forums @Marielw

I’ve just tried copying the URL text from your example document (when viewing it in Firefox) and pasting it into a text editor.
I didn’t get any extra space at the end, and using Paste and Go (Firefox bar) got me to the web page as expected.

However, selecting the text and then right-clicking and trying “Go to…” caused a 404 error because at least one space was inserted into the URL (before “adelaide”).

On the other hand, I’ve just tried my own long URL text in a PDF and the URL works just fine either by clicking on it, or copy/paste-into-browser-bar, or right-click-Go.

Are you sure you didn’t add a new line separator?
Would you be able to share the original document (AFPUB) so we can look at it.

In lieu of a solution to this my recommendation would be to use a URL shortening service to create shorter URLs.

Link to comment
Share on other sites

Thanks GarryP,

The error was picked up by my proofreader so they were getting the error too. I appreciate your suggestion on using a shortened url and have added shortened versions to the document to get it resolved for now. As this is going to be an ongoing issue I'm still hoping to work out why it is doing it. I've created a mock file with examples. It occurs when I copy and past the url from the pdf into a browser.  It puts a space before adelaide.

Adding space example.afpub Adding space example.pdf

Link to comment
Share on other sites

9 minutes ago, Marielw said:

It occurs when I copy and past the url from the pdf into a browser.  It puts a space before adelaide.

For me this is Browser specific, Safari includes the space when the link is copied from the pdf and pasted into the browser resulting in the 404 error but both Firefox and Chrome seem to automatically remove the space and take you to the correct page but clicking the link in the pdf where it appears over two lines also only reads the first line and subsequently errors in all browsers...

Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5
Affinity Designer Beta 2.6.0.2861 | Affinity Photo Beta 2.6.0.2861 | Affinity Publisher Beta 2.6.0.2861

MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse
HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse

Link to comment
Share on other sites

21 minutes ago, Marielw said:

when I copy and past the url from the pdf into a browser.  It puts a space before adelaide.

Again it seems to depend on the PDF reading app. Even with your manual line break it works to me via copy/paste:

EDIT: I can confirm @Hangman's experience: Safari adds a space before the first character of the second line and thus results in an error.

Edited by thomaso

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1

Link to comment
Share on other sites

13 minutes ago, Hangman said:

but clicking the link in the pdf where it appears over two lines also only reads the first line and subsequently errors in all browsers...

What application are you using to view the PDF?

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1

Link to comment
Share on other sites

37 minutes ago, thomaso said:

It may depend on you PDF viewer app.

Yep, that appears to be the issue
I've created a pdf in Word, opened it in Chrome and there are additional spaces so neither Go To or copy/paste work

Link-Word.gif

Link-Word.pdf

Microsoft Windows 11 Home, Intel i7-1360P 2.20 GHz, 32 GB RAM, 1TB SSD, Intel Iris Xe
Affinity Photo - 24/05/20, Affinity Publisher - 06/12/20, KTM Superduke - 27/09/10

Link to comment
Share on other sites

32 minutes ago, Marielw said:

This is viewing in preview. It did the same thing on my husbands computer using Acrobat

With copy/paste I can confirm the added space character for Preview … but not for Acrobat.

Whereas when clicking the link in Acrobat it results in an error because the used URL is incomplete / contains the first line of text only, regardless of whether I click your two-line sample with or without your manual line break.

I think the workaround for possibly every PDF reader or browser would be to additionally create in Affinity a hyperlink on the entire text. Then it works with click in Preview, too, regardless of a manual line break.

v1105 hyperlink versions.pdf

pdfurlhyperlinklinebreak.jpg.b40caeda7cd56b209ec7dc24102748ae.jpg

Edited by thomaso
attachments added

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1

Link to comment
Share on other sites

18 minutes ago, walt.farrell said:

What application are you using to view the PDF?

Acrobat Reader, Foxit PDF Reader and Apple Preview all exhibit the same issue...

Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5
Affinity Designer Beta 2.6.0.2861 | Affinity Photo Beta 2.6.0.2861 | Affinity Publisher Beta 2.6.0.2861

MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse
HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse

Link to comment
Share on other sites

Well in serious papers, such over several lines wrapped URL links do optical always look strange, without any follow line break flow individual glyph indicators ...

 

url_breaks.png.62a71a1d5e99409b97537888adb48f49.png

 

Such indicators are also good usable for typing in commands which may go over several lines ...

url_breaks2.jpg.62d87a22eb7021ae6986604069a27035.jpg

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Link to comment
Share on other sites

So, after a lot of digging, I discovered something interesting, "Microsoft uses Apple's algorithm for creating "Best for printing" PDFs, but Apple's algorithm does not include processing for URLs. MS also created a "best for electronic distribution" service to handle URLs correctly, but it only works with the subset of fonts that come with Microsoft Office."

Having tested this, it only appears to work in Acrobat Reader and only when you turn off 'Create Links from URLs' in the General Preferences (which is on by default). The same PDF doesn't work in Foxit PDF Reader or PDF Studio even when 'Create Links from URLs' is disabled and it doesn't work in Apple Preview which doesn't have that preference.

Attached is a pdf file created in Microsoft Word using Times New Roman, note how Microsoft Word handles the URLs, it auto breaks words in the URL without the addition of any hard or soft returns.

If you select any of the multiline URLs from the MS Word pdf in Acrobat Reader (ensuring, 'Create Links from URLs' in the General Preferences if disabled) copy them and paste them into any browser, the URL is correctly recognised, this works in Chrome, Firefox and Safari (on Mac).

Also attached are two additional pdf files created in Apple Pages and Google Docs, note how the line breaks only fall after either a hyphen or a '/', individual words are not split across multiple lines, again, there are no hard or soft returns.

Subsequently copying the multiline URLs from either the pdf file generated in Apple Pages or Google Docs results in the loss of line-ending hyphens and the addition of line-ending spaces when pasted into a browser and a 404 error with Safari behaving differently to both Chrome and Firefox...

Original URL
https://www.theguardian.com/film/2023/aug/20/adele-exarchopoulos-actor-passages-interview-whishaw-blue-warmest-colour

How it appears in Safari
https://www.theguardian.com/film/%202023/aug/20/adele-exarchopoulosactor-%20passages-interview-whishawblue-%20warmest-colour

How it appears in Chrome and Firefox
https://www.theguardian.com/film/2023/aug/20/adele-exarchopoulosactor-passages-interview-whishawblue-warmest-colour
 

MS Word Source.pdf

Apple Pages Source.pdf

Google Docs Source.pdf

 

Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5
Affinity Designer Beta 2.6.0.2861 | Affinity Photo Beta 2.6.0.2861 | Affinity Publisher Beta 2.6.0.2861

MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse
HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.