We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I want to use the pdf as a invoicing idea but I’m having some issues with special characters.

    For the £ sign I’m getting £ in my document. Is there a reason that the  is showing up and how can I stop that from appearing?

    Thanks.
      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
      AugmentBLU - MODX Partner

      BLUcart - MODX Revolution E-Commerce & Shopping Cart
    • It’s probably a character encoding mismatch.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • I’ve gotten that in some cases, and it appears to be an extraneous normally non-displaying formatting character in the original. It’s only happened when a client using Windows edits/creates a document. Making sure my browser matches the site’s character set, I just re-enter the part (usually at the beginning of a paragraph) and it goes away. I suspect somebody is doing copy/paste from Word or something, in spite of repeatedly being told not to do that.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
        • Hi Susan, I’m typing in to the document body and saving and then downloading the PDF. As I said, I type £ and it comes out with that special character in front. I’m guessing that if I add  to be stripped won’t help as it appears to be happening during the PDF creation process.
            Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
            AugmentBLU - MODX Partner

            BLUcart - MODX Revolution E-Commerce & Shopping Cart
            • 21560
            • 145 Posts
            I think this is a little bit off topic here and, if I’m a little honest, out of my league. Character encoding isn’t my forte. I also still have to look into TCPDF. But time, alas, is always unfriendly.

            What you could do is check the character encoding and translate it with the native PHP functions.
            http://nl.php.net/manual/en/function.utf8-encode.php

            Especially in the comments is an interesting function.
              [font=Times]Comics, stories, music, graphics, games and more! http://Nimja.com
            • I don’t have any knowledge of special character encoding either  rolleyes

              I just thought it would be a simple fix like escaping the £ sign in the text area of the document for it to display in the PDF lol.  I tried £ but that was printed in the PDF as £ rather than £.  I will see what I can find on Google.


              I just tried the $ symbol and this displays properly...
                Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                AugmentBLU - MODX Partner

                BLUcart - MODX Revolution E-Commerce & Shopping Cart
                • 7455
                • 2,204 Posts
                Ok now this is nice
                but the content is not parsed
                how can I parse the content so that snippets are parsed and any other tag before its send to the pdf?

                I tryed: $modx->parseDocumentSource but that did not parse any snippet calls I had, does anyone has any idea?

                I have one one page a ditto call I need that page to be made into a pdf but now it generates the pae with the call instead of the parsed content.

                Dimmy
                  follow me on twitter: @dimmy01
                  • 4172
                  • 5,888 Posts
                  don’t know, if this can work, but you can try:
                  $fields = 'id,longtitle,description';
                  .
                  .
                  .
                  .
                  .
                  .
                  $chapter = $page['longtitle'];
                  $title = $page['description'];
                  //$content = str_replace($remove, '', $page['content']);
                  $url = $modx->makeUrl($page['id'], '', '', 'full');
                  $content = file_get_contents($url); 


                  the template should be without head and so on, of course
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 2912
                    • 315 Posts
                    Great snippet smiley. I’ve only just installed it and get it working but my pages always show the html code. I get a lot of <p> and <td references. Have I don’t something wrong? Is there a way to format the pdf as my webpage?

                    Thanks.
                      BBloke
                    • Quote from: BBloke at Jul 01, 2009, 04:54 PM

                      Great snippet smiley. I’ve only just installed it and get it working but my pages always show the html code. I get a lot of <p> and <td references. Have I don’t something wrong? Is there a way to format the pdf as my webpage?

                      Thanks.

                      My question is same...
                      work fine, but always in PDF show HTML.

                      P.S.

                      Extra question how in php source i can change content encoding from utf-8 to windows 1251? (but just for this document who generate)
                      (i make this http://www.fpdf.org/en/tutorial/tuto7.htm for adding new font (for cyrillic) but my DB is utf8_general_ci and i thing this is my problem...)
                        palma non sine pulvere