PDF errors in Dorico output

I’m getting some PDF errors in files exported from Dorico. Using Acrobat’s Preflight tool and checking for syntax errors, I get “Unbalanced q and Q operators” (These are graphics state save and restore commands.) and “Unusable operands at the end of the content stream”.

The errors all start on the Fifth page, and are then found on every page thereafter. Documents shorter than 4 pages do not exhibit the error.

I get the error if I do a Graphics Export, and also if I use MacOS’s Save As PDF from the native print menu. Also if I use a PDF-to-disk print queue.

This is on MacOS Mojave 10.14.4, though PDFs from 10.14.3 also show the error. The PDFs otherwise ‘appear’ to be fine when viewing or printing.

Can anyone else confirm? Would be useful to know if this is a Qt bug (also on Windows?) or whether it’s just some local trouble. However, I’m seeing this on both my Macs.

Can you attach one of the PDFs here? You don’t need anything more than a text editor to check if the q and Q commands are properly balanced, though the other error might be a bit less obvious.

It could be a bug (or two) in Preflight, not in the PDF …

Admittedly, it’s an old version of Acrobat. However, the error is being flagged by MacOS itself in my post-processing, and I don’t get the error in PDFs from other apps, nor if I export as PostScript from Dorico and then Distill that.
But are you saying you can’t reproduce in any of your PDFs?

I don’t think you can actually find the operands in a text editor, as the data is encoded or compressed within the PDF. Here’s one.
Wood Expectans.pdf.zip (153 KB)

I can replicate the problem exporting here on macOS 10.14.3 (with an entirely untweaked imported MusicXML - no graphics frames, default fonts etc.). I have no idea what’s causing the error, though.

It seems to be on every PDF from Dorico that I have, going back to last summer. Luckily, I usually do some post-processing which seems to fix it (e.g. Combining PDF documents, or making booklets, etc.)

There do seem to quite a few PDF bugs in Qt: [QTBUG-25379] QtPrintSupport - PDF Issues - Qt Bug Tracker but I can’t find this one explicitly mentioned.

Can anyone on Windows replicate this issue?

We have been looking into this issue and we now understand the problem. The errors reported by Acrobat’s pre-flight checks are not accurate. The issue is caused by the way that Dorico is specifying the coordinates of the pages as it renders them into the PDF. Dorico uses as far as possible the same method of drawing to the screen as it does to the printer or when exporting graphics, and consequently it maintains offset coordinates for each page in a layout, in much the same way as you see them drawn on the screen. However, Acrobat uses fixed-point 32-bit numbers for these coordinates, and so depending on the dimensions of the pages, after a handful of pages the coordinates describing each page’s rectangle overflow these coordinates.

In practice with modern versions of Acrobat (i.e. later than Acrobat 6) this should cause no actual problems, but nevertheless we will, in a future version, endeavour to find a way to supply pages to Acrobat in such a way that the coordinates do not overflow.



:sunglasses: :smiley:

Well done, Daniel, for getting to the bottom of this. My concern was that Dorico users might be sending PDFs to commercial printers, and these errors could get flagged in Prepress.

Interesting that Apple’s own PDFKit also flagged some kind of error (trying to find the code I ran to create it!).

GhostScript gives a clean bill of health, which is something.

Is this related to the issues with the Arrow Crafter font?

I used that in a piece that I composed but the score gave an error when opening in Acrobat Reader and was suddenly blank immediately at the moment the first arrow was to appear, and with only blank pages following that. I wound up having to print to PDF with a different application instead of using Dorico’s PDF export.

No, nothing to do with that font.