Export to PDF does not embed fonts "flattened"

Using LibreOffice 7.5.0.3. The PDFs exported embed the fonts as a TrueType subset that my on-demand print services do not process. Support claims that the PDF is not “flattened”, whatever that means.

(Exact error message is “The ‘Widths’ array in a font has an invalid length.” - which, when I search for it, does give a few posts on StackOverflow and GitHub claiming it’s a “known issue with LO”, but gives no resolution.)

After running a few rounds with the print services support, they redistilled the export PDF with Adobe Distiller - although I have no clue how they did it. They pointed out that the font embedding was broken and they needed to fix the file to use Type 1 embedding - rather than TrueType.

My question boils down to: how can I export a “flattened” PDF with LO, and how can I force Type 1 font embedding?

TIA

I guess you can’t. Type1 fonts are depreciated for some time. So LibreOffice does not support them and it is difficult to use something not supported. I’d think the usual solution is to convert or replace your type1-fonts

Type1 is the only difference I see - and was told - on the font embedding front between the edited PDF i got back from the support team and the one LO generated. The former has Type 1 embedding with custom encoding, the latter is TrueType with Built-In encoding.

Based on the error it is obvious that the font embedding while exporting to PDF is broken, but could not figure out any means to fix it. Flattening seems to be little to do with the issue unless LO tries to export layered PDFs?

The only “meaningful fix” on SO was the poor sod going through their document, highlighting every single paragraph one by one, hunting for that one paragraph that had some control character - list bullet in their case - in a different font type than the rest of the text, then change it, and export to PDF again. This is a 391 page document and I really don’t want to go through this with the whole thing, it will take literal days. (A single click in the latter half of the doc freezes up LO for a good 2-3 minutes.)

To enable fixing anything in LO, the issue should be filed to the bug tracker. Searching there for the string that you quote doesn’t bring any results. Please file it, with exact steps to see the problem, and if needed, a sample ODF file (maybe with embedded font(s)), which produce this result. Thanks.

This one, How can I fix the PDF preflight error: "The 'Widths' array in a font has an invalid length" - Stack Overflow ?
Might be tdf#43185 . A workaround might be to use a font with a larger character set.

1 Like

Thanks @EarnestAl - the found topic is interesting. But still - there is no way for me to check, without having a test ODT that exports in that way.

Highly unlikely. That one is about substitution table and choosing wrong fonts (unrelated to PDF; a PDF was only used there as a tool for verifying); this one is about incorrect data (size of table) written to PDF. The workaround is also likely unrelated.

I guess what they did is step 4 of the following guide on flattening: “Convert All Text To Outlines”:
https://www.adobe.com/acrobat/hub/how-to-flatten-a-pdf.html

IMHO only one of several possibilities. If I take the hint on type1-fonts their (older) RIP may not support allowed features of PDF/TrueType etc.
.
Filee a bug at bugzilla, but this will only work, if you provide documents to check on the problem…

??
Don’t you think Search and replace may be an option here? The search dialogue even allows to search for formatting like font/size.
.
If the place can be found it would be possible to create a smaller test-document for a bug-report.

You edit an .odt here? And you wrote it this way? Or were editing the pdf directly in Draw?

Thanks for all the comments so far. Let me address some of the points to the best of my ability.

First off, @EarnestAI linked the StackOverflow post I was referring to. Appreciate it, I didn’t know whether cross-linking outside sources was against community guidelines so I refrained from doing that - that is exactly what I meant when I was referring to this being “a known issue” and the by-paragraph “fix”.

@mikekaganski , on your follow-up questions:

I do not know what is causing the issue - if I would, I probably would know how to fix it myself. I have an enormous ODT file - and if I ever do another project of this magnitude, I definitely wouldn’t use LibreOffice for it but rather something like Scribus. The file is 391-397 pages long - rendering is totally random and breaks the formatting every single time the file is opened, something I posted about a while back, and using sections didn’t fix this -, and is 484MiB in size. I am happy to link it, but I cannot just surgically make a copy of the problematic section and share it here because I do not know where it is. (Assuming it’s a “localized” issue.)

@Wanderer , to your points:

  1. Appreciate the link to the flattening guide, I’ll check with my girlfriend, she has an Adobe subscription with access to Acrobat.

  2. On “Search and replace”, if you check what the other user did ( How can I fix the PDF preflight error: "The 'Widths' array in a font has an invalid length" - Stack Overflow ), they basically went through their whole document, highlight every paragraph one by one, and where the formatting hid the font type implying there’s multiple fonts in the paragraph where there should only be one, they manually updated the font. Out of desperation I actually tried this, but that did not help.

  3. On the freezing up: yes, I am editing an ODT. Again, it’s enormous; it has close to 200 illustrations embedded into it with a lot of layouting, sections, and illustrated textboxes. Past page 200 even clicking on an image to check its properties freezes up LO for a good while, and God save your soul if you are trying to fix the layout on the later pages as LO is struggling to render those. (Yes, I considered chopping the document up into multiple odt files by chapter, but using the master document approach created a hot mess. Again, I know I should have used some proper publishing software, but hindsight is 2020, the document is in its final form, and this export bug is the last thing that prevents me from sending it in for printing.)

I seem to never have asked you what was causing the issue?

@mikekaganski , not what i meant - you pointed out that the correct way to report a bug is by filing a bug report with a way to reproduce it (which I have no idea how to do), and an example that can be analyzed. My point is that while I am happy to provide the raw ODT, a 500-meg file will help nobody, and I cannot really isolate it to a smaller cut-out from the file that would have the same symptoms.

Heh, I thought it could help e.g. myself to see it and be able to make a better smaller sample …

@mikekaganski fair enough! Just wanted to make sure I am not stepping on anyone’s toes by linking that monstrosity, I remember I ruffled some feathers when I inquired about the inconsistent layout rendering. The ODT is in my Dropbox, here.

Thanks!
I downloaded it; I tried to export it to PDF, and check using VeraPDF. It gave me a validation error, but different than what you reported. Could you please show your PDF export dialog screenshot? Thank you.

Here you go:




(Security is disabled, Digital Signatures is empty.)

(Edit: looks like image embedding is broken, but the pictures are clickable to load the full view)

I tried the other PDF-A versions as well but same results. (PDF-A-1b breaks the embedded PNG images’ transparency so I generally don’t use that unless I’m trying to troubleshoot.)

Font embedding is enabled in Properties but I don’t believe that carries over to the PDF export?

One thing I would add: I do not know what kind of software the printing service is using to process the PDFs uploaded to them. I did ask them for more detailed error/trace information on top of that Widths array message but never got an answer. So the error message from their UI is the only debug info I have.

Unfortunately, I still wasn’t able to repro that exact error. Still, the other error looks very similar, and I went ahead and filed / fixed it: tdf#159689. Yet, I believe it’s not the same …

1 Like

Ah! The actual error discussed here was fixed in tdf#157112, in version 7.6.2.

1 Like

this was it! I upgraded to 7.6.4.1 and it seems to be working now. back to editing because they layout is messed up again lol. thank you @mikekaganski .