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

Printing local HTML file on Mac does not work #216

Open
karzelek-hi opened this issue Feb 8, 2018 · 5 comments
Open

Printing local HTML file on Mac does not work #216

karzelek-hi opened this issue Feb 8, 2018 · 5 comments

Comments

@karzelek-hi
Copy link

I tried to run electron-pdf on several HTML files I have on my local iMac, but the output PDF is always completely blank.
When running electron-pdf on an URL presenting the very same HTML content all works fine, just like one would expect.

Also tried to naming the CSS manually for the local HTML files, did not work either.

  • electron-pdf Version is 1.2.2, installed via NPM
  • macOS version is 10.13.3
@codecounselor
Copy link
Collaborator

If you can include the command you invoked, the output, and a sample HTML file that may help someone troubleshoot your issue.

@karzelek-hi
Copy link
Author

While creating test HTML I think I came closer to the reason: Relative references to files go wrong.

The HTML is stupidly simple:

<html><head>
<title></title>
</head>
<body>
    <h1>Hello World</h1>
</body></html>

When calling in the bash (being in the directory containing this HTML) the following command I get a purely empty PDF:

electron-pdf ./index.html ~/Desktop/empty.pdf

empty.pdf

But when I name the input file with full file name the result is correct:

electron-pdf ~/Desktop/index.html ~/Desktop/correct.pdf

correct.pdf

@defusioner
Copy link

defusioner commented Nov 17, 2018

+1
[email protected],
MacOS 10.14.1

@defusioner
Copy link

defusioner commented Aug 30, 2019

UPD: for "electron-pdf": "4.0.8" (in my case, using with CRA), the problem was that CRA generates its assets relatively: in the final HTML, an asset is included as /static/... instead of ./static/....

So simple config: adding homepage: './' to package.json solved the problem

@muster-mark
Copy link

electron-pdf ~/Desktop/index.html ~/Desktop/correct.pdf

Can the docs be updated to specify that an absolute file path is required on Mac? Doing it how the docs suggest doesn't work on Mac and causes much headache.

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

4 participants