PDF – Fix Blank Pages in Okular

22.10kubuntuokularpdfplasma

Short story: some programs, including Okular, display blank some of the pages in a specific (1000+ pages) pdf, but other programs, including some internet browsers, display all pages without blanks.

After extracting all pages as pdf, the same happens for the same problematic pages. I have uploaded one of them on DocDroid for testing. (Please download this page and see if your Okular can see its content as seen in Firefox or Vivaldi.)

Even Android viewers handle just fine those pages/files.


Longer story:

I have a pdf of an old scanned dictionary of almost 1500 page. Okular shows me that many pages are blank. See here in overview:

enter image description here

The same in PDF Arranger:

enter image description here

That hasn't been a big surprise to me, but I thought that I could clean this dictionary by removing the blank pages either with PDF Arranger, or even simpler by extracting the pages as pdf or png, deleting the blanks (more easily to identify, select and remove than with the aforementioned tool – because of their tiny size) and then re-creating a pdf out of the remaining pages.

The extracted png files were as expected and I could easily identify the blanks: they were under 2 KiB in size. Dolphin thumbnails also showed the blank pngs, close to the images seen above.

But because I have also extracted the pages as pdf I was surprised to see that Dolphin thumbnail-view of the separate pdf pages were now without any blanks! Also, there was no noticeable difference in size between the 1-page pdfs.

Opening these 1-page suspected pdf files in Okular, they were still displayed as blank, and the same happened in Qpdfviewer and PDF Aranger, but not in WPS Pdf, Master PDF, LibreOffice-Draw and Firefox: there, the content was seen, the page was not blank.

Maybe an important detail:

the extracted blank png files (which are also tiny) are fully blank, while the problematic PDF pages (with undiminished size if extracted as PDF) when seen as blank are not fully so: A FOOTER line at the bottom is still seen, and just the rest is blank.

enter image description here

The same command was used to extract the pages as pdf and png: pdftoppm.

Now I have identified the problematic pages and can easily test.

Printing to PDF one of these files in one of the Chromium-family browsers like Vivaldi and Opera, the resulted PDF was still a blank (to Okular and the others already affected) unless the option "print as image" was selected in their settings. – If that option is selected or if print to pdf is done in Firefox, this gives as output a pdf file that is seen normally in Okular!

Testing with other programs and summing up:

  • all pages are seen by WPS PDF, Master PDF, Firefox, Vivaldi browser, LibreOffice Draw, ImageMagick, mupdf, PDF Studio Viewer

  • blanks (with that footer) are displayed in Okular, Qpdfviewer, PDF Aranger, Falkon (!), Inskape, Krita

  • Evince (Document Viewer) installed as snap in Kubuntu cannot open thelarge file, nor any of the separate pdf pages, but gives an error: Error opening file the.pdf: Permission denied (it opens other pdf files)


  • What could the problem be?

  • Can I fix this at system-level?

    Okular and Qpdfviewer are the only PDF viewers that seem affected by this (no matter the problem the files themselves might have).

I prefer to use Okular for all my pdfs.

Best Answer

  • This is a bug with poppler, posted here, initially here, Evince and Atril (Mint PDF viewer) are also affected.

  • To fix the pages I have printed them "as pdf" in Firefox (or Chrome, Vivaldi, Opera - with these 'print as image' must be selected too). Depending on RAM capacity, one shouldn't "print to pdf" more than 200-300 pages at once in order to avoid freezes/crashes.

Related Question