Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printing with Chrome on a Mac / default settings -> words run off page on US letter #270

Closed
cgreene opened this issue Oct 9, 2019 · 6 comments · Fixed by #272
Closed

Comments

@cgreene
Copy link
Contributor

cgreene commented Oct 9, 2019

Printing the PDF generated at https://greenelab.github.io/biopriors-review/v/7e8a3a2c7f58bf8fee3c1547870f54f98141fdb1/manuscript.pdf from Chrome on a mac leads to text that runs off the page.

Screen Shot 2019-10-09 at 2 12 15 PM

This isn't apparent before the print dialog in chrome:

Screen Shot 2019-10-09 at 2 11 59 PM

@dhimmel
Copy link
Member

dhimmel commented Oct 9, 2019

The PDF uses the paper size of "A4, Portrait (8.26 × 11.69 inch)". On a sheet of paper with this size, the margins will appear correctly. The issue is that our lab printer in the U.S. uses "letter" paper (8.50 × 11.00 inch). This page visualizes the size difference:

image

If we switch to letter, then A4 paper will have the sides cutoff.

I can imagine a couple options:

  1. Instruct users to print using "fit to size" scaling to reduce the dimensions of the text if needed.
  2. Use a page size that is 8.26 × 11.00 inch (the min in both dimensions).

We've previously struggled with this issue in #105 and #107. In a535f7b, we switched to letter size, but this is no longer part of the default CSS:

@media print {
@page {
/* suggested printing margin */
margin: 0.5in;
}

So I guess athenapdf is defaulting to A4.

@vincerubinetti
Copy link
Collaborator

I think it makes more sense to specify a default size in whatever is actually doing the printing, rather than in the CSS which is usually harder to change. Thus I don't think we should hard code it into the CSS.

Two additional half measures we discussed in person:

  1. Support better print configuration in the command line. When building a manuscript, it should say in the console something like Building PDF with Athena PDF at paper size: A4. This will make people more aware of what is going on and make errors easier to catch. We could also provide almost like a print dialog like any other to select the page size on every print:
Current print size: A4
Change print size: 1) US Letter 2) A4 3) Other 4) Don't ask again (use current as default)
  1. Always print two versions of the PDF: US Letter and A4, and include those words in the filename. This might make people more aware that there is a difference and that they'll have to do some kind of fitting/scaling.

Instruct users to print using "fit to size" scaling to reduce the dimensions of the text if needed.

Where would we do this in a place that is obvious and useful but not distracting where it is irrelevant.

Use a page size that is 8.26 × 11.00 inch (the min in both dimensions).

This might lead to hard to troubleshoot issues where users don't know why their margins aren't square. It's also sort of a dirty workaround, and not an actual solution.

I think the true solution is using my 1) above, and somehow making sure in print dialogs that "fit to page" is always selected.

@agitter
Copy link
Member

agitter commented Oct 9, 2019

Supporting print configuration through the command line, whether via an environment variable used by build.sh or something else, makes sense to me.

@dhimmel
Copy link
Member

dhimmel commented Oct 10, 2019

Thus I don't think we should hard code it into the CSS.

I agree. The reason being is that now if someone prints the HTML from their browser, they can print to whatever page size their printer uses / the default for their locale. There is no issue currently when users print from HTML.

The issue occurs when users print manuscript.pdf. Currently the issue occurs for U.S.-based users whose paper is letter sized. The issue only occurs if the user does not select the "scale to fit" option in the print menu.

Supporting print configuration through the command line, whether via an environment variable used by build.sh or something else, makes sense to me.

athenapdf has a --pagesize argument. We could add --pagesize=A4 to build.sh, so manuscript creators see where to change it. For example, if you know most of your readers will be U.S. based, you might want to specify --pagesize=Letter.

But the main problem is that the person who is printing the PDF manuscript is rarely the one who is configuring build.sh.

@agitter
Copy link
Member

agitter commented Oct 11, 2019

But the main problem is that the person who is printing the PDF manuscript is rarely the one who is configuring build.sh.

That is also true for authors who generate a PDF manuscript from LaTeX. I don't see it as a big problem if the person who runs build.sh sets an athenapdf --pagesize that makes sense for their locale. I like the idea of making that configurable in the build script.

dhimmel added a commit to dhimmel/manubot-rootstock that referenced this issue Oct 11, 2019
Closes manubot#270

The existence of two common pagesizes for physical paper, A4 and
Letter, creates user confusion. Sometimes users print a PDF with
A4 dimensions onto Letter paper and do not use the "scale to fit"
printer setting. This leads to truncated text at the bottom of the
page. Ultimately, it is not a Manubot issue, but confuses Manubot
users nonetheless.

When exporting the HTML to PDF Manubot uses an A4 pagesize, which
while less common in the U.S. is an international standard. This
commit explicitly specifies the default behavior, such that there
is no functional change. However, by specifying the pagesize, its
more clear to Manubot users where pagesize gets set. This will
hopefully spare users extra debugging.

If manuscript viewers would like to export to a pagesize that is
different from the one used by manuscript.pdf, the recommendation
is for them to print the HTML page to PDF from their browser and
specify the desired page size there. For this reason, our CSS
style does not specify a default page size, but instead just a
margin.

athenapdf --pagesize <size>
page size of the generated PDF (default: A4, values: A3|A4|A5|Legal|Letter|Tabloid)
https://github.com/arachnys/athenapdf/blob/bf3d5d0070b079bc38f76f56aeb2ca09f3b3454c/cli/src/athenapdf.js#L39
@dhimmel
Copy link
Member

dhimmel commented Oct 11, 2019

I like the idea of making that configurable in the build script.

See #272. I don't use an environment variable because at this point it's probably easier to change just the one line.

General advice to readers

If you are printing a manuscript whose PDF uses a different page size than your physical paper, either:

  1. select "scale to fit" in the print options
  2. print the HTML manuscript directly, which will automatically conform to your paper size

dhimmel added a commit that referenced this issue Oct 11, 2019
Merges #272
Closes #270

The existence of two common pagesizes for physical paper, A4 and
Letter, creates user confusion. Sometimes users print a PDF with
A4 dimensions onto Letter paper and do not use the "scale to fit"
printer setting. This leads to truncated text at the bottom of the
page. Ultimately, it is not a Manubot issue, but confuses Manubot
users nonetheless.

When exporting the HTML to PDF, Manubot uses an A4 pagesize, which
while less common in the U.S. is an international standard. This
commit explicitly specifies the default behavior, such that there
is no functional change. However, by specifying the pagesize, its
more clear to Manubot users where pagesize gets set. This will
hopefully spare users of some debugging.

If manuscript viewers would like to export to a pagesize that is
different from the one used by manuscript.pdf, the recommendation
is for them to print the HTML page to PDF from their browser and
specify the desired page size there. For this reason, our CSS
style does not specify a default page size, but instead just a
margin.

Documentation of the relevant options:

> athenapdf --pagesize <size>
> page size of the generated PDF (default: A4, values: A3|A4|A5|Legal|Letter|Tabloid)

We did not update the WeasyPrint build command because:
> Currently, WeasyPrint does not provide support for adjusting page size or
> document margins via command-line flags.
dhimmel added a commit that referenced this issue Oct 11, 2019
This build is based on
6859ada.

This commit was created by the following Travis CI build and job:
https://travis-ci.com/manubot/rootstock/builds/131569546
https://travis-ci.com/manubot/rootstock/jobs/244832656

The full commit message that triggered this build is copied below:

Specify --pagesize=A4 during PDF export (clarifies default)

Merges #272
Closes #270

The existence of two common pagesizes for physical paper, A4 and
Letter, creates user confusion. Sometimes users print a PDF with
A4 dimensions onto Letter paper and do not use the "scale to fit"
printer setting. This leads to truncated text at the bottom of the
page. Ultimately, it is not a Manubot issue, but confuses Manubot
users nonetheless.

When exporting the HTML to PDF, Manubot uses an A4 pagesize, which
while less common in the U.S. is an international standard. This
commit explicitly specifies the default behavior, such that there
is no functional change. However, by specifying the pagesize, its
more clear to Manubot users where pagesize gets set. This will
hopefully spare users of some debugging.

If manuscript viewers would like to export to a pagesize that is
different from the one used by manuscript.pdf, the recommendation
is for them to print the HTML page to PDF from their browser and
specify the desired page size there. For this reason, our CSS
style does not specify a default page size, but instead just a
margin.

Documentation of the relevant options:

> athenapdf --pagesize <size>
> page size of the generated PDF (default: A4, values: A3|A4|A5|Legal|Letter|Tabloid)

We did not update the WeasyPrint build command because:
> Currently, WeasyPrint does not provide support for adjusting page size or
> document margins via command-line flags.
dhimmel added a commit that referenced this issue Oct 11, 2019
This build is based on
6859ada.

This commit was created by the following Travis CI build and job:
https://travis-ci.com/manubot/rootstock/builds/131569546
https://travis-ci.com/manubot/rootstock/jobs/244832656

The full commit message that triggered this build is copied below:

Specify --pagesize=A4 during PDF export (clarifies default)

Merges #272
Closes #270

The existence of two common pagesizes for physical paper, A4 and
Letter, creates user confusion. Sometimes users print a PDF with
A4 dimensions onto Letter paper and do not use the "scale to fit"
printer setting. This leads to truncated text at the bottom of the
page. Ultimately, it is not a Manubot issue, but confuses Manubot
users nonetheless.

When exporting the HTML to PDF, Manubot uses an A4 pagesize, which
while less common in the U.S. is an international standard. This
commit explicitly specifies the default behavior, such that there
is no functional change. However, by specifying the pagesize, its
more clear to Manubot users where pagesize gets set. This will
hopefully spare users of some debugging.

If manuscript viewers would like to export to a pagesize that is
different from the one used by manuscript.pdf, the recommendation
is for them to print the HTML page to PDF from their browser and
specify the desired page size there. For this reason, our CSS
style does not specify a default page size, but instead just a
margin.

Documentation of the relevant options:

> athenapdf --pagesize <size>
> page size of the generated PDF (default: A4, values: A3|A4|A5|Legal|Letter|Tabloid)

We did not update the WeasyPrint build command because:
> Currently, WeasyPrint does not provide support for adjusting page size or
> document margins via command-line flags.
adebali pushed a commit to CompGenomeLab/lemur-manuscript-archive that referenced this issue Mar 4, 2020
Merges manubot/rootstock#272
Closes manubot/rootstock#270

The existence of two common pagesizes for physical paper, A4 and
Letter, creates user confusion. Sometimes users print a PDF with
A4 dimensions onto Letter paper and do not use the "scale to fit"
printer setting. This leads to truncated text at the bottom of the
page. Ultimately, it is not a Manubot issue, but confuses Manubot
users nonetheless.

When exporting the HTML to PDF, Manubot uses an A4 pagesize, which
while less common in the U.S. is an international standard. This
commit explicitly specifies the default behavior, such that there
is no functional change. However, by specifying the pagesize, its
more clear to Manubot users where pagesize gets set. This will
hopefully spare users of some debugging.

If manuscript viewers would like to export to a pagesize that is
different from the one used by manuscript.pdf, the recommendation
is for them to print the HTML page to PDF from their browser and
specify the desired page size there. For this reason, our CSS
style does not specify a default page size, but instead just a
margin.

Documentation of the relevant options:

> athenapdf --pagesize <size>
> page size of the generated PDF (default: A4, values: A3|A4|A5|Legal|Letter|Tabloid)

We did not update the WeasyPrint build command because:
> Currently, WeasyPrint does not provide support for adjusting page size or
> document margins via command-line flags.
ploegieku added a commit to ploegieku/2023-functional-homology-paper that referenced this issue Aug 6, 2024
Merges manubot/rootstock#272
Closes manubot/rootstock#270

The existence of two common pagesizes for physical paper, A4 and
Letter, creates user confusion. Sometimes users print a PDF with
A4 dimensions onto Letter paper and do not use the "scale to fit"
printer setting. This leads to truncated text at the bottom of the
page. Ultimately, it is not a Manubot issue, but confuses Manubot
users nonetheless.

When exporting the HTML to PDF, Manubot uses an A4 pagesize, which
while less common in the U.S. is an international standard. This
commit explicitly specifies the default behavior, such that there
is no functional change. However, by specifying the pagesize, its
more clear to Manubot users where pagesize gets set. This will
hopefully spare users of some debugging.

If manuscript viewers would like to export to a pagesize that is
different from the one used by manuscript.pdf, the recommendation
is for them to print the HTML page to PDF from their browser and
specify the desired page size there. For this reason, our CSS
style does not specify a default page size, but instead just a
margin.

Documentation of the relevant options:

> athenapdf --pagesize <size>
> page size of the generated PDF (default: A4, values: A3|A4|A5|Legal|Letter|Tabloid)

We did not update the WeasyPrint build command because:
> Currently, WeasyPrint does not provide support for adjusting page size or
> document margins via command-line flags.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants