Problems with PDFs

I just installed 24.04 LTS and ran into problems. The one I cannot resolve (so far) is viewing a PDF. Files that were just fine in previous LTS now report PDF header errors from qpdfview, and two other PDF viewers I’ve tried?

We need actual examples, please.

1 Like

The message in one PDF reader is:

calibre, version 7.6.0
ERROR: Loading book failed: Failed to open the book at /media/weesner/cwwees/Obsidian/Model Trains/club info/TGRS/2024 TGRS Roster.pdf. Click “Show details” for more info.

Failed to convert book: /media/weesner/cwwees/Obsidian/Model Trains/club info/TGRS/2024 TGRS Roster.pdf with error:
Traceback (most recent call last):
File “/usr/lib/calibre/calibre/customize/ui.py”, line 469, in get_file_type_metadata
mi = plugin.get_metadata(stream, ftype.lower().strip())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/calibre/calibre/customize/builtins.py”, line 323, in get_metadata
return get_quick_metadata(stream)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/calibre/calibre/ebooks/metadata/pdf.py”, line 124, in get_metadata
raise ValueError(‘Could not read info dict from PDF’)
ValueError: Could not read info dict from PDF
Syntax Warning: May not be a PDF file (continuing anyway)
Syntax Error: Couldn’t find trailer dictionary
Syntax Error: Couldn’t find trailer dictionary
Syntax Error: Couldn’t read xref table
pdfinfo errored out with return code: 1
InputFormatPlugin: PDF Input running
on /media/weesner/cwwees/Obsidian/Model Trains/club info/TGRS/2024 TGRS Roster.pdf
Failed to run pipe worker with command: from calibre.srv.render_book import viewer_main; viewer_main()
Traceback (most recent call last):
File “/usr/bin/calibre-parallel”, line 21, in
sys.exit(main())
^^^^^^
File “/usr/lib/calibre/calibre/utils/ipc/worker.py”, line 196, in main
exec(sys.argv[-1])
File “”, line 1, in
File “/usr/lib/calibre/calibre/srv/render_book.py”, line 952, in viewer_main
render_for_viewer(*args)
File “/usr/lib/calibre/calibre/srv/render_book.py”, line 943, in render_for_viewer
return render(
^^^^^^^
File “/usr/lib/calibre/calibre/srv/render_book.py”, line 920, in render
book_fmt, opfpath, input_fmt = extract_book(pathtoebook, output_dir, log=default_log)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/calibre/calibre/ebooks/oeb/iterator/book.py”, line 62, in extract_book
pathtoopf = plumber.input_plugin(inf,
^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/calibre/calibre/customize/conversion.py”, line 242, in call
ret = self.convert(stream, options, file_ext,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/calibre/calibre/ebooks/conversion/plugins/pdf_input.py”, line 51, in convert
pdftohtml(os.getcwd(), stream.name, options.no_images)
File “/usr/lib/calibre/calibre/ebooks/pdf/pdftohtml.py”, line 83, in pdftohtml
raise ConversionError(‘pdftohtml failed with return code: %d\n%s’ % (ret, out))
calibre.ebooks.ConversionError: pdftohtml failed with return code: 1
Syntax Warning: May not be a PDF file (continuing anyway)
Syntax Error: Couldn’t find trailer dictionary
Syntax Error: Couldn’t find trailer dictionary
Syntax Error: Couldn’t read xref table

The other apps (qpdf and xpdf) refuse to open PDF’s with a simple “could not open” message. In most cases, it seems to refer to a faulty header. A second computer, still running the older LTS, opens the same file just fine. I can upload a file if you need that for testing?

I guess, from the “pdf_input.py” reference that this is a change in some part of Python?

That is indeed what I asked for.

OK, now I’m getting confused. The PDF I wanted to open is a club roster that I’m not willing to upload. Turns out that all the PDF’s I tested were symlinks - because I have them physically stored in one directory tree and referenced from another. It’s the symlinks that are not working. I can open the PDF from the directory where it’s physically stored.

When I create a new symlink, everything works. One change is that the reported size of the file in pcmanfm-qt is the size of the original file. The older symlinks are listed as 1.0 kB each.

1 Like

I’d run file against the two symlinks and see if you can see any clear differences.

3 Likes

So - the “l” on the permissions is missing on this entire directory of symlinks. This is supposed to be a symlink (and doesn’t work, of course):

-rw-rw-rw- 1 smbuser smbgroup 1067 Jul 31 16:11 ‘TIMETABLE-April, 2024.pdf’

And this is my newly created symlink

lrwxrwxrwx 1 smbuser smbgroup 94 Mar 4 16:48 ‘2023 TGRS Club Roster.pdf’ → ‘/media/weesner/cwwees/HOBBY-INTERESTS/model_railroad//TGRS Documents/2023 TGRS Club Roster.pdf’*

and it does work (of course).

Is there any chance this is related to having this volume shared thru samba? Accessing this directory from the computer running the older version (which is really accessing it thru samba) - the “l” is there and of course, the symlinks work.

2 Likes

Most likely this is a SAMBA issue. I don’t really use it very much so I can’t really comment on it, but I’d contact the SAMBA folks and I’m sure they can get you sorted:

4 Likes

How is your old computer mounting and opening these problem symlinks ? (I’m pretty sure it’s not the gvfs mount that pcmanfm-qt uses).

I suspect this is a problem that pre-dated the Lubuntu update. I just “discovered” it with the update. The laptop, even after 24.04, still sees the Samba symbolic links just fine…

These shortcuts were on a Western Digital external NAS that ran SMB to everything. As it failed, I bought an internal disk and moved all the files to this Linux machine to share, and fired up Samba so phones, tablets, etc could still access the data. I will either create all the symbolic links local, then share to my Linux laptop using NFS, or work out why a locally-created symbolic link doesn’t show up on a Samba share. I need to look at the smb.conf file to make sure that stuff is enabled.

Meantime, I have other pressing life activities, so this will not get addressed for a couple weeks. Thank you for the prompt follow-up…

Charlie

(To help you with your quest…)
The symlinks that are 1067 bytes in size are called Minshall+French symlinks
(basically a text file for software that emulates a symlink).
They are put on servers (for clients) that don’t support unix symlinks.

Posix symlinks are not fully supported since SMBv2, especially symlink creation. So MF symlinks are sometimes used as a workaround.
(ironically unix symlinks were supported in SMBv1)

If you open an MF symlink on a mount with the ‘mfsymlinks’ option, then the symlink works. (and you can also create those MF symlinks on the same mount).

If try to open those links with a different mount (eg. pcmanfm-qt) then it doesn’t work, because (pcmanfm-qt) does not use ‘mfsymlinks’ to mount.

2 Likes