PDF template generation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1602

    #16
    Hello,

    item, I experimented further and designed an invoice form in Word, then saved as html in Word (normally the output is nearly unusable for web development, because Word puts a lot of microsoft proprietary code in it) and to my surprise the output, when using the Word HTML used in the email template is nearly perfect. Next I will convert a docx with one of the many online converters to HTML and see, waht it gets.
    In the attachment I provide a Word template converted this way and printed from the email client.
    Attached Files

    Comment

    • item
      Active Community Member
      • Mar 2017
      • 1476

      #17
      Hello,
      your template is not hard ! just find a "web designer" for make it in HTML without custom tag.
      after just write the templating {tag}

      My approch is different.. i use a real docx as template in espocrm. I use phpOffice as library.

      Tcpdf can't "print to pdf" my sample... blank pdf.. but https://cloudmersive.com/ do it perfecly (and it's free for max 800 request ) ..the result of pdf is same as docx.. (somethime bug, but i use pdf creation in a foreach boucle.) For one record, maybe no problem.
      Attached Files
      Last edited by item; 11-29-2020, 09:52 PM.
      If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

      Comment

      • esforim
        Active Community Member
        • Jan 2020
        • 2204

        #18
        Yuri made the change in regard to "PDF Library" if any early bird want to start testing it:

        To make it easier for developers to add a support of other engines. Currently we use TCPDF. Interfaces: Espo\Tools\Pdf\EntityPrinter Espo\Tools\Pdf\CollectionPrinter Definition in metadata: app > p...

        Comment

        • item
          Active Community Member
          • Mar 2017
          • 1476

          #19
          Hello esforim
          Yes.. Yuri make many change .. and i have no anythink to say about because he do it for the best..for state of art.. but .. we can't not follow it ..
          If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

          Comment

          • rinorway
            Senior Member
            • Feb 2016
            • 179

            #20
            What is helpful is add a few default helpers for moustache/lightncandy
            together with HTML preview before passing it to TCPDF

            Eg , following https://docs.espocrm.com/development...custom-helper/ you may
            use {{dump id}} to list all available elements and their values for debugging.

            Code:
            public static function dump()
            {
            $args = func_get_args();
            $context = $args[count($args)-1];
            $data = $context['data']['root'];
            $html = "<span style=\"font-size: 50%;\">";
            foreach($data AS $key => $value) {
            $html.="$key -> $value<br/>";
            }
            $html.= "</span>";
            return new LightnCandy\SafeString($html);
            }

            Last edited by rinorway; 01-07-2021, 04:27 PM. Reason: Documentation for helpers was available.

            Comment

            Working...