LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-19-2017, 11:46 AM   #1
sysfce2
Member
 
Registered: Jul 2009
Distribution: Slackware
Posts: 116

Rep: Reputation: 50
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.
 
Old 11-19-2017, 12:15 PM   #2
glorsplitz
Senior Member
 
Registered: Dec 2002
Distribution: slackware!
Posts: 1,308

Rep: Reputation: 368Reputation: 368Reputation: 368Reputation: 368
maybe text2pdf ?
 
Old 11-19-2017, 12:25 PM   #3
sysfce2
Member
 
Registered: Jul 2009
Distribution: Slackware
Posts: 116

Original Poster
Rep: Reputation: 50
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.
 
Old 11-19-2017, 12:59 PM   #4
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,058

Rep: Reputation: Disabled
For inkscape this works here:
Code:
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.

Last edited by Didier Spaier; 11-19-2017 at 01:01 PM.
 
Old 11-19-2017, 01:18 PM   #5
sysfce2
Member
 
Registered: Jul 2009
Distribution: Slackware
Posts: 116

Original Poster
Rep: Reputation: 50
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.
 
Old 11-19-2017, 01:27 PM   #6
sysfce2
Member
 
Registered: Jul 2009
Distribution: Slackware
Posts: 116

Original Poster
Rep: Reputation: 50
Quote:
Originally Posted by Didier Spaier View Post
For inkscape this works here:
Code:
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.
 
Old 11-19-2017, 02:19 PM   #7
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
sysfce2 --

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

Last edited by kjhambrick; 11-19-2017 at 02:21 PM. Reason: grammar
 
Old 11-19-2017, 02:37 PM   #8
sysfce2
Member
 
Registered: Jul 2009
Distribution: Slackware
Posts: 116

Original Poster
Rep: Reputation: 50
Quote:
Originally Posted by kjhambrick View Post
sysfce2 --

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.
 
  


Reply

Tags
print



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
Printing to cups-pdf via command line with options? devmoc Linux - Software 8 07-14-2011 02:32 AM
cups print to file on command line kairen Slackware 2 01-30-2008 02:05 AM
cups-pdf command-line print .html pages without tags ? o5iri5 Linux - Software 1 08-06-2007 06:24 AM
print files in PDF or html format from the linux command line IBKnobel Linux - Software 3 07-12-2004 09:29 PM
print from command line, normally use cups itsjustme Linux - General 2 06-14-2004 11:14 AM

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

All times are GMT -5. The time now is 07:16 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