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

CSS media queries #24

Closed
mb21 opened this issue Aug 29, 2017 · 7 comments
Closed

CSS media queries #24

mb21 opened this issue Aug 29, 2017 · 7 comments
Assignees
Labels

Comments

@mb21
Copy link

mb21 commented Aug 29, 2017

Since iA Writer 4.0.4 (or possibly 4.0.3), when exporting to PDF the media queries that are responsive to the width of the document in my template are broken.

The CSS inside @media (max-width: 590px) used to not take effect when printing/exporting. Now I need to use the ridiculously low @media (max-width: 90px).

What's the recommended way to do those? @media print doesn't seem to take effect.

@antons
Copy link
Collaborator

antons commented Aug 30, 2017

  • What paper size is set in File → Page Setup?
  • Which macOS version is installed on you machine?

4.0.4 fixed an issue where PDF generation was broken on High Sierra when headers or footers were enabled. As far as I can see, everything else is working well on Sierra and High Sierra. Print media queries are working as intended when I export documents using built-in templates.

@mb21
Copy link
Author

mb21 commented Aug 30, 2017

  • Page Setup: A4
  • macOS Sierra 10.12.6 (16G29)
document.write( window.innerWidth );
document.write( window.outerWidth );
document.write( window.innerHeight );
document.write( window.outerHeight );

The above js returns the following values in print mode:

100, 100, 100, 122

Sorry about the print media queries, they indeed seem to work correctly for me as well.

@antons antons self-assigned this Aug 30, 2017
@antons antons added the Bug label Aug 30, 2017
@antons
Copy link
Collaborator

antons commented Aug 30, 2017

@mb21 You’re correct, the hidden window used for generating PDFs doesn’t match paper dimensions. Thank you for reporting this issue! We’ll fix it in the next update.

@mb21
Copy link
Author

mb21 commented Sep 7, 2017

Thanks for looking into this.

btw, what is the measure for a px you are using? Are you following the CSS spec's 1px=1/96inch?
(The reason I'm asking is that I've been using pixels all over for font-sizes etc. but would like to use cm for the page margins... but the math doesn't seem to add up with 96dpi.)

@antons
Copy link
Collaborator

antons commented Sep 8, 2017

WebKit has an issue where physical dimensions are off when printing, mentioned in #12.

@mb21
Copy link
Author

mb21 commented Nov 25, 2017

This is fixed in iA Writer 4.1.1, the above js now returns the following when printing to A4:

596
596
842
842

@mb21 mb21 closed this as completed Nov 25, 2017
@antons
Copy link
Collaborator

antons commented Nov 25, 2017

@mb21 Thank you again for reporting the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants