[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, 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 !

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, 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 ?

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?

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 !

That’s the way I did it too.

Hello Mr. Drent,

I’m verifying the issue with our bugs team.

regards,
Bernhard Bernsmann

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

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’);

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