InDesign kerning and tracking converted to white space when exporting to PDF

Participant ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

We're working in a catalog that needs these kind of notation for product references:

 

12345 JJ 67 BB 890

 

We represent a product code inserting "fake" white space by using a GREP style that changes the tranking values of the character before the white space, and sets it to 500. This way, if you select a code in InDesign and paste it in, say, a web browser, it pastes the code WITHOUT white spaces, like this:

 

12345JJ67BB890

 

BUT if you export the document to PDF, the "fake" white space is converted to a "real" white space! So, if you try to search a code by typing "12345JJ67BB890" in the search field of Acrobat, it finds nothing. Becasue it really has a code with white spaces. You need to type it like this: "12345 JJ 67 BB 890". The same hapens if you want to copy a code from the PDF and search for it in the company product page: it finds nothing.

 

The question is: how can we "avoid" the creation of a white space when using tranking values upon PDF creation? Or maybe it's a defect of the rendering process (I understand a PDF is a PostScript file, and that PostScript is so old that it need a real white space to asign a width value...) that adds a real white space in order to represent it in a PDF viewer?

TOPICS
Import and export , Type

Views

239

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Adobe Community Professional , May 17, 2022 May 17, 2022
I have to add to my sample: If I open the PDF with Adobe Reader on Windows 10 and copy the text to the clipboard only the first line does contain no blank characters. All other lines below do. Download my PDF and INDD file from my Dropbox: https://www.dropbox.com/s/rkapdcejz442ood/220517-1-ProductKeysWithTracking.zip?dl=1 Regards, Uwe Laubender ( ACP )

Likes

Translate

Translate
Adobe Community Professional , May 18, 2022 May 18, 2022
"Sad news: it's not an InDesign fault. Same results using kerning settings in Microsoft Word and exporting to PDF. So I suspect its a PDF "feature". Also using any PDF reader app other than Acrobat gives same results. Conclusion: there is no way to avoid the creation of white space characters when using certain tracking values in ANY application. " Hi Javier, as you can see from my screenshot from my reply above in Acrobat Pro PDF technology is encoding tracked or kerned text like th...

Likes

Translate

Translate
Adobe Community Professional ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

I'm sure you know your project and needs and what works for you, but my first impression is that you are overthinking/overworking this step, maybe from a chain of "correcting corrections" that's so easy to get into.

 

I don't think I've ever had tracking/spacing issues in PDF export from ID, and I've done many complex catalog/datasheet/product list sorts of documents. All things being equal, your layout in ID should appear almost exactly the same in PDF.

 

If from a clean, un-tweaked layout (turn off the GREP styles, etc.) you don't get an acceptable spacing for those product numbers in both ID and PDF, it may be a font issue, or a choice of metric/optical tracking, or something more fundamental than hard spacing between characters.

 

I'd suggest a little experimentation from a new, clean layout to validate the minimum amount of 'fixing' needed to get the desired layout in PDF. Try similar/replacement fonts as well.

 

|| Word & InDesign to Kindle (& EPUB): a Professional Guide (Amazon)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

Thanks for the reply, James. But yes, the final design is exactly what the client expects and wants, so no problem with this. Also, in InDesign, if you search a product code with a search string without white spaces, like this: "12345jj67BB890" it correctly finds the product code.

Problem is, same document, exported to PDF, does NOT find anything with the text "12345jj67BB890", you need to manually insert white spaces to find the code... So, InDesign is creating white spaces when exporting to PDF (or Acrobat and other PDF readers do not support kerning/tracking without the creating of white space characters)

 

The client wants white spaces for presentation purposes (their customers know the meaning of each group of characters, hence the design easies the reading of them, like when you type a phone number or bank account number), but their ERP uses the correct codes without white spaces.

We thought the inclusion of tracking was the best solution: it adds a visual separation that enhances code comprehension but does not create white spaces, so you still can find the correct serial number typing it as is. It works like a charm inside InDesign but no way to make it work when exporting to PDF.

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

Never mind! The method I posted (or something a lot like it!) worked ten years ago, but not any longer.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

Screen Shot 2022-05-17 at 12.06.25 PM.png

I'm not having the same experience. I just created a similar document (manually adding either tracking value, or kerning value), and it works just fine in my PDF.

If I search for JJ67 In Acrobat, it selects the entire word perfectly. My PDF is not treating the "gaps" as spaces.

So I wonder what's different about yours. Try this: When you open your PDF in Illustrator, has the "gap" become an actual space? or has it been broken up into chunks? or is it honouring the tracking? In my case, it's honouring the tracking.

Can you post a sample?

Screen Shot 2022-05-17 at 12.01.53 PM.png

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

"The question is: how can we "avoid" the creation of a white space when using tranking values upon PDF creation? Or maybe it's a defect of the rendering process (I understand a PDF is a PostScript file, and that PostScript is so old that it need a real white space to asign a width value...) that adds a real white space in order to represent it in a PDF viewer?"

 

Hi Javier,

PDFs are exported like that. You want the white space visible, the PDF is showing the white space. It does not insert any white space characters that are not typed, I think. It's building strings of characters with the same formatting and it gives an instruction for the renderer and other internal functions of the reader to start the rendering at a given point.

 

If you now copy text of a product reference instance from the PDF, the PDF reading software is or could be intelligent enough to automatically substitute the horizontal difference from one character to another with a white space character. Even if the string of characters technically has no white space character at all. I see this also with large tracking values applied to text in inDesign.

 

You can dive deep into the PDF to show this using Acrobat Pro and its Preflight tools.

Go to Print Production > Preflight > Options > Browse Internal PDF Structure…

and inspect the Contents stream of a given page.

 

Here one sample where I set your sample product reference in different ways.

Top line without any white space character.

Below using white space characters.

Next line with tracking 200 on some of the characters.

Bottom line with tracking 300 on the same characters.

 

InDesign-TypesettingWithTracking.PNG

 

The same document page exported to PDF/X-4, opened in Acrobat Pro and inspected with Preflight.

I did the yellow marking in PhotoShop so that you can easily see where the PDFs code is using positioning data and where it does real white space characters:

 

AcrobatPro-ContentsStream-EDITED.png

 

When I search after 12345JJ67BB890 in Adobe Reader only the first line will be found.

The second line would be very unlikely because of the real white space characters.

The bottom lines, well, the algorithm does not find them even if there are no white space characters at all.

 

My guess: the reading mechanism tries to make sense of the contents stream by sometimes guessing white space and line breaks. Even sometimes guessing the flow of whole paragraphs. You may ask what can be done about that in the Acrobat forum:

https://community.adobe.com/t5/acrobat/ct-p/ct-acrobat?page=1&sort=latest_replies&lang=all&tabid=all

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

I have to add to my sample:

 

If I open the PDF with Adobe Reader on Windows 10 and copy the text to the clipboard only the first line does contain no blank characters. All other lines below do.

 

Download my PDF and INDD file from my Dropbox:

https://www.dropbox.com/s/rkapdcejz442ood/220517-1-ProductKeysWithTracking.zip?dl=1

 

Regards,
Uwe Laubender

( ACP )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

Sad news: it's not an InDesign fault. Same results using kerning settings in Microsoft Word and exporting to PDF. So I suspect its a PDF "feature".

Also using any PDF reader app other than Acrobat gives same results. Conclusion: there is no way to avoid the creation of white space characters when using certain tracking values in ANY application. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

"We thought the inclusion of tracking was the best solution: it adds a visual separation that enhances code comprehension but does not create white spaces, so you still can find the correct serial number typing it as is. It works like a charm inside InDesign but no way to make it work when exporting to PDF.

 

Hi Javier,

then I would suggest to do two versions of the document.

One PDF for print where the serial numbers have the tracking values and one for the web or for other internal uses where the tracking is not present.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

"Sad news: it's not an InDesign fault. Same results using kerning settings in Microsoft Word and exporting to PDF. So I suspect its a PDF "feature".

Also using any PDF reader app other than Acrobat gives same results. Conclusion: there is no way to avoid the creation of white space characters when using certain tracking values in ANY application. "

Hi Javier,

as you can see from my screenshot from my reply above in Acrobat Pro PDF technology is encoding tracked or kerned text like that. What I wonder if there is a difference if we enable the option [ x ] Create Tagged PDF with PDF export.

This option is turned off by default with the [PDF/X-4:2008] export preset for example.

 

From my German InDesign 2022:

TagPDF-Enabled-Works-AdobeReader.PNG

 

And indeed, when I open the exported PDF with Adobe Reader and copy/paste the text to my text editor the result is different. All lines with the exception of the one where I typed blanks in InDesign do not contain any blanks:

 

AdobeReader-Copy-Paste-AllText-in-Tagged-PDF.png

 

Result of pasted text in the Editor app of my Windows 10 machine:

Esditor-Pasted-AllText-from-Tagged-PDF.png

 

Finding the product keys in Adobe Reader is no issue anymore:

AdobeReader-AllProductKeysFound-in-Tagged-PDF.png

 

Download my tagged PDF/X-4 from my Dropbox account:

https://www.dropbox.com/s/xty4kgyx56ylrdw/ProductKeysWithTracking-2-TagsEnabled.pdf?dl=1

 

That's it, I think. Just enable Create Tagged PDF in your PDF export.

 

Well, let's see, you need a custom PDF Export preset for this, because only one of the generic ones with names in brackets has this option enabled, and that's [High Quality Printing] ([Qualitativ hochwertiger Druck] in my German version of InDesign). But I would not recommend this one for serious printing purposes.

 

Regards,
Uwe Laubender

( ACP )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

Printing won't need search capability. It is yet another point to be managed, but using a custom export with Tagged content for electronic/distribution PDFs and a standard setting for (commercial) print is easy enough.

 

Good catch on this point, but I am still baffled how/that it occurs!

 

|| Word & InDesign to Kindle (& EPUB): a Professional Guide (Amazon)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

Works! Only with Adobe Reader (or Adobe Acrobat) but that's a huge step in the right direction!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 19, 2022 May 19, 2022

Copy link to clipboard

Copied

LATEST

Hi Javier,

see and test my suggestions I posted today.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

I have come to the same conclusion as Uwe.

It is not InDesign. It's Acrobat's re-interpretation of the content based on what it "sees". It sees spaces.

HOWEVER, If you check "Tagged", it will work. BUT ONLY IN ACROBAT. If you use a different viewer, it may not work.

In my example, I added a line where the entire thing was tracked excessively. I exported Postscript from the file and there are NO spaces in there except where you purposefully placed them in Line 2. The resulting PDF is also fine, there are no spaces in the PDF code. It's purely how the VIEWER interprets it.

In my example below, the first image is a Tagged PDF viewed in Acrobat, searching for BB890. It properly returns everything except the 2nd line.

The second example is the same file opened in Mac Preview; It only picks up the result from the first and last line.

As far as what you can do to make this work the way you want, I don't have any concrete ideas right now, outside of some sort of visual separation, like different text colours for each part of the number.

Screen Shot 2022-05-18 at 11.06.12 AM.png

Screen Shot 2022-05-18 at 11.05.00 AM.png

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

That's truly bizarre behavior. The only place I've seen anything like it is in Kindle, which treats dashes as "optional spaces" in searches.

 

|| Word & InDesign to Kindle (& EPUB): a Professional Guide (Amazon)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

Brad said: "It's purely how the VIEWER interprets it."

 

Exactly!

If I open my tagged PDF in the PDF viewer of my Firefox browser on Windows 10 and copy/paste text from it there are always blank characters in the result when a specific amount of tracking is applied.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

Javier said:

"Also using any PDF reader app other than Acrobat gives same results. Conclusion: there is no way to avoid the creation of white space characters when using certain tracking values in ANY application. ""

 

Hi Javier,

well, that is definitely true.

Any PDF viewing application will not fit your needs.

We now have a way that is working with Adobe Reader or Acrobat Pro DC.

On Windows and on MacOS.

 

Regards,
Uwe Laubender

( ACP )

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

Late thought: would it be too clumsy to double up the number: one visible with the tracking-spacing the client wants, followed by a 'hidden' number with no spacing or tracking, but colored None or White so it's invisible? And given a very small font size? The search would be a little odd in that it would select what looks like a tiny block next to the number, but that could be tweaked, and hitting Ctrl-C would still copy the right number.

 

|| Word & InDesign to Kindle (& EPUB): a Professional Guide (Amazon)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

That was very much like the idea that I posted, and then edited to retract. Back in ye olden days (circa Acrobat 5, maybe? Forever ago, in any case) I did this by editing the PDF after generation and adding tracking. However, when I tried it in Acrobat DC today, it worked.... until I saved the document. At which point, I'd copy the text and paste it, and the tracking was interpreted as spaces when I pasted into Notepad. 

 

I feel there must be some kind of hack that would make this work, but I haven't the foggiest idea what it is. 

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 19, 2022 May 19, 2022

Copy link to clipboard

Copied

Hi Javier and Joel,

hm, after some more tests I think, that I have two solutions.

The second one is the technical "cleaner" one, but it not very flexible.

Depending on the amount of used fonts it could be also costly.

 

Suggestion 1:

[ 1 ] Convert the text with the tracked characters to outlines

[ 2 ] Stacked below the editable text with no tracking and blanks.

Fill color: 1% Yellow.

Width of the characters changed so the width is the same as the tracked and outlined characters.

 

Here with fill color 100% Yellow so that you can see the setup:

 

ProductKeysWithTracking-3-InDesignSetup.PNG

 

Exported PDF with PDF Tags enabled:

https://www.dropbox.com/s/3dc16maxwsyuooi/ProductKeysWithTracking-3-TagsEnabled.pdf?dl=1

 

With this kind of PDF I can select all the text on page 1 and copy/paste it to my text editor without white spaces. Also with the PDF viewer in my Firefox browser. Test with other PDF viewing apps. *

 

Suggestion 2:

Have a specical font for the tracked numbers and characters where all the character have a very wide side bearing on the right of the character. So technically spoken there is no tracking and no white space. Apply the font with a GREP style; just like you apply the tracking right now.

 

You could build such a font e.g. out of InDesign with the IndyFont script written by Jongware and Marc Autret:

https://www.indiscripts.com/category/projects/IndyFont

 

Of course also check the EULA of your fonts if you are allowed to do this.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

 

 

* EDITED

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 19, 2022 May 19, 2022

Copy link to clipboard

Copied

Some screenshots showing Firefox, Chrome and Edge browser with the PDF open and the result after I copied the selected text to my editor on Windows 10:

 

ProductKeysWithTracking-3-PDF-in-Firefox-Browser.PNG

 

ProductKeysWithTracking-3-PDF-in-Chrome-Browser.PNG

 

ProductKeysWithTracking-3-PDF-in-Edge-Browser.PNG

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines