We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16732
    • 592 Posts
    Hi,

    I’ve started working on a snippet which will handle on the fly PDF conversion of page content, through a PDF link.

    But I’ve stumbled upon a big problem : I want the user to remain on the current page and have a "save as" window pop-up. I have set up a link which points to the current page, and pass a ’pdf’ variable to the url : the snippet start generating the PDF when it detect the parameter.

    Right now, I do have the "save as" window, but the file field is empty (instead of having whatever.pdf in it, it’s blank).

    I have configured the snippet to write the PDF to the server instead of sending it to the browser and when I do this, it works the pdf is created and saved on the server.
    That’s why I think there is a problem with http headers.

    If I were not developping for MODx, I would just set a link to the php file generating the PDF and it would simply work.
    But in the case of this snippet, I am stuck !

    I had considered using a plugin but I don’t see what’s the logic behind it (is it possible to test a POST or GET variable with it ??)
    I have a lot to learn before mastering MODx !

    If someone can help, I am all ears

    Thank’s to davidm for the translation of my original message posted in the french forum
    http://modxcms.com/forums/index.php/topic,5502.0.html
      • 7455
      • 2,204 Posts
      could you not make it that the pdf creator wil make an pdf on rendering a document after the document is made? and then generate a link to that pdf by a snippet?
      looks to me that creating a pdf every time a user wnats a pdf takes a lot of time and server resources if the content stays the same there is no need to make a new pdf, only when a document is changed you would need a new pdf that could be done by a plugin and a systemfunction only when there is a new version you could use the last edited date).

      I am realy intrested in a tool like this but will it handle css etc ok?
      If i try to print a webpage made with css then all background images set in css do not show on my print.

      DImmy
        follow me on twitter: @dimmy01
        • 16732
        • 592 Posts
        Thank’s for your comment
        I will continue to search in the way you mention