This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Print to File dialogue default directory, is it configurable

Tags: None
(comma "," separated)
User avatar
google01103
Manager
Posts
6668
Karma
25
today's guess is cups and QT combined

this explains how cups could create pdfs by use of the ghostpdf.ppd and/or maybe pdfwrite.ps, these files are located in
/usr/share/ghostscript/9.15/lib

though this is from a Windows app it offers a viable explaination http://www.foxweb.com/document/index.ht ... script.htm

Using Ghostscript in FoxWeb
The following instructions provide information on the use install and test Ghostscript in order to use it to generate PDF files from your FoxWeb scripts. Ghostscript is an interpreter for PostScript and PDF files, with the ability to convert these files to several other formats and to each other. It also provides a PostScript printer driver, which you can use to produce PDF files. Versions entitled GPL Ghostscript are distributed with the GNU General Public License, which allows free use, and free copying and redistribution under certain conditions (including, in some cases, commercial distribution). For details please check the Ghostscript web site, or this site. The creation of PDF files with FoxWeb and Ghostscript is a two step process: First you must direct your report output to a PostScript file and then you must use Ghostscript to convert this file to PDF format.


and this explains QT http://het.as.utexas.edu/HET/O_M/Operat ... nting.html
Printing with Qt
Qt provides extensive cross-platform support for printing. Using the printing systems on each platform, Qt applications can print to attached printers and across networks to remote printers. Qt's printing system also enables PostScript and PDF files to be generated, providing the foundation for basic report generation facilities.


both of this could explain why the package cups-pdf was no longer needed


OpenSuse Leap 42.1 x64, Plasma 5.x

noric
Registered Member
Posts
42
Karma
0
OS
My goal would be to eliminate printer margins from the "print to file" printer.
I've looked into ghostpdf.ppd but I haven't gone much further. It contains this:
Code: Select all
*% *DefaultImageableArea:
*% *DefaultPageRegion:
*% *PageRegion:
*% *ImageableArea:
*% *DefaultPageSize:
*% *PageSize:
*% *DefaultPaperDimension:
*% *PaperDimension:

*% == Above are required


I've tried to paste there the following:
Code: Select all
*DefaultImageableArea: A4
*ImageableArea A4/A4: "0 0 595 842"
*DefaultPaperDimension: A4
*PaperDimension A4/A4: "595 842"


I've rebooted, but nothing has changed... Still big margins.
User avatar
google01103
Manager
Posts
6668
Karma
25


OpenSuse Leap 42.1 x64, Plasma 5.x

noric
Registered Member
Posts
42
Karma
0
OS
What program does the KDE "print to file" dialog invoke? Ghostscript, I suppose. But I can't find where its settings are hidden. I can successfully change the print margins from the GUI, but they revert do default every time. Could the settings be hardcoded, in your opinion?
User avatar
google01103
Manager
Posts
6668
Karma
25
look in /usr/share/ghostscript/ maybe align.ps


OpenSuse Leap 42.1 x64, Plasma 5.x

noric
Registered Member
Posts
42
Karma
0
OS
Apparently, that file should be used to detect the printer hardware margins. Then it would give you a string to add to the gs command every time you want to print with such margins. In other words, it has a different purpose.
I'm still clueless, I'll have a look at the other files in that directory.
User avatar
google01103
Manager
Posts
6668
Karma
25
you could try Ghostprint resources like their irc and mailing list http://www.ghostscript.com/


OpenSuse Leap 42.1 x64, Plasma 5.x

noric
Registered Member
Posts
42
Karma
0
OS
I've experimented with all of the files, but to no avail.

I'll try to get in touch with them. I'll let you guys know. By the way, very strange that nobody ever cared to edit the default settings, that's the first thing I do on my Windows pdf printer software.
noric
Registered Member
Posts
42
Karma
0
OS
They say that Ghostscript has no default margins:
There are, however, no 'default margins' in Ghostscript, it can and will print right to the edge of the media. Any margins must be set elsewhere.
...
Ghostscript won't impose margins, so any margins you see must be written into the PostScript program it receives, which means the application doing the layout is inserting the margins.


Also, they say that ghostpdf.ppd is for MS WIndows users.
User avatar
google01103
Manager
Posts
6668
Karma
25
you could try using the lp command, the issue seems to be how to set the destination to a file as it requires as best I can tell a defined printer though if you install cups-pdf you will should have such a printer

from http://localhost:631/help/options.html
Standard Printing Options

The following options apply when printing all types of files.

Selecting the Media Size, Type, and Source

The -o media=xyz option sets the media size, type, and/or source:


Setting the Page Margins

Normally the page margins are set to the hard limits of the printer. Use the -o page-left=value, -o page-right=value, -o page-top=value, and -o page-bottom=value options to adjust the page margins:

lp -o page-left=value filename
lp -o page-right=value filename
lp -o page-top=value filename
lp -o page-bottom=value filename
lpr -o page-left=value -o page-right=value -o page-top=value -o page-bottom=value filename
The value argument is the margin in points; each point is 1/72 inch or 0.35mm.


Creating Saved Options

Saved options are supported in CUPS through printer instances. Printer instances are, as their name implies, copies of a printer that have certain options associated with them. Use the lpoptions command to create a printer instance:

lpoptions -p printer/instance -o name=value ...


OpenSuse Leap 42.1 x64, Plasma 5.x

noric
Registered Member
Posts
42
Karma
0
OS
Yes, that would be an option. But it's even less convenient than setting the print margins every time.
I think I won't get anywhere without support from KDE devs. How do you think I could get in touch with them? A bug report?
User avatar
google01103
Manager
Posts
6668
Karma
25
what if you created your own PDF printer with defined margines

https://www.linuxquestions.org/question ... in-854173/
https://lists.debian.org/debian-user/20 ... 01290.html

ps - I really know nothing about this stuff but it is an interesting problem

for devs there are irc and mailing lists, I'd suggest mailing list though not sure which


OpenSuse Leap 42.1 x64, Plasma 5.x

noric
Registered Member
Posts
42
Karma
0
OS
Great idea, I have successfully created a PDF printer using /usr/share/ghostscript/9.10/lib/ghostpdf.ppd
The margins are indeed customizable this way, but... the default save path isn't. You fix one thing and another one breaks. Lol
One more advantage of this solution would be that the PDF printer is available to Wine applications, while KDE print-to-file isn't.

I'll try IRC and/or mailing lists and I'll let you know.

Thanks for your efforts and advice.
noric
Registered Member
Posts
42
Karma
0
OS
I've tried KDE IRC channel, but it's not very populated. I couldn't get any answer.
Do you think that filing a bug would be a good idea?
User avatar
google01103
Manager
Posts
6668
Karma
25
think it's a valid bug/wish

found this on bugs.kde.org

https://bugs.kde.org/show_bug.cgi?id=261787 "printing a file to PDF does not allow to set/save a path and/or does not remember the last one"
If this or another issue still needs to be addressed in KDE 4.10 or newer, please add a comment, or report it for "Print Manager".


OpenSuse Leap 42.1 x64, Plasma 5.x



Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan, Sogou [Bot]