We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37112
    • 15 Posts
    I am trying to create a snippet that returns a pdf, using TCPDF, if ajax call directly /assets/snippets/pdf.php the pdf generate corretly but if create a resource and call the snippet, can not generate.

    $pdf->Output('VivesPromocion.pdf', 'I');
    return;
    


    Ajax
    type:"POST",
    url: "http://../pdf.html"
    


    And the resource pdf.html is created
    Any idea to solve?
    Thanks
      • 13428 ☆ A M B ☆
      • 1,031 Posts
      Use something like this:
      header('Content-Type: application/pdf');
      header('Content-Disposition: inline; filename="VivesPromocion.pdf"');
      exit($pdf->Output('VivesPromocion.pdf', 'I'));

      MODX should not touch the output after TCPDF has done the work.
        • 37112
        • 15 Posts
        Quote from: Jako at May 26, 2016, 04:37 AM
        Use something like this:
        header('Content-Type: application/pdf');
        header('Content-Disposition: inline; filename="VivesPromocion.pdf"');
        exit($pdf->Output('VivesPromocion.pdf', 'I'));

        MODX should not touch the output after TCPDF has done the work.

        Ok, resolved,
        Thank you