How To Fix PDF Forms Not Showing Contents in Okular (Linux)

I have had this problem happen twice now, and I don’t know exactly what is causing it, but I found a solution. Here’s the situation…

I received a PDF that has forms. Typically, that isn’t a problem as Okular is able to open most PDFs with forms and show both the forms and what has been entered into the forms. However, with this particular PDF, when I click on the “Show Forms” button at the top of Okular, I can see the information entered into the form like this:

(NOTE: I tried opening the PDF in Xournal and had the same problem.)

But when I click on “Hide Forms” (which is still showing on this PDF as “Show Forms” for some reason), all of the information entered into the form goes away, like this:

If I try to save the PDF as a different PDF in Okular or print it, nothing shows up. I found one website that had a suggestion for why this might be happening – the PDF may have been filled out in a web browser instead of using Adobe Acrobat Reader (or Okular) and, as a result, the PDF that was saved has some problem. I’m not sure what browser would be doing this, but that gave me an idea. If the problem is that it was filled out in a browser, perhaps I can open it in a browser then print it to PDF. So, that’s what I tried and it worked.

I opened the PDF in Brave (one of the browsers I have installed on Linux) and the PDF showed all the forms with all the information filled in:

I then printed the PDF (which flattens it and removes the forms) using the print button to a PDF:

The resulting PDF, while flattened, now showed all the information in the forms and allowed me to sign the document electronically.

I’m not sure how I solved this last time, but I figured I’d post this solution up here for the next time this happens so I can quickly take care of the problem and don’t have to try to figure out why form information isn’t showing up in my PDF on Linux using Okular.

 901 total views,  1 views today

Linux – Fixing PDFs opening in GIMP in Firefox/Zotero (instead of Evince or Okular)

I’m not exactly sure why, but with the latest Firefox updates, every time I download a PDF using Firefox or try to open one using Zotero integrated with Firefox, the PDF opens in GIMP.  This didn’t used to happen, but it’s really annoying.  It’s doubly annoying since you can’t solve it inside Firefox.

It would make sense to be able to change this in one of two ways.  First, by simply setting your system-wide preference for what program opens PDFs, that should do it, but mine was already set to Okular (you can change the default for most programs by right-clicking a PDF file, selecting Properties, then File Type Options and setting the program you want to be the default).

The second logical solution would be to change the default applications in Firefox, but that doesn’t do anything.  It turns out, the solution is to edit a different file, changing the order of default applications for opening PDFs. Here’s what you need to do:

Open a terminal and gain root privilege to edit the following file: /usr/share/applications/mimeinfo.cache.  Here’s the command I use in Kubuntu:

sudo kate /usr/share/applications/mimeinfo.cache

NOTE: As of Kubuntu 18.04, you now have to use the following command to edit protected files with Kate:

SUDO_EDITOR=kate sudoedit /usr/share/applications/mimeinfo.cache

Once you have edit permissions for that file, search for this line:

application/pdf=gimp.desktop;okularApplication_pdf.desktop;

The order of the applications after the “=” indicates the order in which they will be used to load PDFs. Right now, GIMP will be used first. All you need to do to fix this is to change the order so Okular is first, like this:

application/pdf=kde4-okularApplication_pdf.desktop;gimp.desktop;

Once you change it, save your changes and then restart Firefox.  Your PDFs should now load in Okular.

UPDATE:

For those who have used this workaround in the past, they may have realized that this fix is temporary. The next time you update your software or change something, gimp, again, gets set as the default for PDF files. In order to make this a permanent fix, there is another option. You can override the mimeinfo.cache list by creating a file in the /usr/share/applications directory called “mimeapps.list” that overrides mimeinfo.cache. Here’s what you would add to the file if you want Okular to be your default PDF reader:

[Default Applications]
application/pdf=okularApplication_pdf.desktop

Now, whenever there is an update to your system, the mimeapps.list file will override the mimeinfo.cache file and you shouldn’t have to keep changing this. (Source)

 5,899 total views