0

I created a PDF file that has multiple spaces between characters. It is that way in the PDF. But when rendered by Acrobat, it's a single space between each word. This is causing a problem with a barcode font.

PDF:

0 0 0 rg
(Before  after  two  spaces.)Tj

Any ideas why? (the PDF is at http://simba.windward.net/temp/PdfSpacing.pdf)

1
  • Using iText. Is there some kind of global setting needed to tell Acrobat don't combine spaces? Aug 24, 2012 at 0:07

2 Answers 2

1

As I see, there are TWO spaces exactly.

enter image description here

This is one space for your case (font, size, etc.)

enter image description here

The space glyph is not the 'W' letter size. It depends of designer point of view. If it absolutely necessary for you to SET the width of space as some real BIG value, you can do it in the font descriptor section as width of space character exactly.

Thank You.

8
  • Do a copy from Acrobat and a paste then to Word. It's one space. Why? Aug 24, 2012 at 2:42
  • Sorry, I'm a Mac user. I have not the Acrobat and the MSWord applications. But it is OK. I trust you, what copy/paste can transform the text. It is the Windows clipboard funny behavior. May be the developers of the Windows clipboard/word transition calls it "optimization")) For example, when I copied the text from your PDF in Chrome, Safari and Preview (native Mac applications for PDF view) and paste it in TextMate or TextEdit – I can see exactly two spaces. Aug 24, 2012 at 3:19
  • Can you copy/paste to the Notepad? Aug 24, 2012 at 3:28
  • Thank you - yes that appears to be it. And it does render correctly with the barcode font, just doesn't copy right. Aug 24, 2012 at 13:07
  • I just want to know, you are copying BARCODE as the TEXT content from the PDF file to the WORD? I mean, why it necessary to do that way? I know, how the font works, and I am not sure, what this way is really worth the time you waste for it. If you are "itext" user (pdf generator app), the better way to do the barcode job is localize the barcode generator in the external php image processor, like number->php image generator->barcode->imported image. Copy/paste of image will never change content of the barcode. Thank You! Aug 24, 2012 at 21:00
1

Your document contains 2 spaces between each word. Foxit, SumatraPDF and other PDF viewers extract the text with 2 spaces. Only Acrobat seems to perform some kind of "optimization" and merge the spaces when selecting and copying text.
When displaying the file the space between words corresponds to 2 spaces also in Acrobat, the problem appears only for copy/paste operations. This behavior in Acrobat cannot be disabled.
In what way does this affect your barcode text?

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.