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

zoomFactor doesn't seem to change the output of pdf rendered #149

Open
a0js opened this issue Jun 8, 2016 · 2 comments
Open

zoomFactor doesn't seem to change the output of pdf rendered #149

a0js opened this issue Jun 8, 2016 · 2 comments

Comments

@a0js
Copy link

a0js commented Jun 8, 2016

I've been experimenting with this fantastic module, but I can't seem to get the zoom factor to work. (I'm attempting to get 100px per inch on a Letter size pdf). Logs are printing the following when I try a zoomFactor of 3.0

electron-html-to:electron-log [Worker 8fd99f30-2dc5-11e6-b9c6-079a8d60bf2a] +1ms creating new browser window with options: { width: 600,
height: 600,
webPreferences:
{ nodeIntegration: false,
javascript: true,
webSecurity: false,
zoomFactor: 3,
preload: '/Volumes/code/pdfaas/node_modules/electron-html-to/lib/scripts/preload.js' },
show: false }

But the resulting pdf is the same as when the zoomFactor is 1. Any guidance would be greatly appreciated.

@bjrmatos
Copy link
Owner

bjrmatos commented Jun 9, 2016

@a0js hmmm it should work 😄 do you have some code/repository to play with it? also what version of electrondo you have installed?

one tip: you can activate the ELECTRON_HTML_TO_DEBUGGING=true env var to see the BrowserWindow of electron

@a0js
Copy link
Author

a0js commented Jun 22, 2016

Below is the object I'm sending into the converter. I'm using the electron-prebuilt package ver. 1.2.2. When I activate the BrowserWindow, it does appear to be larger, yet when printing the page, the zoom doesn't seem to be applied, and it's printing the same size. This might be an issue with the browser rather than your module though.

EDIT: I'm using a Mac, I wonder if the system print settings are pulled into electron. When I zoom in on Chrome and do a print preview, the scaling isn't right either.

{ "html":"<html><head><link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'><style>html,body,div{font-family:'Open Sans',serif;padding:0;margin:0} div{background:repeating-linear-gradient(0deg,#606dbc,#606dbc 50px,#465298 50px,#465298 100px);height:1100px;overflow:hidden}</style></head><body><div>Hello World</div></body></html>", "browserWindow":{ "webPreferences":{ "zoomFactor":3 } }, "pdf":{ "pageSize":"Letter", "printBackground":true, "marginsType":1 } }

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

No branches or pull requests

2 participants