Announcement

Collapse
No announcement yet.

[SOLVED]sc_include_lib

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

  • [SOLVED]sc_include_lib

    Why am I not allowed to use sc_include_lib in my library function? Now I need to include the fpdf.php with a long prefix. It's especially handy if you can sc_include_lib('fpdf') to avoid searching for the full path. I needed to generate a pdf and send it as an email attachment. I managed, but it took me quite some time to find the correct include path.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

  • #2
    Albert, you are faster then me !!
    My goal for today was to use swift-mail and fpdf to dynamically create e-mail attachments. it costs me a long time and i could not figure out, why itīs not working. I think the libs are only linked to the project after deploying.
    So i did the quick and dirty !
    Copying the whole third party stuff to my _libs folder and make a:
    require('../_lib/fpdf/fpdf.php');
    this works for me at the moment, but itīs not a solution for production, as you have to rember to copy the third party stuff with the project !

    Comment


    • #3
      The require did not work for me. I needed ../../../scriptcase/_lib/3rdparty/fpdf/fpdf.php (in development). That's the big disadvantage, as I need to change the path when deploying. I created a library containing the invoice library sample of fpdf and include_once the fpdf library. I created a button to create the pdf (output(mylocation,'F') ) and attached it to an email. Problem is that you can use sc_include_lib in the button code, but not in the library....
      Albert Drent
      aducom software netherlands
      scriptcase partner, reseller, support and (turn-key) development
      www.scriptcase.eu / www.scriptcase.nl

      Comment


      • #4
        Albert, did you have problems with the PDF-File ? I could not open it, got the error: Error [PDF Structure 40] invalid file format !
        Could you help me about this problem ?

        Comment


        • #5
          I don't know if I can help you. I just took the sample of fpdf (invoices) and it simply can be opened (works well). The hello world sample works too. Perhaps an outdated pdf reader? Or too modern?
          Albert Drent
          aducom software netherlands
          scriptcase partner, reseller, support and (turn-key) development
          www.scriptcase.eu / www.scriptcase.nl

          Comment


          • #6
            Donīt know why, but when i start my PDF i could see it in the browser, the problem appears when i save that PDF. When i saved now the PDF from within my application and send it as attachment, it could be opened !
            So problem is solved for me, as my goal was to send the PDF as attachment !

            Comment


            • #7
              That's the way I did it too.
              Albert Drent
              aducom software netherlands
              scriptcase partner, reseller, support and (turn-key) development
              www.scriptcase.eu / www.scriptcase.nl

              Comment


              • #8
                Hello Mr. Drent,

                I'm verifying the issue with our bugs team.

                regards,
                Bernhard Bernsmann

                Comment


                • #9
                  Albert,
                  do you have a sloution to change the PDF -Name dynamically ?
                  $pdf->Output('../$toursrowid.pdf','F');
                  does not work

                  Comment


                  • #10
                    As you are using a php variable you need to put it outside the quotes or use double quotes afaik. I would try:
                    $pdf->Output('../'.$toursrowid.'.pdf','F');
                    Albert Drent
                    aducom software netherlands
                    scriptcase partner, reseller, support and (turn-key) development
                    www.scriptcase.eu / www.scriptcase.nl

                    Comment


                    • #11
                      Yes that works, thanks !
                      For me, itīs a little tricky, where to use quotes, double quotes, dots, and so on

                      Comment

                      Working...
                      X