LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 04-21-2021, 02:48 AM   #1
deltasata
LQ Newbie
 
Registered: Apr 2021
Posts: 13

Rep: Reputation: Disabled
Okular can't print pdf.


Okular can'r print pdf files. The document viewer prints it but all the fonts look bad (print preview works fine though). I don't know how to debug. So tired of this. What is the `cups`? Anyone can help? Thanks in advance.
 
Old 04-21-2021, 03:21 AM   #2
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,155
Blog Entries: 5

Rep: Reputation: 107Reputation: 107
Hello,
pdf can be a weird thing.
I would try the options after each (and keep the working one):
a) export to pdf (if it works on Okular; I dont know); then open the pdf in a pdfviewer and print from there
b) print to file (if it works on Okular; I dont know); then open the pdf in a pdfviewer and print from there
c) install the "cups-pdf" and print with "cups-pdf" into a file; then open the pdf in a pdfviewer and print from there
 
Old 04-21-2021, 04:09 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,721

Rep: Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914
What version of Ubuntu are you running?

Have you tried other readers like evince?

cups is the linux printing system. It is a print spooler that converts stuff you want to print into the print language the printer supports and sends it to the printer.
 
Old 04-23-2021, 03:46 AM   #4
deltasata
LQ Newbie
 
Registered: Apr 2021
Posts: 13

Original Poster
Rep: Reputation: Disabled
I am on 20.04. Evince messes up the fonts (of a scientific paper prepared with latex, you can find one at say https://arxiv.org/pdf/2104.11171.pdf). Never faced these issues. In Okular if I do "print to file" it also messes up some of the fonts! Do not know where to start from.
 
Old 04-23-2021, 04:27 AM   #5
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Well, the only non-embedded font that document uses is Times-Roman (e.g in the vertically running text along the left margin arXiv:2104.11171v1 [astro-ph.CO] 22 Apr 2021). On Ubuntu 20.04, I have
Code:
$ fc-match Times-Roman
NimbusRoman-Regular.otf: "Nimbus Roman" "Regular"
$ fc-match Times-Roman:fontformat=Type\ 1
NimbusRoman-Regular.t1: "Nimbus Roman" "Regular"
Check your fontconfig settings, particularly /etc/fonts/conf.avail/30-metric-aliases.conf. Is the package fonts-urw-base35 installed? An older non-Unicode variant of this font is provided by package gsfonts:
Code:
$ fc-match 'Nimbus Roman No9 L'
n021003l.pfb: "Nimbus Roman No9 L" "Regular"
On my system, the CUPS charset for texttopdf filter points to pdf.utf-8.simple:
Code:
$readlink -e /usr/share/cups/charsets/pdf.utf-8
/usr/share/cups/charsets/pdf.utf-8.simple
which only references font alias monospace (well, technically also ARPLUmingCN for double-width, but I doubt you need it):
Code:
$ grep ^[^#] /usr/share/cups/charsets/pdf.utf-8
charset utf8
0000 04FF ltor single monospace monospace:bold monospace:oblique monospace:bold:oblique
0500 05FF rtol single monospace
3000 9FFF ltor double ARPLUmingCN
which, in turn, is provided by DejaVu Sans Mono from package fonts-dejavu-core
Code:
$ fc-match monospace
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
The CUPS filters used to convert PDF are texttobrf, pdftopdf and pstotiff:
Code:
$ grep -h ^application/pdf /usr/share/cups/mime/*.convs|tr -s \\t
application/pdf	application/vnd.cups-brf	100	texttobrf
application/pdf	application/vnd.cups-pdf	66	pdftopdf
application/pdf image/tiff      80       pstotiff
application/vnd.cups-pdf is further converted like this:
Code:
$ grep -h ^application/vnd.cups-pdf /usr/share/cups/mime/*.convs
application/vnd.cups-pdf-banner	application/pdf			32	bannertopdf
application/vnd.cups-pdf	application/vnd.cups-postscript	100	pdftops
application/vnd.cups-pdf	application/vnd.cups-raster	99	gstoraster
application/vnd.cups-pdf	image/pwg-raster		99	gstoraster
application/vnd.cups-pdf	application/vnd.cups-raster	101	mupdftoraster
application/vnd.cups-pdf	image/pwg-raster		101	mupdftoraster
application/vnd.cups-pdf	application/vnd.cups-raster	100	pdftoraster
application/vnd.cups-pdf	image/pwg-raster		100	pdftoraster
application/vnd.cups-pdf image/tiff 80 pstotiff

Last edited by shruggy; 04-23-2021 at 06:18 AM.
 
Old 04-25-2021, 08:33 PM   #6
webertt
LQ Newbie
 
Registered: Apr 2021
Distribution: Ubuntu
Posts: 3

Rep: Reputation: Disabled
Interesting issue, never heard about this before
 
Old 05-05-2021, 10:41 PM   #7
deltasata
LQ Newbie
 
Registered: Apr 2021
Posts: 13

Original Poster
Rep: Reputation: Disabled
Thanks for the reply but I am not sure how to troubleshoot. Funnily my office has three different computers, managed by three different people, all running on ubuntu 20.04 and all faces the similar issues with printing! The print previews are not good also.
 
Old 05-05-2021, 10:47 PM   #8
deltasata
LQ Newbie
 
Registered: Apr 2021
Posts: 13

Original Poster
Rep: Reputation: Disabled
Interestingly, all the mac computers can print the same pdf files on the same printers without any issue, the fonts appear perfectly fine! I am absolutely sure that there is something funny going on in ubuntu 20.04 (18.04 also had issues to my opinion).

Is there any viable alternative to cups?

Last edited by deltasata; 05-05-2021 at 10:49 PM.
 
Old 05-06-2021, 01:26 AM   #9
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Quote:
Originally Posted by deltasata View Post
Is there any viable alternative to cups?
LPRng, but its last release was in 2012, and I'm not sure it will help you. AFAIK, macOS uses CUPS, too.
 
Old 05-06-2021, 01:55 AM   #10
deltasata
LQ Newbie
 
Registered: Apr 2021
Posts: 13

Original Poster
Rep: Reputation: Disabled
If I print the pdf files from a usb drive, the printer could print it fine! Don't know what is the problem with my ubuntu now!
 
Old 05-06-2021, 02:14 AM   #11
deltasata
LQ Newbie
 
Registered: Apr 2021
Posts: 13

Original Poster
Rep: Reputation: Disabled
After I deleted cups from my computer, still the print preview is bad with okular. Don't know what should I do. Feeling completely frustrated.
 
Old 05-06-2021, 08:41 AM   #12
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Ok, let's eliminate the most obvious cause: incorrect font configuration or missing fonts.

Download the files base14-fonts.pdf and base14-fonts.png from the TeXworks repository. Open the PDF file in Okular and compare it to the PNG file as described in the README. They should be rendered identically.
 
Old 05-06-2021, 10:47 PM   #13
deltasata
LQ Newbie
 
Registered: Apr 2021
Posts: 13

Original Poster
Rep: Reputation: Disabled
They (pdf, png given above) look pretty similar on okular. I found the problems with the scientific papers with figures made by newer matplotlib. My old papers look not that bad.

Edit: Courier looks slightly different in the pdf file though.
 
Old 05-06-2021, 11:11 PM   #14
deltasata
LQ Newbie
 
Registered: Apr 2021
Posts: 13

Original Poster
Rep: Reputation: Disabled
I am so curious to know what is happening. So I explain the situation point-wise, please let me know what to blame according to you.
1. I can see some pdf files fine with okular but the print in the print previews okular messes up some fonts. What to blame-- okular or system fonts or cups?
2. Okular cannot print on any of the network printers installed. What to blame -- okular or cups?
3. Evince shows the pdf files fine, the print previews are also fine. From evince I can print also, but the print outs have very bad fonts. What to blame -- Evince or system fonts or cups?

Extra info: All mac computers can print the files perfectly. If I print the files from a usb drive, the printouts are fine. Google chrome can show the files fine, the print previews are also fine. But it can't print.

Edit 1: I found that my `pdf2ps` also mess up the fonts for those pdf files. By any chance okular uses pdf2ps while printing or showing print preview?

Last edited by deltasata; 05-07-2021 at 02:40 AM.
 
Old 05-07-2021, 03:35 AM   #15
deltasata
LQ Newbie
 
Registered: Apr 2021
Posts: 13

Original Poster
Rep: Reputation: Disabled
I tried to reinstall ghostscript 9.54, same issues persist. FRUSTRATED....
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Okular doesn't print. Firefox and LibreOffice can and do print. JZL240I-U Linux - Software 9 03-04-2020 12:07 PM
Okular bookmarks, annotations lost for renamed PDFs, etc. (Okular 0.16.2, KDE 4.10.2) Geremia Linux - Software 6 10-22-2019 05:27 AM
LXer: Listen to your books (ePUB or PDF) with Okular, KDE's PDF Reader LXer Syndicated Linux News 0 06-22-2012 06:30 AM
Firefox, Okular don't put print job on the print queue (silently) pwabrahams Linux - Software 1 02-18-2011 07:39 AM
Okular doesn't print PDF files? michalng Debian 2 02-21-2010 09:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 05:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration