how to globally replace font in a PDF
Asked Answered
H

3

12

Is it possible, using Adobe Acrobat or another tool, to globally replace a font in a PDF?

How can I do this?

Harsho answered 17/7, 2013 at 1:11 Comment(0)
J
6

Without seeing your particular file it is hard to say that this would definitely work. But, typically a font is defined like this:

/Resources << 
  /Font << /F13 1 0 R >> 
>>

1 0 obj << 
  /Type /Font
  /Subtype /Type1 
  /BaseFont /Helvetica
>> endobj

The font resource is then used as /F13 12 Tf wherever text is drawn with it.

If you were to change the /BaseFont in the definition, it would affect all uses of that font resource.

Joijoice answered 17/7, 2013 at 1:21 Comment(1)
For the people who doesn't undertand this. It's what shows in an hex editor. I changed the font i.e.:/Arial->/OpenSans and that changed file size, and when i opened it in Nitro Pro it says it was corrupted, but fortunately it repaired it.Spiritual
D
7

Replacing a font in a PDF is generally not a good idea. You should not expect behavior similar to replacing a font in e.g. a MS Word document. In PDF, individual glyphs or runs of glyphs are positioned absolutely. At the time the PDF was generated, this positioning was based on the respective widths (and other metrics) of the glyphs in the used font. When you replace a font, the position of the glyphs will remain unchanged, but in general the widths of the glyphs will differ from those in the original font. This will cause distorted text formatting like this:

enter image description here

Dezhnev answered 17/7, 2013 at 15:29 Comment(1)
This is certainly true, but not an answer to the question. There are legitimate reasons why one would want to replace a font (e.g. replacing a font with an updated/modified version or with a clone that has the same font metrics).Tayyebeb
J
6

Without seeing your particular file it is hard to say that this would definitely work. But, typically a font is defined like this:

/Resources << 
  /Font << /F13 1 0 R >> 
>>

1 0 obj << 
  /Type /Font
  /Subtype /Type1 
  /BaseFont /Helvetica
>> endobj

The font resource is then used as /F13 12 Tf wherever text is drawn with it.

If you were to change the /BaseFont in the definition, it would affect all uses of that font resource.

Joijoice answered 17/7, 2013 at 1:21 Comment(1)
For the people who doesn't undertand this. It's what shows in an hex editor. I changed the font i.e.:/Arial->/OpenSans and that changed file size, and when i opened it in Nitro Pro it says it was corrupted, but fortunately it repaired it.Spiritual
P
2

You can upload a PDF to Google Drive, and then open it. Once opened, you'll see the option to "Open in Google Docs": click it.

After it's done loading, select all text (CTRL+A), and then change the font on the menu above to the one you want. After that's done, you can do File -> Download -> PDF. Google Docs will do its magick, and give you a PDF with the modified font. New pages will be automatically added if the fonts are different sizes.

Phallicism answered 6/10, 2020 at 23:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.