Print to pdf without cups running: how does KDE/Qt do it? Can I do it from command line?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Print to pdf without cups running: how does KDE/Qt do it? Can I do it from command line?
I have an installation of Slackware 14.2 (although I would also like to do this in 14.1).
In KDE when I select print I have a print to file option that I can use from any application to create a PDF through the KDE print dialog. I do not have cups running.
Is there a way I can use this functionality from bash? What is the program to use?
An option I see is to install CUPS-PDF from SBo but it seems kind of unnecessary to install it and configure CUPS if there is a built in method that I could use.
Well, I want to do it for several reasons: one is to drive inkscape to print from the command line. I'm trying to flatten some pdfs with different layers and completed forms so that the file sizes are smaller and the forms are no longer editable. I also want to use it for printing from other applications though too.
Unfortunately that doesn't preserve the content of the forms: I think my final solution is going to involve a combination of pdftk, xpdf tools, and inkscape. I am missing the part where I want to run it through a print driver (unless I can find a better solution) to get rid of the layered pdfs (that are being combined with pdftk) and to make sure any form data is both preserved and uneditable.
The missing piece is how does KDE/Qt print to pdf without going through the CUPS driver? If I print manually from okular it works, although I don't see that there is a way to do it automatically. I just thought though, maybe I can drive okular with keyboard commands sent through X: I'll have to look into how to do that.
inkscape -z --export-pdf=<name of pdf file> -f <file to print as pdf>
For other apps we need to know the corresponding file formats.
Well, looking at the CUPS program lpr (or lp) it looks like PDF, PS, or plain text are the only options. I think I can manage that, but what I am trying to do is reduce the effect of kludging PDFs with layers (watermarks) together with pdftk. One of the layers will be generated with inkscape, the others with pdftk.
I was thinking that by running it through a print driver it would clean up the generated pdf output: I was also looking at pdf clipping/cropping with masks, but it leaves the covered up graphics/text in the file, just hidden.
As Didier Spaier mentioned, we would need to know the file formats involved in the process.
If I understand what you're doing, you're overlaying text on flattened forms ?
If so, we have written quite a few scripts at work around Perl Module PDF::Reuse with great results.
One can overlay text on PDF Forms and the result is a flattened PDF.
HTH.
-- kjh
Well, the big set of files was originaly generated in CATIA but as there is ~10,000 of them we don't want to regenerate them all manually. We just want to change some details by overlaying a generated pdf with the changed details and add a watermark layer and merge all the layers together so the changed details are gone. I was thinking of using forms and pdftk to change the form details but I may go with a generated svg and use inkscape to convert to pdf.
That Perl Module looks interesting: I'll definitely look into that.
After a search, it looks like the KDE printer driver built into Qt (https://wiki.qt.io/Handling_PDF). I think I'm going to try experimenting with CUPS-PDF rather than start into writing a Qt application: I really was just trying to avoid messing with CUPS as that always seems to take longer than it should.
I think this is enough for me today: I'll look into it more tomorrow or later this week. Thanks for the thoughts guys.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.