# How to print a PDF from the command line and scale it on Linux #### September 25, 2021

What I want to do:

Print an A6 PDF centred on an A4 page from the command line on Linux

What I tried:

Tried to use evince and Firefox but they have no command line print options for linux.

What worked:

Calculate the margins and run `lp` or `lpr` by doing the following

Dimensions of A4 are 210mmx297mm

Dimensions of A6 are 105mmx148mm

So to print an A6 page centred in an A4 the margins in mm

Calculating the short side margins

210mm-105mm = 105mm

105/2 = 52 .5mm

Calculating the long side margins

297-148=149mm

149/2 = 74.5mm

There are 72 points (pt) per inch an inch is 25.4mm so divide the margin size in mm by 25.4 to get the size in inches and then multiply by 72 to get the size in points.

Convert millimetres to points

Short side

In points (52.5mm/25.4mm) * 72 = 149pt

Long side

In points (74.5mm/25.4mm) * 72 = 211

So the margin-left and right value is 149pt and the margin-top & bottom value is 211pt

The `lp` or `lpr` commands are as follows

Note that this sends to the default printer you may need to specify a printer too. (run `man lp` or `man lpr `to get the options)

```lp -n 1 -o page-ranges=1 -o fitplot=true -o page-bottom=211 -o page-top=211 -o page-left=149 -o page-right=149 barcode99.pdf
```
```lpr -#1 -o page-ranges=1 -o page-ranges=1 -o fitplot=true -o page-bottom=211 -o page-top=211 -o page-left=149 -o page-right=149 barcode99.pdf
```

## CakePHP 4 – Dump A List of Form Templates

In your view somewhere enter <?php dd(\$this->Form->getTemplates()); ?> Reload the page and then you can view the...

## Use a Value Object in your Entity Accessors

Just looking at Laracasts https://laracasts.com/series/whip-monstrous-code-into-shape/episodes/6 and God Object...

## ZPL SBPL

Zebra Printer Language http://labelary.com/viewer.html The above website has a page where you can enter ZPL and it...