You are not logged in.

#1 2021-12-18 11:47:00

Wild Penguin
Member
Registered: 2015-03-19
Posts: 406

Can not print certain PDF files [WORKAROUND]

Hi,

I was today a bit dumbfounded by this issue.

I got two PDF files I can not print, but I can view them. I've tried via Okular and xpdf. Opening the said files directly in Firefox results Firefox claiming that this file could not be opened because of an unknown error. I can attempt to print via Okular and xpdf and it seems everything went OK, except that the print never comes out of the printer!

I can print other files (other PDF files, any other file which is not PDF, test page) without problems. I think these files may be corrupted somehow, despite I can show them (but the corruption trips over something in the print chain (CUPS) after the application).

I've looked at CUPS admin interface and the files are in the printed jobs list.  In the /var/log/cups/page_log:

Samsung_SCX-4300_Series ville 34 [18/Dec/2021:13:17:08 +0200] total 0 1 localhost [FILENAME REDACTED] A4 one-sided
Samsung_SCX-4300_Series ville 35 [18/Dec/2021:13:17:56 +0200] total 0 1 localhost [FILENAME REDACTED] A4 one-sided

I believe the first number (in "0 1") is the page number, which shows 0, despite both of these documents are actually 4 pages!

A few points which makes this a bit difficult to troubleshoot:

  • I would share these files but they contain sensitive information I'm not comfortable posting online

  • I can not find example files elsewhere, any other files I've tested are printed correctly

  • I can not find any useful information in logs (/var/log/gups, journal, starting xpdf or okular via command line)

Now, anyone ever faced a similar issue? How would you go about finding what is going on?

Can I somehow validate a PDF file that it is actually a valid (not corrupted / non-standard) PDF file?

Another small (?) finding: I "printed" the problematic files into another PDF. The file size doubled, but opening this file (actually ps now), it opens up as four blank pages. So the problem might be in the PDF->PS step (IIRC everything is converted into PS before actually being sent to the printer driver in CUPS)?

Last edited by Wild Penguin (2021-12-18 12:06:37)

Offline

#2 2021-12-18 11:57:38

progandy
Member
Registered: 2012-05-17
Posts: 5,321

Re: Can not print certain PDF files [WORKAROUND]

You could maybe try to run the pdf through "mutool clean" or, if that doesn't work, "mutool convert". Another option may be "qpdf", it has a --check option as well.

Last edited by progandy (2021-12-18 12:00:02)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#3 2021-12-18 12:00:38

Morn
Member
Registered: 2012-09-02
Posts: 886

Re: Can not print certain PDF files [WORKAROUND]

Well a PostScript file is just plain text, so you could open it in your text editor and see for yourself what's inside. PS is human-readable text, PDF is binary and a bit harder to deal with. So I would first try to verify that the PDF->PS step works, especially as you are already suspecting it of going wrong.

Try to use pdf2ps manually and see what you get.

Offline

#4 2021-12-18 12:03:40

Wild Penguin
Member
Registered: 2015-03-19
Posts: 406

Re: Can not print certain PDF files [WORKAROUND]

Hi,

Thanks progandy;

I noticed two workarounds:

  1. Convert to ps via pdf2ps. Then open this file (which now opens fine!) with a PDF viewer (I used okular) and it will print.

  2. Printing the original pdf via `lp` works.

Why option [1] is different to "Print to PDF" from a GUI dialog is beyond me. The result via pdf2ps is even larger, so there is definitely something these routes do differently.

But thanks anyways! I've found a workaround so that I got my files printed for this occasion, but I believe there is a bug somewhere?

I case someone know how can I prevent this happening in the future (for other users, too, say, by making a bug report with more information somewhere) then suggestions are welcome!

Offline

#5 2021-12-18 15:14:40

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,366

Re: Can not print certain PDF files [WORKAROUND]

https://superuser.com/questions/210686/ … strictions

qpdf --help | grep -i print

The reason for the difference is that those tags are merely "polite suggestions" and some tools just don't give a fuck ;-)

Offline

#6 2021-12-18 16:57:52

Wild Penguin
Member
Registered: 2015-03-19
Posts: 406

Re: Can not print certain PDF files [WORKAROUND]

Hi seth,

I'm absolutely sure the case in this case can not be usage restrictions, as I can share the fact that the documents are actually shipping labels and manifests. They exist only for me to print them in the first place!

I.e. a part is supposed to be attached to a parcel, other parts signed by me and the courier etc...; that's also the reason I don't want to post them online (as they contain the senders and recipients names, addresses and the contents of the package(s) and other details)

Last edited by Wild Penguin (2021-12-18 16:59:09)

Offline

#7 2021-12-18 17:09:18

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,366

Re: Can not print certain PDF files [WORKAROUND]

Is the file encrypted at all?
If not, try "qpdf --check" for a sanity check.

Offline

#8 2021-12-18 22:01:20

Wild Penguin
Member
Registered: 2015-03-19
Posts: 406

Re: Can not print certain PDF files [WORKAROUND]

No, the files are not encrypted.

qpdf --check does not report anything extraordinary:

checking [REDACTED].pdf
PDF Version: 1.3
File is not encrypted
File is not linearized
No syntax or stream encoding errors found; the file may still contain
errors that qpdf cannot detect

Offline

Board footer

Powered by FluxBB