naturalcrit / homebrewery

Create authentic looking D&D homebrews using only markdown
https://homebrewery.naturalcrit.com
MIT License
1.05k stars 319 forks source link

A4 PDF - White Gap #461

Closed Zephilinox closed 6 years ago

Zephilinox commented 6 years ago

When you go to save a PDF of an A4 brew, there are a few lines of white space at the bottom of every page. These lines aren't there in the normal homebrewery view, nor are they there when saving a PDF that's Letter sized. They also aren't visible when you close the printing popup. It's only when going to save as a PDF and you can see the preview. The saved PDF also has these white gaps.

Additional Details

Print Link : http://homebrewery.naturalcrit.com/print/HyXqzpGLwW?dialog=true

Image

HeruAsatru commented 6 years ago

try this:

.phb{ width : 210mm; height : 297mm; }

i find that you lose a lot of space with A4, so i use this for my brews:

.phb{ width : 210mm; height : 297mm; padding: 1cm 1cm; padding-bottom: 1.5cm; }

Edit: I don't know why the homebrewery uses these crude numbers, a4 is actually 210 mm × 297 mm per definition. https://en.wikipedia.org/wiki/ISO_216#A_series

calculuschild commented 6 years ago

What are the actual dimensions of pages in the Player's Handbook? And the margins and such?

HeruAsatru commented 6 years ago

I think they are in the letter format: 215.9 by 279.4 mm https://en.wikipedia.org/wiki/Letter_(paper_size)

the margins should be those used by the homebrewery: top: 1cm;
right: 1.7cm;
bottom: 1.5cm;
left: 1.7cm;

jimcullenaus commented 6 years ago

I had a similar problem.

I set the following at the top of the document

<style>
.phb {
    width : 210mm;
    height : 297mm;
}
</style>

And by default, Chrome wanted to print it out at a 98% scale, which left large white borders around it.

I changed to a 100% scale manually, and this resulted in each page printing out exactly right, but the PDF printer inserting an entire blank page between each of my pages.

Compare this PDF, at 99% scale, with this PDF, at 100% scale. Both generated from this Homebrewery document.

This problem exists both when printing to PDF using Chrome's PDF printer, and when using the macOS built-in PDF printer.

jimcullenaus commented 6 years ago

Wait, on second thought, I think I see more or less why the problem exists. On the 100% scale one, there is a small white strip at the top of every page, and a roughly equal sized strip of stuff just under that white strip, at the top of each of the mostly blank pages. It seems to me like if you could get rid of that white strip at the top, the blank pages would fix themselves.

Not sure if it's possible to get rid of this white strip, or how to do it if so. But it does not exist when printing an A4 page to A4 at 99% scale, and it does not exist when printing a Letter page to Letter at 100% scale (a sample of which can be found in this document).

Zephilinox commented 6 years ago

Hmm well after tweaking the width and height I figured out that if you go too far on one end it gets scaled down so that there's a white line on the right side of the page, or if go too far on the other end it gets and there's a white line on bottom of the page. I played around with it for a bit with a few different decimals until I got something decent.

The weird thing is that after doing all that and then trying again with the default A4 sizes it seemed to be fine, when the defaults weren't working before. Might have just been an issue with chrome.