How do I print a file from the command line at the correct size...

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Post Reply
Pastcal
Level 3
Level 3
Posts: 180
Joined: Tue May 07, 2013 12:06 pm

How do I print a file from the command line at the correct size...

Post by Pastcal »

<saga> Yes, me again with the medical image scanner. This time, I'm trying to print the images from the command line. The images are available as pdf files and when printed from a pdf viewer come out correctly, but when printed from the command line, using lp the images are too large. I tried using the command line switch -o media=a4 [1]but the result was identical. How can I resize the image to shrink it to the size of the paper in the way that image viewers do? Thanks </saga>

[1] $ lp -o media=a4 -d HL-L2300D autoprint.pdf
1000
Level 6
Level 6
Posts: 1040
Joined: Wed Jul 29, 2020 2:14 am

Re: How do I print a file from the command line at the correct size...

Post by 1000 »

Check
https://www.cyberciti.biz/tips/linux-un ... -size.html

You can also try print with libreoffice, but I don't see option to resize
https://help.libreoffice.org/latest/en- ... eters.html
Shiva
Level 3
Level 3
Posts: 141
Joined: Thu Jul 07, 2022 11:25 am

Re: How do I print a file from the command line at the correct size...

Post by Shiva »

Pastcal wrote: Thu Mar 14, 2024 12:31 pm The images are available as pdf files and when printed from a pdf viewer come out correctly, but when printed from the command line, using lp the images are too large.
Did you try to leave the formatting job to the pdf viewer before sending it to lp through a pipe ?
Example with Xreader, the LM default document viewer :

Code: Select all

xreader -i 2 -s "./document.pdf"
opens "document.pdf" from the current working directory, on page 2 in presentation mode according to xreader man page.

So, I would certainly give a try to :

Code: Select all

xreader -i 2 -s "./document.pdf" | lp
to print it from command line
Post Reply

Return to “Scripts & Bash”