Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.

Ensure a consistent 72 dpi for Linux headless #10659

Closed
ariya opened this issue Jul 14, 2012 · 19 comments
Closed

Ensure a consistent 72 dpi for Linux headless #10659

ariya opened this issue Jul 14, 2012 · 19 comments
Assignees
Milestone

Comments

@ariya
Copy link
Owner

ariya commented Jul 14, 2012

ariya.hi...@gmail.com commented:

Apparently the screen resolution is not set to 72 dpi on every platform we support.

Disclaimer:
This issue was migrated on 2013-03-15 from the project's former issue tracker on Google Code, Issue #659.
🌟   12 people had starred this issue at the time of migration.

@ariya
Copy link
Owner Author

ariya commented Jul 14, 2012

@ariya
Copy link
Owner Author

ariya commented Jul 14, 2012

ariya.hi...@gmail.com commented:

Related pull request: #286.

@ariya
Copy link
Owner Author

ariya commented Sep 19, 2012

ariya.hi...@gmail.com commented:

Rescheduled to 1.8.

 
Metadata Updates

  • Milestone updated: Release1.8 (was: Release1.7)

@JamesMGreene
Copy link
Collaborator

james.m....@gmail.com commented:

I agree that we should provide a consistent default value of 72 for resolution (DPI) fonts, PDFs, etc. across all supported platforms. However, I also think we should provide the user with a mechanism to set their own choice DPI, as mentioned by other users in comments on the Pull Request and in forum discussions, e.g. https://groups.google.com/forum/m/?fromgroups#!topic/phantomjs/V9EU0UdT1cg

@ariya
Copy link
Owner Author

ariya commented Dec 24, 2012

ariya.hi...@gmail.com commented:

Rescheduled to 1.9.

 
Metadata Updates

  • Milestone updated: Release1.9 (was: Release1.8)

@ariya
Copy link
Owner Author

ariya commented Dec 24, 2012

ariya.hi...@gmail.com commented:

I found that all we need is to implement physicalSize() for our minimalistic QPlatformScreen implementation. Because it was not implemented, the default 100 dpi was used and that causes the inconsistency.

@ariya
Copy link
Owner Author

ariya commented Dec 24, 2012

ariya.hi...@gmail.com commented:

It's more complicated on Windows because Qt just uses the values from GetDeviceCaps and LOGPIXELSX/LOGPIXELSY. According to http://stackoverflow.com/questions/645352/is-the-number-of-pixels-per-inch-standard-on-all-windows-pc-displays-logpixels, the return values could be anything from 88, 96, 120, and maybe even more variations on the future Windows version.

I think nothing we can do about Windows for the near future. Hence, I plan to change the issue title to only cover OS X and Linux.

@ariya
Copy link
Owner Author

ariya commented Dec 24, 2012

ariya.hi...@gmail.com commented:

Linux: Ensure we use 72 dpi.
3f42fb230f

@ariya
Copy link
Owner Author

ariya commented Dec 24, 2012

ariya.hi...@gmail.com commented:

 

 
Metadata Updates

  • Title updated: Ensure a consistent 72 dpi for Linux headless rendering

@ariya
Copy link
Owner Author

ariya commented Dec 24, 2012

ariya.hi...@gmail.com commented:

 

 
Metadata Updates

  • Status updated: Fixed

@ariya ariya closed this as completed Dec 24, 2012
@JamesMGreene
Copy link
Collaborator

james.m....@gmail.com commented:

 

@JamesMGreene
Copy link
Collaborator

james.m....@gmail.com commented:

Filed Issue #934 to pursue fixing this for Windows in the future.

@ferama
Copy link
Contributor

ferama commented Dec 24, 2012

marco.fe...@gmail.com commented:

Still not fixed for me :( For some reason I still have different pdf outputs from mac os x version and from linux version

@ariya
Copy link
Owner Author

ariya commented Dec 24, 2012

ariya.hi...@gmail.com commented:

What about PNG output? The PDF output relies on the print engine which may have some slight differences.

@ariya
Copy link
Owner Author

ariya commented Dec 24, 2012

ariya.hi...@gmail.com commented:

With the 72 dpi change I have committed, QWebFrame::print gives zoomFactorX and zoomFactorY both to 1.

@ariya
Copy link
Owner Author

ariya commented Dec 24, 2012

ariya.hi...@gmail.com commented:

Here is a test script I used:;

var page = require('webpage').create();
page.content = '

Hello

';
page.render('dpi.pdf');
phantom.exit();

The PDF results can be seen in the attachment, as well as the comparison screenshot.

 
Metadata Updates

  • Title updated: Ensure a consistent 72 dpi for Linux headless

@ferama
Copy link
Contributor

ferama commented Dec 24, 2012

marco.fe...@gmail.com commented:

try this:

var page = require('webpage').create();

page.paperSize = {
format: 'A4',
margin: "1cm",
};

page.content = "

Test
";
page.render("out.pdf");
phantom.exit();

out.1.6-linux-mypatch obtained with the force dpi=72 patch added to phantomjs 1.6 (#286)

@ariya
Copy link
Owner Author

ariya commented Dec 24, 2012

ariya.hi...@gmail.com commented:

Did you try with version 1.8? Unfortunately, this one did not make it to 1.8. It will be part of 1.9, meanwhile you need to build it yourself.

@ariya
Copy link
Owner Author

ariya commented Jan 5, 2013

ariya.hi...@gmail.com commented:

Issue 750 has been merged into this issue.

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

No branches or pull requests

3 participants