Jump to content
You must now use your email address to sign in [click for more info] ×

Text has no spaces between words in the PDF when opened in other apps


tudor

Recommended Posts

When opening a PDF exported from Affinity using other apps, the space characters are all gone. They are rendered visually by increasing the spacing ("tracking") between last/first characters of each word.

I was able to replicate this bug by opening an Affinity PDF in Illustrator, Inkscape, CorelDraw, and Sketch, all on macOS. I've had this issue only with PDFs generated by Affinity, so it's definitely an issue with the Affinity apps and/or PDFlib.

This issue is important because it affects the way we can exchange files with people who don't use Affinity apps. Until now, opening an Affinity PDF in other apps seemed like a good enough solution whenever I needed to convert an .afdesign file to .ai or something else. This bug makes it very difficult to exchange files containing more than a few sentences of text, without manually reformatting the text.

Please fix it.

Link to comment
Share on other sites

27 minutes ago, Pauls said:

try disabling font subsetting when generating the PDF's.

Disabling font subsetting did not help. I've attached the afpub file I used for testing. It contains one sentence typed using Arial.

Here is a screenshot showing the issue when opening the Affinity PDF in Adobe Illustrator. I added the first line of text in Illustrator, to show the true spaces vs. fake ones.

image.thumb.png.2955a3eaeba628cb6b9de2dad598cc81.png

affinity space issue.afpub

Link to comment
Share on other sites

Could this just be an export settings issue? I opened your afpub file, exported it to PDF, and opened the file in Adobe Acrobat and Apple Preview. Both apps had spaces between the words.

test.pdf

Could you please share screenshots of your export to pdf settings?

Thanks

image.thumb.png.f61fc15dc7152d12a72fa63e9820c410.png

Download a free manual for Publisher 2.4 from this forum - expanded 300-page PDF

My system: Affinity 2.4.0 for macOS Sonoma 14.3.1, MacBook Pro 14" (M1 Pro)

Link to comment
Share on other sites

1 minute ago, MikeTO said:

If the other app removes the spaces then the problem is with their interpretation of the PDF.

This happens only with PDFs generated by Affinity apps. It's hard to believe that the four editing apps I tried, made by four different companies (one of them being Adobe) all have the same bug.

Link to comment
Share on other sites

FWIW, I've searched the internet and found similar issues affecting various other applications that generate PDFs (not related to Affinity). In one discussion someone said this:

"I had a long chat session with the Adobe help team yesterday.
 It seems that the problem arises when a document created in some other editor is saved as PDF this problem can arise resulting in spaces not appearing to be standard ones under ISO (or ASCII 32)."

Link to comment
Share on other sites

3 minutes ago, tudor said:

 It seems that the problem arises when a document created in some other editor is saved as PDF this problem can arise resulting in spaces not appearing to be standard ones under ISO (or ASCII 32)."

Apple Preview and Adobe Acrobat Reader both interpret the Affinity PDF spaces as U+0020 which are regular spaces, the same as ASCII 32. I also opened an Affinity PDF in PDF Expert and was able to edit it without problems, the spaces were interpreted as U+0020.

If Apple Preview, Adobe Acrobat Reader, and PDF Expert can do this then Illustrator can do the same and the problem is with Illustrator. I know Adobe created the PDF format but PDF was intended for presentation and not editing and interpreting the text in a PDF to make it editable can be done in different ways. Tight tracking, word spacing, and leading can cause apps to make interpretation mistakes which is why Affinity includes a PDF import option to favour editable text at the cost of layout fidelity, which changes the judgments Affinity makes about the text. Illustrator lacks options to change its interpretation.

Download a free manual for Publisher 2.4 from this forum - expanded 300-page PDF

My system: Affinity 2.4.0 for macOS Sonoma 14.3.1, MacBook Pro 14" (M1 Pro)

Link to comment
Share on other sites

Tried it too…

I've got the spaces with :

- PDF Toolkit+

- PDF to text

- PDFify

- PDF OCR X Community Edition

image.jpeg.00e8b0a74cf255acc37bbbe47db411d8.jpeg

But I don't with :

- Vectornator

image.jpeg.f62572bc0ee254e8344d76e307db25af.jpeg

- QuarkXpress : Once converted, no spaces characters, but look at the 55,6…

image.png.07d1061af1fa53c181f4cb9d4e58ff61.png

MacBook Pro 16 pouces (3456 × 2234), 2021 / Apple M1 Pro / 16 Go / macOS Ventura Version 13.4.1 (22F82)
+ 31,5 pouces (2560 × 1440) + 27 pouces (1080 × 1920) + iPad (8th generation) / iPadOS 17.2 + Apple Pencil + 

Macmini6,2 Quad-Core Intel Core i7 16 Go / macOS Catalina version 10.15.7 (19H2026)
MacBookAir6,2 Intel Core i5 double cœur 4 Go / macOS Big Sur version 11.7.7 (20G1345)

Licence Universelle Affinity V2 updated to 2.3.0

Link to comment
Share on other sites

20 minutes ago, tudor said:

This article seems to explain the space issues in PDFs:

https://blog.idrsolutions.com/how-are-text-spaces-created-in-a-pdf-file/

This problem arises because a page layout program like Affinity is creating a PDF for printing and viewing accuracy, not for editing. PDF is a presentation format, not a file exchange format, so you won't always get perfect results and some programs are better at it than others. Just because Illustrator can't open it properly doesn't mean Affinity is doing anything incorrectly.

Download PDF Expert (there's a free version) and you'll be able to open the file for editing without problems. You could resave from it and then try to edit it in Illustrator.

Download a free manual for Publisher 2.4 from this forum - expanded 300-page PDF

My system: Affinity 2.4.0 for macOS Sonoma 14.3.1, MacBook Pro 14" (M1 Pro)

Link to comment
Share on other sites

Yes, I agree @MikeTO, it depends of the app that opens the file.

We could call it a PDF format bug…

Same goes with diacritics characters, sometimes strangely coded with 2 signs, often in PDF files built via US or UK machines…

MacBook Pro 16 pouces (3456 × 2234), 2021 / Apple M1 Pro / 16 Go / macOS Ventura Version 13.4.1 (22F82)
+ 31,5 pouces (2560 × 1440) + 27 pouces (1080 × 1920) + iPad (8th generation) / iPadOS 17.2 + Apple Pencil + 

Macmini6,2 Quad-Core Intel Core i7 16 Go / macOS Catalina version 10.15.7 (19H2026)
MacBookAir6,2 Intel Core i5 double cœur 4 Go / macOS Big Sur version 11.7.7 (20G1345)

Licence Universelle Affinity V2 updated to 2.3.0

Link to comment
Share on other sites

17 minutes ago, MikeTO said:

Just because Illustrator can't open it properly doesn't mean Affinity is doing anything incorrectly.

But it means that I can't use the PDF workaround to exchange files with users of other design apps, and eventually that's going to stop me from using Affinity apps altogether. Affinity could investigate and try fixing this or not, it's their choice.

Link to comment
Share on other sites

PDF is never going to be a perfect format for exchanging files with Adobe users. I would far rather that Affinity produce PDFs that print exactly as I created them than create imperfect PDFs that are more editable in Illustrator.

Download a free manual for Publisher 2.4 from this forum - expanded 300-page PDF

My system: Affinity 2.4.0 for macOS Sonoma 14.3.1, MacBook Pro 14" (M1 Pro)

Link to comment
Share on other sites

What I'd like to compare is the PDF created on a windows machine and the PDF created on a macOS machine…

Both out of Affinity, with the same options.

Are the PDFs identical ?

MacBook Pro 16 pouces (3456 × 2234), 2021 / Apple M1 Pro / 16 Go / macOS Ventura Version 13.4.1 (22F82)
+ 31,5 pouces (2560 × 1440) + 27 pouces (1080 × 1920) + iPad (8th generation) / iPadOS 17.2 + Apple Pencil + 

Macmini6,2 Quad-Core Intel Core i7 16 Go / macOS Catalina version 10.15.7 (19H2026)
MacBookAir6,2 Intel Core i5 double cœur 4 Go / macOS Big Sur version 11.7.7 (20G1345)

Licence Universelle Affinity V2 updated to 2.3.0

Link to comment
Share on other sites

On 2/17/2023 at 6:29 AM, MikeW said:

The Affinity pdf does not have the spaces encoded.

Compare the two font reports attached.

Mike

Font report for test.pdf 30.66 kB · 12 downloads Font report for x-test.pdf 19.46 kB · 7 downloads

Nice reports - I want it! (the app)

I extracted the embedded font (a bit more low tech) from the test.pdf - and there is no space character in the font.
Made the same doc in LibeOffice, exported to PDF, extracted the font - has a space character.

When using Remap Characters in InFix or FlexiPDF - there is no space character to remap (not in the embedded font).

Looking at the actual code in the PDF you can see the added whitespace (not a character).
 

/GS0 gs
/GS1 gs
q
  1 0 0 1 118.431 436.371 cm
  0 0 0 1 k
  BT
    /F0 19 Tf
    0 0 Td
    [ 
    (\000\001) 0.2 (\000\002) -0.2 (\000\003) -278                                     The
    (\000\004) -0.2 (\000\005) -0.2 (\000\006) -0.2 (\000\007\000\010) -277.8          quick
    (\000\011) -0.2 (\000\012) -0.1 (\000\013) -0.2 (\000\014) -0.2 (\000\015) -278    brown
    (\000\016) 0.2 (\000\013) -0.2 (\000\017) -277.8                                   fox
    (\000\020) -0.2 (\000\005) -0.2 (\000\021) -0.1 (\000\022) -0.2 (\000\023) -277.8  jumps
    (\000\013) -0.2 (\000\024\000\003) -0.2 (\000\012) -277.8                          over
    (\000\025) 0.2 (\000\002) -0.2 (\000\003) -278                                     the
    (\000\026) -0.2 (\000\027) -0.2 (\000\030\000\031) -277.8                          lazy
    (\000\032) -0.2 (\000\013) -0.2 (\000\033) -0.2                                    dog
    ] TJ
  ET
Q

I added line breaks and the corresponding text on the right for clarity.
The character references are in the parentheses (ref to the cmap).
The "-278" is the whitespace after the "The".
@tudor - note how that "278" corresponds to your image in your second post above.
Each of the 27x numbers are whitespace gaps.

All PDF editors are guessing at where to put actual spaces when they are not actually encoded.
Some are better than others at this guessing.
And justified text, and kerning, and tracking adjustments make the guessing harder.

Affinity could make this easier by including actual spaces.

 

Link to comment
Share on other sites

  • 2 weeks later...
  • Staff

I have discussed this matter with the developer involved, who says that despite the PDF Affinity exports having no actual spaces, that most applications reinterpret the spaces between characters that we output as spaces and disguise this as spaces seem to reappear in those applications. HOWEVER in the next beta we are making an attempt to change this and will start exporting spaces and tabs as such (if the font supports a fixed space). Once our next beta is released you could see if this change has improved things for you

Patrick Connor
Serif Europe Ltd

"There is nothing noble in being superior to your fellow man. True nobility lies in being superior to your previous self."  W. L. Sheldon

 

Link to comment
Share on other sites

  • Staff

The issue "PDF export does not output spaces" (REF: AFB-7405) has been fixed by the developers in internal build "2.1.0.1720".
This fix should soon be available as a customer beta and is planned for inclusion in the next customer release.
Customer beta builds are announced here and you can participate by following these instructions.
If you still experience this problem once you are using that build version (or later) please reply to this thread including @Serif Info Bot to notify us.

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.