How to create and download a custom pdf report with the Custom API Endpoint process which can print relatedBean records in PDF?

I have the ChequeBatch Module which has a relationship of One to Many with the Cheque module. I have a "Generate Cheques" button in the ChequeBatch module record view in edit options which calls a Custom API Endpoint and executes a process of incrementing the cheque numbers for all related Cheque records for that ChequeBatch. I want the same process to generate a custom pdf which can print all the relatedBean Cheque records from that ChequeBatch module to the custom PDF and gets downloaded when the API process ends.

Parents
  • You may find some inspiration on how to approach this by looking at:
    https://sugarclub.sugarcrm.com/dev-club/b/dev-blog/posts/how-to-create-beautiful-pdfs-with-css-within-sugar


    What I do there is I use the PDF manager to create the html for the document, then I use a custom API and css to format it.
    In the API you can manipulate the data that appears on the PDF by manipulating the html before you convert it to PDF.

    Note that my solution requires you be able to install an HTML to PDF tool to apply the css formatting and generate the PDF, so you have to be OnSite. But if you are not using the PDF Manager from Sugar you might still find some ideas to link your custom API to your own PDF generator and return the PDF document to force a download.

    FrancescaS

Reply
  • You may find some inspiration on how to approach this by looking at:
    https://sugarclub.sugarcrm.com/dev-club/b/dev-blog/posts/how-to-create-beautiful-pdfs-with-css-within-sugar


    What I do there is I use the PDF manager to create the html for the document, then I use a custom API and css to format it.
    In the API you can manipulate the data that appears on the PDF by manipulating the html before you convert it to PDF.

    Note that my solution requires you be able to install an HTML to PDF tool to apply the css formatting and generate the PDF, so you have to be OnSite. But if you are not using the PDF Manager from Sugar you might still find some ideas to link your custom API to your own PDF generator and return the PDF document to force a download.

    FrancescaS

Children
No Data