FPDF
am 09.10.2007 22:21:32 von Steve
been gleening the user docs for fpdf. there's one simple example for using
the image function. i can't seem to get it to work. has anyone else had
problems with this, and if so, what did you do to diagnose and fix the
problem?
tia,
me
Re: FPDF
am 09.10.2007 22:26:01 von Good Man
"Steve" wrote in news:cpROi.110$OQ.60@newsfe03.lga:
> been gleening the user docs for fpdf. there's one simple example for
> using the image function. i can't seem to get it to work. has anyone
> else had problems with this, and if so, what did you do to diagnose
> and fix the problem?
>
> tia,
>
> me
>
>
i've used FPDF and image() successfully... what problems are you having?
Re: FPDF
am 09.10.2007 22:53:52 von Steve
"Good Man" wrote in message
news:Xns99C4A757DD1BFsonicyouth@216.196.97.131...
> "Steve" wrote in news:cpROi.110$OQ.60@newsfe03.lga:
>
>> been gleening the user docs for fpdf. there's one simple example for
>> using the image function. i can't seem to get it to work. has anyone
>> else had problems with this, and if so, what did you do to diagnose
>> and fix the problem?
>>
>> tia,
>>
>> me
>>
>>
>
> i've used FPDF and image() successfully... what problems are you having?
i just get a blank space where an image should be. there are no errors that
indicate my path is wrong...or anything else. i just get a blank space.
here's my test code:
header('content-type: application/pdf');
require_once 'table.pdf.class.php'; // test class to ease table creating
// only calls cell() in fpdf but in a
way
// that make it more html-like in
creation
$imagePath = 'c:/inetpub/wwwroot/toyotaii/images/';
$pdf = new pdfTable();
$pdf->addPage();
$pdf->setFont('Arial', '', 8);
$image = $pdf->image($imagePath . 'tccc.logo.jpg', $pdf->getX(),
$pdf->getY());
$pdf->ln();
$header = array('Country', 'Capital', 'Area (sq km)', 'Pop.
(thousands)');
$data = $pdf->loadData('countries.txt');
$pdf->table($header, $data);
$pdf->output();
?>
i did refactor the fpdf class so that all is camel-cased which is our bp for
this customer. however, i tested everything before, during, and after
refactoring to make sure nothing got messed up. at no time did i get an
image.
it's probably just me, but i really didn't find much about using the image
function other than a one line example.
whatever light you can shed will help greatly.
thanks,
me
Re: FPDF
am 09.10.2007 23:30:29 von Good Man
"Steve" wrote in news:wTROi.114$OQ.5@newsfe03.lga:
> $image = $pdf->image($imagePath . 'tccc.logo.jpg', $pdf->getX(),
> $pdf->getY());
two quick troubleshooting things: try assigning variables for $pdf->getX()
and $pdf->getY() and use the variables, and/or try replacing those entirely
with some numerical coordinates just to make sure its being printed
somewhere.
also, i notice that my scripts specify a fourth parameter (the optional
'image width' specification) numerically... if you leave it out, it is
"automatically calculated" for better or worse. See if it makes a
difference?
I don't know if you can use actual numbers for your class calls, but most
of the PDFs I've generated with FPDF have a specific place for my images,
thus I am able to use numbers all around ie:
$pdf->Image('images/receipt300.png',10,8,200);
.... to sum up, try replacing variables with numbers, and if it prints, then
the variables are wrong...
FPDF sure does require a lot of trial-and-error time!!!!
Re: FPDF
am 09.10.2007 23:32:29 von Good Man
"Steve" wrote in news:wTROi.114$OQ.5@newsfe03.lga:
> i just get a blank space where an image should be. there are no errors
> that indicate my path is wrong...or anything else. i just get a blank
> space. here's my test code:
>
>
> header('content-type: application/pdf');
> require_once 'table.pdf.class.php'; // test class to ease table
> creating
> // only calls cell() in fpdf but
> in a
> way
> // that make it more html-like in
> creation
> $imagePath = 'c:/inetpub/wwwroot/toyotaii/images/';
> $pdf = new pdfTable();
> $pdf->addPage();
> $pdf->setFont('Arial', '', 8);
> $image = $pdf->image($imagePath . 'tccc.logo.jpg', $pdf->getX(),
> $pdf->getY());
And I just noticed this, the function is Image() not image() but perhaps
thats irrelevant if you've camelCased the function definition.
Re: FPDF
am 09.10.2007 23:42:57 von Steve
"Good Man" wrote in message
news:Xns99C4B245B874Bsonicyouth@216.196.97.131...
> "Steve" wrote in news:wTROi.114$OQ.5@newsfe03.lga:
>
>> $image = $pdf->image($imagePath . 'tccc.logo.jpg', $pdf->getX(),
>> $pdf->getY());
>
> two quick troubleshooting things: try assigning variables for $pdf->getX()
> and $pdf->getY() and use the variables, and/or try replacing those
> entirely
> with some numerical coordinates just to make sure its being printed
> somewhere.
the getX and getY calls were from a suggested post i'd come across with
someone else having problems with image(). i put in hard coded values but to
no avail.
> also, i notice that my scripts specify a fourth parameter (the optional
> 'image width' specification) numerically... if you leave it out, it is
> "automatically calculated" for better or worse. See if it makes a
> difference?
yeah, there's a width and height param that are optional. i've hard coded
both, either, and none. still blank space.
> I don't know if you can use actual numbers for your class calls, but most
> of the PDFs I've generated with FPDF have a specific place for my images,
> thus I am able to use numbers all around ie:
>
> $pdf->Image('images/receipt300.png',10,8,200);
yeah, i've tried that too...very frustrating.
> ... to sum up, try replacing variables with numbers, and if it prints,
> then
> the variables are wrong...
>
>
> FPDF sure does require a lot of trial-and-error time!!!!
surprisingly less than what i expected...especially since looking at the
source, just getting it up to *some* kind of *good* coding style is a
hurculean task. ;^) anyway, everything i have works with the exception of
image(). it's my first time to generate pdf's in this way and i'm
prototyping reporting functions with pdf output.
before, we'd cheat. we had a pdf print driver on the server and just capture
the normal html and pipe it to the driver to file, and then show/email/etc.
the file. not an option this time.
anyway, thanks for your help.
Re: FPDF
am 09.10.2007 23:44:43 von Steve
"Good Man" wrote in message
news:Xns99C4B29C52805sonicyouth@216.196.97.131...
> "Steve" wrote in news:wTROi.114$OQ.5@newsfe03.lga:
>
>> i just get a blank space where an image should be. there are no errors
>> that indicate my path is wrong...or anything else. i just get a blank
>> space. here's my test code:
>>
>>
>> header('content-type: application/pdf');
>> require_once 'table.pdf.class.php'; // test class to ease table
>> creating
>> // only calls cell() in fpdf but
>> in a
>> way
>> // that make it more html-like in
>> creation
>> $imagePath = 'c:/inetpub/wwwroot/toyotaii/images/';
>> $pdf = new pdfTable();
>> $pdf->addPage();
>> $pdf->setFont('Arial', '', 8);
>> $image = $pdf->image($imagePath . 'tccc.logo.jpg', $pdf->getX(),
>> $pdf->getY());
>
> And I just noticed this, the function is Image() not image() but perhaps
> thats irrelevant if you've camelCased the function definition.
right. that's exactly it. fpfd has been brought into conformance with our
clients best practices...which, part of that is camelCasing interface names
rather than PascalNotation.
Re: FPDF
am 10.10.2007 00:33:07 von Steve
"Good Man" wrote in message
news:Xns99C4A757DD1BFsonicyouth@216.196.97.131...
> "Steve" wrote in news:cpROi.110$OQ.60@newsfe03.lga:
>
>> been gleening the user docs for fpdf. there's one simple example for
>> using the image function. i can't seem to get it to work. has anyone
>> else had problems with this, and if so, what did you do to diagnose
>> and fix the problem?
>>
>> tia,
>>
>> me
>>
>>
>
> i've used FPDF and image() successfully... what problems are you having?
ok, the source i had for fpdf was a modified version and not what is
'factory' from fpdf.org. i took the same test code (changing back to Pascal)
and got an image in a pdf doc. that's good news!
the bad news is that i've got to go and reformat all that fucking
code...again! diff wouldn't help much either.
thanks for your help, goodman.