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_FO NTPATH','font/');
require('fpdf.p hp');
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,'He ader Output',1,1,'C' );
//Line break
$this->Ln(20);
}
}
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Times ','',10);
$pdf->Cell(40,40,"Te st Output");
$pdf->Output();
?> 4 15745
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,"Te st 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,"Te st Output"); $pdf->Output(); ?>
"Al C." <no************ *@adams-blake.no.spam.c om> wrote in message
news:10******** *****@news20.fo rteinc.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.c om> wrote in message news:10******** *****@news20.fo rteinc.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 spreadsheet and download it to their
PC.
when the user clicks on the "create a custom query" link on the
reports page the file customss.php displays the form that list the
various fields and criteria to specify for the search. This part
|
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 xmlns="http://www.w3.org/1999/xhtml">
All the CSS layout stuff looks good.
|
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 doesn't work here. What
happens is if the Header is included, a blank page appears with the URL of
the validation page (SQL_User_Validate.php). If the Header is commented
out, the form appears and you can enter the data and see the results, but...
|
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 subreport page headers do not print
(they are simply invisible).
The Sub-Reports' Report Header Band does get printed though.
Any idea why the Sub-Reports' Header Band gets printed, but 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 the problem.
Now I have plenty of file I copy the whole project from one computer to an
other and I ran into the same problem.
Except I can't botyer recreate the projec now... (so many file to transfer..
sigh..), so I change my project properties...
| |
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;
If page =1 then
ctrl1.visible = false
...
else
|
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();
include_once("connection.php");
if($_POST!="") ## Submit a login button
|
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 example in internet and group archieves and www.fpdf.org
page.
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |