Sean Fabian
asked on
PDF creation using FPDF on PHP website
I have a php website that i use FPDF to create a pdf copy of a work order. The customer signs the work order via a mobile device when the job is finished. FPDF is supposed to pull the image into the PDF but all it shows is a file name. Wondering if anyone can help. I have attached a copy of a workorder showing the problem and also the php code that i use to create the pdf. thanks.
workorder_pdf.php
wo_848.pdf
workorder_pdf.php
wo_848.pdf
This seems more like a requirement for application development than a question hat has an answer. Maybe consider posting it in E-E Gigs so you can engage a developer. Best of luck with it, ~Ray
$this->Cell($w[$i],6,$row['job_signature'],0,0,'L',$fill);
//$this->Image('images/captured_signature/'.$row['job_signature'],50,145, 40, 40,'PNG');
// $ImgPAth='images/captured_signature/'.$row['job_signature'];
// $ImgPAth='images/captured_signature/signature_351.jpg';
// $this->Cell(60,60,$this->Image($ImgPAth, $this->GetX(), $this->GetY(), 45,40),0,0,'L');
I am not familiar with FPDF but it looks like you have commented out the code that inserts an image and replaced it with code that inserts the name.I use MPDF (http://www.mpdf1.com/mpdf/index.php) which is a combination of FPDF and HTML2PDF. At the risk of doing an injury inducing sharp turn, have you tried creating your Work Order in HTML and then using MPDF to render it for you.
ASKER
No i have not... The whole site is written in php code.
What about the first comment in my post
it looks like you have commented out the code that inserts an image and replaced it with code that inserts the name.
ASKER
i have uncommented it and it is still doing the same thing
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
what part should i leave and what part should i comment out. i just commented out everything and put in what you suggested and still not working. I really appriciate the help. Do you need any more info?
The best approach to getting the most out of EE is to provide as much input as you can. Saying things like it does not work - is useless to us - we can't see what you see so we need something to go on.
For instance
- posting your code to show how you implemented the latest suggestion
- letting us know if the "did not work" generated an error or did it generate the wrong result
- trying to interpret what is being recommended so you can make minor adjustments to suite your environment. We cannot always give you the exact code you need (because we don't have access to your environment) - you might need to tweak it to make it work.
In your example your code was just displaying the image name. However the CTI image at the top displays fine which seems to indicate that the method you are using for the signatures is wrong.
By using the same process for implementing the CTI image on the signature it should work. If the implementation is correct and it is still not working then the problem is data.
Your PDF says the image name is signature_848.jpeg - are you sure this image exists?
There is no path before the image - maybe there needs to be one - is the extension meant to be .jpeg.
Try hard-coding the path in the FPDF command instead of using a variable - if that works then look at what is wrong with your variable. Remember paths are usually relative to the location where the landing script is run from. By landing script I mean the script that was invoked through the URL or command line. If a script includes another script in a different location - the included script assumes the location of the parent. Check your paths are correct along with the other items mentioned above and post back with what you find.
For instance
- posting your code to show how you implemented the latest suggestion
- letting us know if the "did not work" generated an error or did it generate the wrong result
- trying to interpret what is being recommended so you can make minor adjustments to suite your environment. We cannot always give you the exact code you need (because we don't have access to your environment) - you might need to tweak it to make it work.
In your example your code was just displaying the image name. However the CTI image at the top displays fine which seems to indicate that the method you are using for the signatures is wrong.
By using the same process for implementing the CTI image on the signature it should work. If the implementation is correct and it is still not working then the problem is data.
Your PDF says the image name is signature_848.jpeg - are you sure this image exists?
There is no path before the image - maybe there needs to be one - is the extension meant to be .jpeg.
Try hard-coding the path in the FPDF command instead of using a variable - if that works then look at what is wrong with your variable. Remember paths are usually relative to the location where the landing script is run from. By landing script I mean the script that was invoked through the URL or command line. If a script includes another script in a different location - the included script assumes the location of the parent. Check your paths are correct along with the other items mentioned above and post back with what you find.
ASKER
i will try that today. The image that the pdf pulls is different for every wo order created. Since each signature is different. Again, thanks for the help. I will try those suggestions in a few hours. Its 4am here and i need to get some rest.
Since each signature is different
Yes, got that but for testing pick one that exists and test with that. When that works you can go back to using the dynamic one.