Announcement

Collapse
No announcement yet.

PDF template generation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #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


    • #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.

      Comment


      • #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


        • #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 ..

          Comment


          • #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...
            X