wkhtmltopdf and pdfkit issues in python

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












0















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.










share|improve this question
























  • 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















0















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.










share|improve this question
























  • 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













0












0








0








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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

















  • 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










1 Answer
1






active

oldest

votes


















0














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.






share|improve this answer






















    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
    );



    );













    draft saved

    draft discarded


















    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









    0














    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.






    share|improve this answer



























      0














      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.






      share|improve this answer

























        0












        0








        0







        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 4 '16 at 10:36









        Vatsal ParekhVatsal Parekh

        31




        31



























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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






            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay