Font naming in created PDF confuses Illustrator #3088
-
When using this syntax: the created PDF (minimized_u.pdf, uncompressed with pdftk) validates correctly with Acrobat Preflight, and is visually correct when viewed with eg. Acrobat. minimized_u.pdf includes for example the following font names: These rows are manually changed to the below in minimized_in_AI.pdf, which is opened without any error by Illustrator Illustrator message when opening the file: Our workaround is to uncompress the PDF file with pdftk and replace needed strings as described. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 15 replies
-
Well, the font name in use is like the font's self identification: a string stored inside the font binary. I noticed that when you insert a font to a page, you are using a very long |
Beta Was this translation helpful? Give feedback.
-
Sure: Take the font file and make a for item in page.get_fonts():
xref = item[0]
if item[1]=="n/a": # non-embedded font
continue
print()
print(item)
ff = doc.extract_font(xref)
buff = ff[-1]
font = fitz.Font(fontbuffer=buff)
print(f"{font.name=}")
(12, 'ttf', 'TrueType', 'FNUUTH+Calibri-Bold', 'R8', '')
font.name='Calibri Bold'
(13, 'ttf', 'TrueType', 'DOKBTG+Calibri', 'R10', '')
font.name='Calibri Regular'
(14, 'ttf', 'TrueType', 'NOHSJV+Calibri-Light', 'R12', '')
font.name='Calibri Light'
(15, 'ttf', 'TrueType', 'NZNDCL+CourierNewPSMT', 'R14', '')
font.name='Courier New Regular'
(16, 'ttf', 'Type0', 'MNCSJY+SymbolMT', 'R17', 'Identity-H')
font.name='(null)'
(17, 'cff', 'Type1', 'UAEUYH+Helvetica', 'R20', 'WinAnsiEncoding')
font.name='Nimbus Sans L Regular'
(18, 'ttf', 'Type0', 'ECPLRU+Calibri', 'R23', 'Identity-H')
font.name='(null)'
(19, 'ttf', 'Type0', 'TONAYT+CourierNewPSMT', 'R27', 'Identity-H')
font.name='(null)' As you can see, not every font has a name for itself. doc=fitz.open("adobe-2008.pdf")
page=doc[0]
for item in page.get_fonts():
if item[1] == "n/a":
continue
xref = item[0]
ff = doc.extract_font(xref)
buff = ff[-1]
font = fitz.Font(fontbuffer=buff)
print()
print(item)
print(f"{font.name=}")
(14, 'cff', 'Type1', 'DDPEFM+Helvetica', 'T1_0', 'WinAnsiEncoding')
font.name='Helvetica Regular'
(15, 'cff', 'Type1', 'DDPEIM+Helvetica-Bold', 'T1_1', 'WinAnsiEncoding')
font.name='Helvetica-Bold Regular' |
Beta Was this translation helpful? Give feedback.
-
A final note: |
Beta Was this translation helpful? Give feedback.
Well, this is what the page definition (xref 4) says in the PDF:
The
/Resources
dictionary at xref 3 containsSo my script above reports all those fonts correctly and completely here - both, on Windows and Ubuntu.