Seemingly, UNIX/CUPS driven Printers display paper margins in “Points” by default with python. Is there any command by which the default display can be altered to be seen either in inches or in millimeters?
Perhaps you can find answers here:
Though the conversion of 72 Points = 1" = 25.4 mm is available for manual intervention for setting page margins, I was looking for a terminal solution, which I couldn’t find.
The link suggested does not provide an answer. No luck!
I wonder: are you trying to write your own printer driver or (more likely) trying to print something from a certain application?
In case of the latter: Which one?
No, definitely NOT writing the printer driver on a “smoothly working printer with no problems”! Having got used to setting printer paper margins either in inches or in millimeters, I was a wee bit perplexed to find (python) “Points” as the metric. I was just wondering whether the python driven default display of “Points” could be altered to have the display in “inches or millimeters”, using the command line. I scanned the CUPS Manual for a clue for “margin setting” the print requirement, but didn’t succeed.
Python is a programming language, it doesn’t display anything and I don’t believe it even has a standard printing interface, so you must be using some sort of library or module (or the application you’re working with is using one). So the question remains, where are you encountering this “python driven default display” in points units?
Most likely, the units can be changed, but we have to know where they’re coming from first. It’s not “Python” itself, which has no knowledge of such things.
I am uploading a self-explanatory snapshot for a HP 2131 Printer, in which the unit of measurement for MARGINS (Left, Right, Top and Bottom) is on display in “Points”. My query was whether the same could be altered through the Linux command line for display in
But that doesn’t the answer where Python gets the functionality from. It certainly is not part of the stdlib.
CUPS internally uses mm, however you still haven’t told us from which application you’re trying to print, so it’s pretty hard to reproduce that exact menu.
Application details for HP Printer:
bionic (1) hp~check.1.gz
I’m giving up … The question asked by @FeRDNYC and me wasn’t so hard and yet there seems to be no way to get an answer.
Suppose I wanted to print a text. I’d open my favourite text editor (say kate), hit
If I wanted to print a LibreOffice document, I’d get a different dialogue.
Ok, I think I have a handle on this now. Thanks for the screenshot, it was helpful.
Not entirely accurate. What your screenshot shows is a configuration interface to the printer definition, that lets you customize the dimensions of the legacy Text Mode output. The units are in points because those are the units used in the
.PPD file that contains the printer configuration, and the interface you’re looking at is extremely low-level.
It will also have no effect unless you’re using the printer in legacy line printer mode (text-only), which trust me, you are not. Even if you print text-only documents, you’ll be printing them rendered to PostScript or PDF document. The interface you’re looking at is not intended to be used… well, period, really, these days. It’s from 30 years ago. Literally.
Afraid not, the fact that the config tool happens to be implemented in Python is immaterial. The issue is the PPD data being generated.
Thanks Frank! You have got a hang of my problem. I am using Libre Office Version 7.0 along with HP 2131 Deskjet Printer for my printing requirements.
How do I go into the “Legacy Line Printer Mode” configuration for the printer to get the desired interface, as suggested by you? The latest Linux compatible software/driver version is in use for the HP 2131 Printer, after verifying on HP support website.
I figured out the solution. The desired configuration is available. My error in comprehension. Sorry for the bother.
Do you mind telling your solution? Perhaps other people have the same problem and googling they might stumble upon this thread.
At the outset, apologies for my inability to possibly state the rather simple problem cogently, which made you “…give up!”
It was basically an error in my understanding; when I was in the process of setting up a page with non-standard margins (i.e; NOT, standard 1’’ on all four sides of the media/paper A4 size), the window (wrong ‘interface’ of Frank’s message) as shown in my earlier snapshot opened. I got puzzled when I saw “points” as the metric, and for a moment I couldn’t perceive how to set a margin of 6" from the top, which was my requirement for printing (in Windows, it used to be direct access to the margins set up) then. That is when I posed the query on the forum.
I got the clue, in fact, from your last post, where you cited ‘say, Kate’ as your text editor. Snapshot of my text editor (No Kate like name thogh), which I dug up eventually, has the caption: “Page Style: Default Style” is reproduced below:20201006_Default_Page_PrintEditor|690x494
I wrongly perceived the issue to be a back-end code problem, whereas it was actually a case of Libre Office user-end formatting exercise. Sorry for the inconvenience, once again.