How to generate a quote pdf programmatically

Hi,

I use SugarCRM 7.6 Pro and I want to generate a PDF file of a quote (or another module) with PHP code.

As you can see in the below picture, what I want is to replicate the functionality of Download PDF with selected Template. I need to generate the PDF file in php and then use it in my code to put it as attachment of a mail or for saving it on the server disk.

I try to call the same service of the click on the dowload button with CURL in PHP with a lot of different headers and options but the response of the service is a page in HTML o an error and I can't get the PDF file. 

How can I do it?

Thank you very much.

Stefano Mapelli

Parents Reply
  • Dai un'occhiata a questo mio post su Developer Blog

    https://developer.sugarcrm.com/2016/08/15/how-to-create-beautiful-pdfs-with-css-within-sugar/ 

    In teoria nel Step2 custom/clients/base/api/generateWPDFApi.php non fa che prendere l'html da PDF Manager ($pdfTemplate->body_html nella funzione buildTemplateFile)

    e usare smarty ($this->ss->assign('fields', $fields); nella funzione generateWPDFApi) per rimpiazzare i parametri prima di generare il PDF (usando wkhtmltopdf).

    In teoria dovresti poter interrogare Sugar via API per ottenere i dati che ti servono, generare un HTML, e darlo in pasto a un API simile al mio per generare il PDF...

    In teoria...

    Francesca 

Children
No Data