473,385 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

FPDF

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
Oct 9 '07 #1
6 5452
"Steve" <no****@example.comwrote in news:cp*************@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?
Oct 9 '07 #2
"Good Man" <he***@letsgo.comwrote in message
news:Xn************************@216.196.97.131...
"Steve" <no****@example.comwrote in news:cp*************@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
Oct 9 '07 #3
"Steve" <no****@example.comwrote in news:wT************@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!!!!
Oct 9 '07 #4
"Steve" <no****@example.comwrote in news:wT************@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.
Oct 9 '07 #5

"Good Man" <he***@letsgo.comwrote in message
news:Xn************************@216.196.97.131...
"Steve" <no****@example.comwrote in news:wT************@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.
Oct 9 '07 #6

"Good Man" <he***@letsgo.comwrote in message
news:Xn************************@216.196.97.131...
"Steve" <no****@example.comwrote in news:wT************@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.
Oct 9 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: madeo | last post by:
hi, i'm looking for some script which would export address labels from a mysql db to pdf ... There's an exapmle, but i'm not able to convert it for using with mysql ... can anybody help? THX...
4
by: Phillip T. Murphy | last post by:
Not sure if this is the correct forum, but since FPDF is a PHP script, I thought I would give it a try... I am having a problem getting ANYTHING to print in a header using the FPDF functions. I...
2
by: LordMerlin | last post by:
Hi I'm trying to write a label printing routine, but I'm not being too sucsessful. I'm hoping maybe someone who's used FPDF b4 can help me out? Basically, I want to print labels from a data...
3
by: K. | last post by:
Hello! Could you be so kind and help me with one problem I have. I would like to put an image into the table while creating PDF file. I use fpdf class (www.fpdf.org). I cannot find any...
0
by: Mihamina (R12y) Rakotomandimby | last post by:
Hi, In http://www.fpdf.de/downloads/addons/3/ we can find a function that tries to predict the number of lines un a multicell. I dont understand the algorithm, variables are also named with...
1
by: Thivya | last post by:
hello, I am using Jpgraphs to generate graphs..i have to display the data for plotting the graphs as well.These results has to be in PDF.hence i used FPDF to generate pdf.. Now i can display the...
5
by: cappieins | last post by:
Hi, i've got a problem using PHP FPDF library to create PDF files send inline to a browser window. The created PDF file opens correctly in the browser (IE 6), but if I want to save it to my...
3
by: shikimori | last post by:
HI guys i'm newbie here, sorry if my english is not so well, (well i'm rarely using english ^^) my question is that i'm using PHP to create a report (the report is using FPDF class) as example if i...
1
by: Sergei Riaguzov | last post by:
Hi, I'm having problems with fpdf v.1.1 used on the site - it doesn't open all PDFs with setSourceFile it says something about "missing xref headers". So I tried to install a newer fpdf version...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.