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 can get text to go into the main body of the PDF file, but
nothing into a header. I have messed with this for several hours, seached
the web and no luck. Any help would be greatly appreciated.
Here is my script - which prints "Test Output" in a PDF file with no header
at all. Any suggestions?
<?php
define('FPDF_FONTPATH','font/');
require('fpdf.php');
class PDF extends FPDF
{
//Page header
function Header()
{
//Arial bold 15
$this->SetFont('Arial','B',15);
//Move to the right
$this->Cell(80);
//Title
$this->Cell(30,10,'Header Output',1,1,'C');
//Line break
$this->Ln(20);
}
}
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Times','',10);
$pdf->Cell(40,40,"Test Output");
$pdf->Output();
?> 4 15717
Phillip T. Murphy wrote: Not sure if this is the correct forum, but since FPDF is a PHP script, I thought I would give it a try...
You really should post this on the Forum page of fpdf.org. They have a great
group of peope there and Oliver (author) of PDF is also there all the time.
Anyway.....
$pdf=new FPDF();
You need:
$pdf->Open();
here
$pdf->AddPage(); $pdf->SetFont('Times','',10); $pdf->Cell(40,40,"Test Output"); $pdf->Output(); ?>
For our Jaya123 web-system ( www.jaya123.com) I've written tens of thousands of
lines of code using the FPDF class so I know a few things.
Hope this helps.
Al C.
__________________________________________________ ________
Adams-Blake Company, Inc.
***
JAYA123 - the web-based total-office system for the
small biz. Order entry, billing, bookkeeping, etc. for $14.95
a month. Perfect for the small business or start-up.
See demo at: http://www.jaya123.com
***
ooops, Previous answer is not it as you don't need Open(). Your problem is
that you need:
$pdf=new PDF();
Leave off the "F". By using the "F" you are instantiating a new FPDF class.
However PDF (no F) EXTENDS the FPDF and has a function with YOUR header
stuff. The FPDF header is actually empty and expects to be overriden. When
you just do $pdf=new FPDF(); you don't get the extension but only an empy
header function.
-Al $pdf=new FPDF();
You need:
$pdf->Open();
here
$pdf->AddPage(); $pdf->SetFont('Times','',10); $pdf->Cell(40,40,"Test Output"); $pdf->Output(); ?>
"Al C." <no*************@adams-blake.no.spam.com> wrote in message
news:10*************@news20.forteinc.com... ooops, Previous answer is not it as you don't need Open(). Your problem is that you need:
$pdf=new PDF();
Leave off the "F". By using the "F" you are instantiating a new FPDF class. However PDF (no F) EXTENDS the FPDF and has a function with YOUR header stuff. The FPDF header is actually empty and expects to be overriden. When you just do $pdf=new FPDF(); you don't get the extension but only an empy header function.
-Al
Al, Thank you! Wow, I am not sure I would have figured that out on my own,
ever. As a matter of of fact, I don't see any mention of what you pointed
out in the documentation anywhere.
Thanks again!
Phillip
Phillip T. Murphy wrote: "Al C." <no*************@adams-blake.no.spam.com> wrote in message news:10*************@news20.forteinc.com... ooops, Previous answer is not it as you don't need Open(). Your problem is that you need:
$pdf=new PDF();
Leave off the "F". By using the "F" you are instantiating a new FPDF class. However PDF (no F) EXTENDS the FPDF and has a function with YOUR header stuff. The FPDF header is actually empty and expects to be overriden. When you just do $pdf=new FPDF(); you don't get the extension but only an empy header function.
-Al
Al, Thank you! Wow, I am not sure I would have figured that out on my own, ever. As a matter of of fact, I don't see any mention of what you pointed out in the documentation anywhere.
Thanks again!
Phillip
See: http://fpdf.org/en/tutorial/tuto2.htm
This example makes use of the Header() and Footer() methods to process page
headers and footers. They are called automatically. They already exist in the
FPDF class but do nothing, therefore we have to extend the class and override
them. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mike |
last post by:
ok here's the problem:
I have a page that displays a form for user to select individual
fields and to specify their own criteria which is used to query a
database and then create an excel...
|
by: Terry |
last post by:
Hi,
I built a website using the HMTL header:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html...
|
by: Lee David |
last post by:
I am using code to validate a user against a database and then if they are
valid, redirecting the page to the working page. I copied the code from
another application I have where it works, but it...
|
by: Prakash Wadhwani |
last post by:
In a report I have 3 sub-reports. Each Sub-Report has it's own Page
Header.
When I run the sub-reports individually, the page headers print
correctly ... but ...
when I run the main report the...
|
by: Lloyd Dupont |
last post by:
I'm using VS.NET 2005 beta 2.
I have problem compiling project (it says: 'cannot find file StdAfx.h" which
is right in the middle of my project).
The 1st time I create a new project and it fixes...
| |
by: scrawford |
last post by:
Hi all,
Does anyone know how I can have a Page Header, but have something
between that and the detail of the report???
ie..
Page Header
Once off piece of text (for the first page only)
|
by: John |
last post by:
Hi
On a report I need to display some controls on all pages except the first
page. I have added these controls to the page header of the report and in
the on format event am using the code;
...
|
by: anis2007 |
last post by:
Hi,
following code run our server but this is not run client server:-
index code is: PUT YOUR CODE BETWEEN code OR php TAGS!! It is absolutely unreadeable!
<?php
ob_start();
session_start();...
|
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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |