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

add workaround changing zoom on linux #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add workaround changing zoom on linux #16

wants to merge 1 commit into from

Conversation

pofider
Copy link
Owner

@pofider pofider commented Oct 19, 2015

The pdf generated on linux and windows looks differently. The issue is described here. I have tried the proposed workaround and it is partially working. The output pdf files are still a little bit different, but it is not that significant.

This result is the most far I got:
linux.pdf
windows.pdf

I guess this should be an optional behavior user can opt in. However we should for sure recommend the users to design pdf files on the same platform where the production will run.

@bjrmatos
Copy link
Collaborator

I guess this should be an optional behavior user can opt in.

i think the same too

However we should for sure recommend the users to design pdf files on the same platform where the production will run.

for teams with multiple OS this will be a huge pain (like my team) :(, not cool but i guess this is the best that we can do for now

with phantom 1.9.8 the problem/inconsistency seems to be only in windows, so we should normalize windows not linux/osx .. there are other solutions as described in this thread, will try to dive into it more and try more solutions.

@pofider
Copy link
Owner Author

pofider commented Oct 23, 2015

Hmm. Maybe better do this at once with upgrade to 2.0. Otherwise we could be fixing this twice.

@bjrmatos
Copy link
Collaborator

@pofider seems reasonable.. leave the issue open in case someone explore the problem a little more or find others workarounds :)

@Padam87
Copy link

Padam87 commented Nov 9, 2015

The fix works, but only sort of. The 0.654545 value was no good for me. Had to set it to 0.5625 on linux and 0.75 on windows.

(0.75^2 = 0.5625)

page.open(address, function (status) {
    if (status !== 'success') {
        console.log('Unable to load the address!');
        phantom.exit(1);
    } else {
        page.evaluate(function() {
            document.body.style["transform-origin"] = "0 0";
            document.body.style["-webkit-transform-origin"] = "0 0";
            document.body.style["transform"] = "scale(0.555)";
            document.body.style["-webkit-transform"] = "scale(0.555)";
        });
        window.setTimeout(function () {
            page.render(output, { format: format });
            phantom.exit(0);
        }, 200);
    }
});

@bjrmatos
Copy link
Collaborator

bjrmatos commented Nov 9, 2015

and 0.75 on windows.

i can confirm that the correct value on unix OS is 0.5625 (but probably this won't work on all cases, better to test more reports and see how it goes..)

the workaround is only for unix (linux, osx), windows is a reference for the others OS.

what works on windows with zoom = 1.0, works on unix with zoom = 0.5625.

like i said before i think this patch should be applied in user-land, better for us to wait for phantom 2.0 (it still have issues for pdf rendering)

@zaccak
Copy link

zaccak commented Nov 26, 2015

I've tested this both on windows and mac and can confirm the values above for zoom do fix highchart image sizes but has no effect on the text. On windows the text is still a lot smaller. I set the zoom when I call rasterize.js.

Is there a workaround to getting both the images and text to be consistent on both platforms?

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 this pull request may close these issues.

4 participants