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

Upgrade to latest Electron Version (1.7.4) #204

Closed
nkoterba opened this issue Jul 10, 2017 · 8 comments
Closed

Upgrade to latest Electron Version (1.7.4) #204

nkoterba opened this issue Jul 10, 2017 · 8 comments

Comments

@nkoterba
Copy link

First, great work on an awesome utility! 👍

Is there a reason, the current version of Electron used is almost 3 minor versions behind?

We are going to have to fork your project because the current version of electron used 1.4.15 (https://github.com/fraserxu/electron-pdf/blob/master/package.json#L48) has a font rendering/anti-aliasing issue.

I converted the same HTML file below.

This is using current electron-pdf (and Electron version 1.4.15 internally):
image

This is using my fork where all I did was upgrade Electron (to 1.7.4):
image

nkoterba pushed a commit to nkoterba/electron-pdf that referenced this issue Jul 10, 2017
@codecounselor
Copy link
Collaborator

codecounselor commented Jul 10, 2017

There is a reason, some of the content my company exports does not render correctly with the newer versions of Chromium. And I have not been able to determine the root cause of why that is. So we must say on the 1.4.x version.

that being said, the 1.3 release of electron-pdf uses 1.6.x and could be upgraded to a newer 1.6 version anytime. My intent is to make all fixes/enhancements on 1.2 and merge them forward into 1.3. Since 1.7 is still in Beta I don't know if now is the time to base electron-pdf off of 1.7. But, if there are fixes in 1.7 that are not in 1.6 then that may warrant an electron-pdf 1.4 version

In summary:

  • electron-pdf 1.2.x => electron 1.4.x
  • electron-pdf 1.3.x => electron 1.6.x
  • electron-pdf 1.4.x => electron 1.7.x - Future branch TBD
  • electron-pdf 2.0.x => electron 1.7.x+ - Future major release that will introduce some breaking changes

@nkoterba
Copy link
Author

@codecounselor Thanks for the quick reply. I now understand the reasoning. When I saw that electron was specifically set to an exact version I assumed there was some type of compatibility issue.

When I ran my test above I just cloned master, failing to clone 1.3.x branch which is why I still had the old 1.4.x version of electron. I first encountered this issue using electron-pdf installed directly from npm (so version 1.3.0 which internally uses electron 1.6.x). I guess Electron 1.6.x still has this rendering issue. We also are looking to use the CSS grid style (https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout), which appears supported on 1.7.x of electron but not in 1.6.x.

So for the time being we'll keep our fork and look for future releases.

I'll close this issue but it may be useful to include the version mapping somewhere on the main Markdown page (unless I just missed it...if so, my fault).

Thanks!

@codecounselor
Copy link
Collaborator

@forgo
Copy link

forgo commented Jan 20, 2019

@nkoterba
Do you having a working fork which supports CSS grid? I am getting an incorrectly rendered PDF which seems to ignore my grid columns.

@codecounselor
Do you have any suggestions for a quick-fix in getting CSS grid to behave?

@codecounselor
Copy link
Collaborator

I'm not sure about your CSS grid issues, but you can try a newer version of Electron by just installing it with npm install electron@latest or whatever version you want.

If you find that a new(er) version fixes your problem I can create a new branch.

@forgo
Copy link

forgo commented Jan 21, 2019

@codecounselor

I'm not sure if there's a better way of going about this, but I used a package called npm-force-resolutions to override electron-pdf's default dependency version of electron to 1.7.16, and doing so seems to have allowed me to render my PDF with CSS grid, and it looks great!

If you could use a branch that leverages 1.7.16, I would greatly appreciate it, so that I do not have to jump through all these hoops =)

The process was a bit convoluted, so I'll document what I did, for posterity:

npm i --global npm-force-resolutions

To see the initial/existing dependency tree for electron (this should show the different version under electron-pdf if you have electron installed separately.

  • npm ls electron

This is how I found the available 1.7.16 version in npm

  • npm view electron

Added this section to my package.json

"resolutions": {
    "electron": "1.7.16"
  },

This cmd didn't work at first because of a few missing dependencies:
rm -rf node_modules/ && npm-force-resolutions && npm i

In order to install those needed dependencies manually, I had to:

  • npm i --save rimraf klaw home-path

And then re-run:

  • rm -rf node_modules/ && npm-force-resolutions && npm i

To confirm you've made a glitch in the matrix =P:
npm ls electron

├── electron@4.0.1
└─┬ electron-pdf@1.3.1
  └── electron@1.7.16  invalid

At this point, generating a PDF properly was a matter of running my existing npm script:

  • npm run pdf

For example:

"pdf": "electron-pdf http://127.0.0.1:8080/ ./output.pdf",

@codecounselor
Copy link
Collaborator

I can do that, but first I'm wondering if you could also use 4.0.1? 1.7.x is quite old now as well.

@codecounselor
Copy link
Collaborator

Master is updated to use electron 4.0.2 and a npm package was released as electron-pdf@4.0.1
#231

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

3 participants