za3k / qr-backup

Paper backup of files using QR codes
Other
114 stars 11 forks source link

Make page layout look better #21

Open misaki-web opened 3 years ago

misaki-web commented 3 years ago

Currently, the argument --page allows to set the width and the height (--page 500 600), but the page margins can't be specified. For example, cover instructions basically don't have any margin:

default margin

It would be useful to be able to set horizontal and vertical margins like this:

--page WIDTH_POINTS+HOR_MARGIN_POINTS HEIGHT_POINTS+VER_MARGIN_POINTS

Example:

--page 500+15 600+15

more margin

It would also allow to center the QR codes on the page.

za3k commented 3 years ago

Can you say a little more about why you'd want this? I want to get a feel for the current problems you're hitting (you're basically the first actual user who's contacted me, so I'd like to learn more).

Do you actually want to be able to set margins? Or is zero-margin just too ugly? If a sane default would work I should do that too. For example, maybe equal margins on all sides should be the default, or I maybe the rectangular box is drawing attention to the margins.

On my printer, even the zero margin settings result in a lot of margin on actual paper, but that may not be universal.

misaki-web commented 3 years ago

Do you actually want to be able to set margins?

Actually, I may not if there's enough margin by default and if QR codes are centered. Let's split the discussion in a few parts:

QR Code Alignment

Let's say I must use QR codes version 15 on A4 sheets. With default scale (8), it'll look like this:

Page 1 of 2:

QR code version 15 on A4 sheets, page 1 of 2

Page 2 of 2:

QR code version 15 on A4 sheets, page 2 of 2

Having QR codes centered on the page would have some advantages:

The same example with QR codes centered looks like this:

Page 1 of 2:

QR code version 15 centered on A4 sheets, page 1

Page 2 of 2:

QR code version 15 centered on A4 sheets, page 2

It could be argued either the last page should have the QR codes start at the same top-left coordinates than other pages, like the example above, or if codes should also be centered vertically like this:

QR code version 15 centered on A4 sheets, page 2 centered vertically

I prefer the first option (starting at the same top-left coordinates) because IMO it looks more consistent and it would allow to fold the sheet the same way as other sheets without folding in the middle of QR codes.

Instructions

Instructions on the cover don't have any left margin:

Instructions on the cover

IMO it would look better with some margin, something between 1.5 cm (43 points) and 2.5 cm (71 points), or 1 inch (72 points).

While I'm at it, I think that it would be even better if instructions would be a little bit bigger (right now, it's so small, it looks like font 7 pt) and if it was added as text instead of as an image, so copy/paste would be possible if we have access directly to the digital file.

Page Borders

On my printer, even the zero margin settings result in a lot of margin on actual paper, but that may not be universal.

Yeah, printer models vary a lot about the printing area. Some can do borderless printing. A quick way to test a printer is to open LibreOffice, change the top, right, bottom and left margins to 0 and validate. Usually a popup warning will be displayed if the printer can't handle borderless printing and it'll adjust margins to the minimum supported by the printer driver. For example, the printer I have access to right now can print with 1 mm margin from the top and 3 mm from the left.

It also depends on the printer configuration or the software used to print the PDF document. In case the content is outside the printing area (like the instructions that don't have any margin), it may or may not automatically add margin, scale content, center the scaled content, etc.

So, IMO it means that if you want to keep page borders in PDF generated by qr-backup, I think that it may be a good idea to make it optional. Personally, I would prefer no borders:

Page Numbers

It doesn't solve the page number margins. Like instructions, I think some default margin would be better, but it greatly depends on the position of the page numbers. Some printers can't print easily near the bottom, like the printer I have access to right now must have a minimum margin of 14 mm at the bottom while only 1 mm is needed at the top.

I see in the code this comment:

# Add page numbers after. Currently page-numbering is perfectly reliable, but we're about to add more complicated layout options.

Would it be about an option to choose the position of the page numbers (top left, top right, bottom left, bottom right, none, label)? The option "label" may add the page number in the label text. For example, labels are like this by default:

code 18/30 lorem-restored.txt

Removing the word "code" would add some space (even when page numbers are not added in labels, it would add more space to the file name) and the page number could be added like this:

P2/2 18/30 lorem-restored.txt

If there were such an option (--page-layout), I would choose "label" and it would solve the page numbers too close to the edge.

anarcat commented 1 year ago

While I'm at it, I think that it would be even better if instructions would be a little bit bigger (right now, it's so small, it looks like font 7 pt) and if it was added as text instead of as an image, so copy/paste would be possible if we have access directly to the digital file.

in #51 i suggest shifting to a monospace font. DejaVu Sans Mono is slightly bigger and more readable, IMHO.

there's also a discussion specifically about margins in #49 that you might be interested in.

i agree the page layout could look nicer. in comparison, paperbackup is gorgeous, but that comes at a hefty dependency cost (they use Python PyX, which uses LaTeX to generate the layout).