wkhtmltopdf and pdfkit issues in python
Clash Royale CLAN TAG#URR8PPP
Hello I am developing an web with python Flask in a linux server, in doing so I am trying to use pdfkit
and wkhtmltopdf
.
I am using a linux server(ubuntu).
In Putty, after logging into my server, at root@myname:~# I downloaded pdfkit using apt-get, and downloaded wkhtmltopdf
. And I go to python by typing python on the command. And I am trying to convert a url into a pdf file by typing in python;
import pdfkit
pdfkit.from_url('sample url','output.pdf')
here I got an error saying:
IOError: wkhtmltopdf exited with non-zero code -6. error:
QXcbConnection: Could not connect to display.
What went wrong? installing was a problem? or which part?
And also, if it works correctly, where can I find the output file? which directory? I am using WinSCP
to manage files.
ubuntu python
add a comment |
Hello I am developing an web with python Flask in a linux server, in doing so I am trying to use pdfkit
and wkhtmltopdf
.
I am using a linux server(ubuntu).
In Putty, after logging into my server, at root@myname:~# I downloaded pdfkit using apt-get, and downloaded wkhtmltopdf
. And I go to python by typing python on the command. And I am trying to convert a url into a pdf file by typing in python;
import pdfkit
pdfkit.from_url('sample url','output.pdf')
here I got an error saying:
IOError: wkhtmltopdf exited with non-zero code -6. error:
QXcbConnection: Could not connect to display.
What went wrong? installing was a problem? or which part?
And also, if it works correctly, where can I find the output file? which directory? I am using WinSCP
to manage files.
ubuntu python
as stated in the above error, you have no display (graphically speaking). I assume that you're using the command-line only Ubuntu server distro?
– Joe
May 6 '16 at 8:36
add a comment |
Hello I am developing an web with python Flask in a linux server, in doing so I am trying to use pdfkit
and wkhtmltopdf
.
I am using a linux server(ubuntu).
In Putty, after logging into my server, at root@myname:~# I downloaded pdfkit using apt-get, and downloaded wkhtmltopdf
. And I go to python by typing python on the command. And I am trying to convert a url into a pdf file by typing in python;
import pdfkit
pdfkit.from_url('sample url','output.pdf')
here I got an error saying:
IOError: wkhtmltopdf exited with non-zero code -6. error:
QXcbConnection: Could not connect to display.
What went wrong? installing was a problem? or which part?
And also, if it works correctly, where can I find the output file? which directory? I am using WinSCP
to manage files.
ubuntu python
Hello I am developing an web with python Flask in a linux server, in doing so I am trying to use pdfkit
and wkhtmltopdf
.
I am using a linux server(ubuntu).
In Putty, after logging into my server, at root@myname:~# I downloaded pdfkit using apt-get, and downloaded wkhtmltopdf
. And I go to python by typing python on the command. And I am trying to convert a url into a pdf file by typing in python;
import pdfkit
pdfkit.from_url('sample url','output.pdf')
here I got an error saying:
IOError: wkhtmltopdf exited with non-zero code -6. error:
QXcbConnection: Could not connect to display.
What went wrong? installing was a problem? or which part?
And also, if it works correctly, where can I find the output file? which directory? I am using WinSCP
to manage files.
ubuntu python
ubuntu python
edited Jun 12 '16 at 11:03
Anthon
60.9k17103166
60.9k17103166
asked May 6 '16 at 1:37
minjunminjun
11
11
as stated in the above error, you have no display (graphically speaking). I assume that you're using the command-line only Ubuntu server distro?
– Joe
May 6 '16 at 8:36
add a comment |
as stated in the above error, you have no display (graphically speaking). I assume that you're using the command-line only Ubuntu server distro?
– Joe
May 6 '16 at 8:36
as stated in the above error, you have no display (graphically speaking). I assume that you're using the command-line only Ubuntu server distro?
– Joe
May 6 '16 at 8:36
as stated in the above error, you have no display (graphically speaking). I assume that you're using the command-line only Ubuntu server distro?
– Joe
May 6 '16 at 8:36
add a comment |
1 Answer
1
active
oldest
votes
I faced the same issue with similar use, it means that you don't have any graphic screen available on your machine.
To solve this try to install xvfb
and use the package wkhtmltopdf
on which pdfkit
is written.
In wkhtmltopdf
we can select auto selecting available screen by -a
switch, so that kind of solves problem for me. And you can call wkhtmltopdf
from subprocess, so that kind of works.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f281409%2fwkhtmltopdf-and-pdfkit-issues-in-python%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I faced the same issue with similar use, it means that you don't have any graphic screen available on your machine.
To solve this try to install xvfb
and use the package wkhtmltopdf
on which pdfkit
is written.
In wkhtmltopdf
we can select auto selecting available screen by -a
switch, so that kind of solves problem for me. And you can call wkhtmltopdf
from subprocess, so that kind of works.
add a comment |
I faced the same issue with similar use, it means that you don't have any graphic screen available on your machine.
To solve this try to install xvfb
and use the package wkhtmltopdf
on which pdfkit
is written.
In wkhtmltopdf
we can select auto selecting available screen by -a
switch, so that kind of solves problem for me. And you can call wkhtmltopdf
from subprocess, so that kind of works.
add a comment |
I faced the same issue with similar use, it means that you don't have any graphic screen available on your machine.
To solve this try to install xvfb
and use the package wkhtmltopdf
on which pdfkit
is written.
In wkhtmltopdf
we can select auto selecting available screen by -a
switch, so that kind of solves problem for me. And you can call wkhtmltopdf
from subprocess, so that kind of works.
I faced the same issue with similar use, it means that you don't have any graphic screen available on your machine.
To solve this try to install xvfb
and use the package wkhtmltopdf
on which pdfkit
is written.
In wkhtmltopdf
we can select auto selecting available screen by -a
switch, so that kind of solves problem for me. And you can call wkhtmltopdf
from subprocess, so that kind of works.
answered Aug 4 '16 at 10:36
Vatsal ParekhVatsal Parekh
31
31
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f281409%2fwkhtmltopdf-and-pdfkit-issues-in-python%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
as stated in the above error, you have no display (graphically speaking). I assume that you're using the command-line only Ubuntu server distro?
– Joe
May 6 '16 at 8:36