Files
2019-04 Update Mailversand
Archiv
Auswertung
admin
balance_img
fancybox
images
mail
standort
#prints
FCKeditor
anschreiben
images
prints
#alt
Praxisstellen-Dateien
decoders
doc
font
tutorial
20k_c1.txt
20k_c2.txt
calligra.afm
calligra.php
calligra.ttf
calligra.z
countries.txt
index.htm
logo.png
logo_pb.png
makefont.php
tuto1.htm
tuto1.php
tuto2.htm
tuto2.php
tuto3.htm
tuto3.php
tuto4.htm
tuto4.php
tuto5.htm
tuto5.php
tuto6.htm
tuto6.php
tuto7.htm
tuto7.php
FAQ.htm
LICENSE
NOTICE
Praxisstellen.doc
Praxisstellen.htm
Zustimmung.doc
changelog.txt
demo.php
fpdf.css
fpdf.php
fpdf_tpl.php
fpdi.php
fpdi_pdf_parser.php
histo.htm
install.txt
newpdf.pdf
pdf_context.php
pdf_gen.php
pdf_parser.php
pdfdoc.pdf
praxisstellen.pdf
praxisstellen.php
wrapper_functions.php
zustimmung.pdf
zustimmung.php
Praxisstellen-Dateien
decoders
doc
filters
font
listen
makefont
tutorial
02_Liste_Erstpruefer_Student_Zweitpruefer.php
03_Liste_Zweitpruefer_Student_Erstpruefer.php
FAQ.htm
LICENSE
NOTICE
Praxisstellen.doc
Praxisstellen.htm
Zustimmung.doc
as_utf_class.php
blanko_ludwigsburg.pdf
changelog.txt
class.fpdf_table.php
class.multicelltag.php
class.string_tags.php
deckblatt.pdf
deckblatt.php
deckblatt_doz.php
demo.php
ex.php
fpdf.css
fpdf.php
fpdf_tpl.php
fpdi.php
fpdi_bridge.php
fpdi_pdf_parser.php
histo.htm
install.txt
newpdf.pdf
pdf_context.php
pdf_gen.php
pdf_parser.php
pdfdoc.pdf
praxisstellen.pdf
praxisstellen.php
sozuweisung.php
table_def.inc
table_def_kehl.inc
teilnehmer.php
teilnehmer_alt.php
teilnehmer_neu.php
wrapper_functions.php
zustimmung.pdf
zustimmung.php
browserSniffer.js
dynCalendar.css
dynCalendar.js
hauptframe.php
hauptframe_jahr.php
index.php
index_frame.htm
jahrgang.php
kennwortwechsel.php
logout.php
mail_teilnehmer.php
mail_teilnehmer_alt.php
mail_teilnehmer_neu.php
menuframe.php
pers_daten_ver.php
termine.php
topframe.php
vert_bereich.php
stud
#pdf_gen.php
#pdf_gen_alt.php
#pdf_gen_ges_lubu.php
#pdf_gen_kehl.php
#pdf_gen_kehl_alt.php
#pdf_gen_kehl_neu.php
#pdf_gen_neu.php
++ Printqueue zurücksetzen.txt.lnk
.gitignore
Auswertung_besuchte Stellen der Studs - alle Jahrgänge.sql
Auswertung_besuchte Stellen der Studs.sql
Pflicht.sql
Trigger.sql
VIEW_stan_zuw_so.sql
VIEW_stan_zuw_so_neu.sql
anz_anm.php
bearbeiten_neu.php
historie.php
historie_alt.php
historie_neu.php
index.php
index_db.php
index_ldap.php
ldap_info.php
ldap_info_hsnet.php
login.css
menuframe.php
styles_pc.css
umzugsverguetung.sql
stellenantrag_neu/standort/prints/#alt/tutorial/tuto3.htm

44 lines
10 KiB
HTML
Executable File

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<TITLE>Line breaks and colors</TITLE>
<LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css">
</HEAD>
<BODY>
<H2>Line breaks and colors</H2>
Let's continue with an example which prints justified paragraphs. It also illustrates the use
of colors.
<BR>
<BR>
<TABLE WIDTH="100%" STYLE="color:#4040C0; border-style:ridge" BORDERCOLORLIGHT="#B0B0E0" BORDERCOLORDARK="#000000" BORDER="2" CELLPADDING=6 CELLSPACING=0 BGCOLOR="#F0F5FF"><TR><TD style="border-width:0px">
<NOBR><code><font color="#000000">
&lt;?php<br><font class="kw">require(</font><font class="str">'fpdf.php'</font><font class="kw">);<br><br>class </font>PDF <font class="kw">extends </font>FPDF<br><font class="kw">{<br>function </font>Header<font class="kw">()<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;global </font>$title<font class="kw">;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Arial bold 15<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>SetFont<font class="kw">(</font><font class="str">'Arial'</font><font class="kw">,</font><font class="str">'B'</font><font class="kw">,</font>15<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Calculate width of title and position<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$w<font class="kw">=</font>$<font class="kw">this-&gt;</font>GetStringWidth<font class="kw">(</font>$title<font class="kw">)+</font>6<font class="kw">;<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>SetX<font class="kw">((</font>210<font class="kw">-</font>$w<font class="kw">)/</font>2<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Colors of frame, background and text<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>SetDrawColor<font class="kw">(</font>0<font class="kw">,</font>80<font class="kw">,</font>180<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>SetFillColor<font class="kw">(</font>230<font class="kw">,</font>230<font class="kw">,</font>0<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>SetTextColor<font class="kw">(</font>220<font class="kw">,</font>50<font class="kw">,</font>50<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Thickness of frame (1 mm)<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>SetLineWidth<font class="kw">(</font>1<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Title<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>Cell<font class="kw">(</font>$w<font class="kw">,</font>9<font class="kw">,</font>$title<font class="kw">,</font>1<font class="kw">,</font>1<font class="kw">,</font><font class="str">'C'</font><font class="kw">,</font>1<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Line break<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>Ln<font class="kw">(</font>10<font class="kw">);<br>}<br><br>function </font>Footer<font class="kw">()<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Position at 1.5 cm from bottom<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>SetY<font class="kw">(-</font>15<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Arial italic 8<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>SetFont<font class="kw">(</font><font class="str">'Arial'</font><font class="kw">,</font><font class="str">'I'</font><font class="kw">,</font>8<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Text color in gray<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>SetTextColor<font class="kw">(</font>128<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Page number<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>Cell<font class="kw">(</font>0<font class="kw">,</font>10<font class="kw">,</font><font class="str">'Page '</font><font class="kw">.</font>$<font class="kw">this-&gt;</font>PageNo<font class="kw">(),</font>0<font class="kw">,</font>0<font class="kw">,</font><font class="str">'C'</font><font class="kw">);<br>}<br><br>function </font>ChapterTitle<font class="kw">(</font>$num<font class="kw">,</font>$label<font class="kw">)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Arial 12<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>SetFont<font class="kw">(</font><font class="str">'Arial'</font><font class="kw">,</font><font class="str">''</font><font class="kw">,</font>12<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Background color<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>SetFillColor<font class="kw">(</font>200<font class="kw">,</font>220<font class="kw">,</font>255<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Title<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>Cell<font class="kw">(</font>0<font class="kw">,</font>6<font class="kw">,</font><font class="str">"Chapter $num : $label"</font><font class="kw">,</font>0<font class="kw">,</font>1<font class="kw">,</font><font class="str">'L'</font><font class="kw">,</font>1<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Line break<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>Ln<font class="kw">(</font>4<font class="kw">);<br>}<br><br>function </font>ChapterBody<font class="kw">(</font>$file<font class="kw">)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Read text file<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$f<font class="kw">=</font>fopen<font class="kw">(</font>$file<font class="kw">,</font><font class="str">'r'</font><font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$txt<font class="kw">=</font>fread<font class="kw">(</font>$f<font class="kw">,</font>filesize<font class="kw">(</font>$file<font class="kw">));<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>fclose<font class="kw">(</font>$f<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Times 12<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>SetFont<font class="kw">(</font><font class="str">'Times'</font><font class="kw">,</font><font class="str">''</font><font class="kw">,</font>12<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Output justified text<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>MultiCell<font class="kw">(</font>0<font class="kw">,</font>5<font class="kw">,</font>$txt<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Line break<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>Ln<font class="kw">();<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font class="cmt">//Mention in italics<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>SetFont<font class="kw">(</font><font class="str">''</font><font class="kw">,</font><font class="str">'I'</font><font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>Cell<font class="kw">(</font>0<font class="kw">,</font>5<font class="kw">,</font><font class="str">'(end of excerpt)'</font><font class="kw">);<br>}<br><br>function </font>PrintChapter<font class="kw">(</font>$num<font class="kw">,</font>$title<font class="kw">,</font>$file<font class="kw">)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>AddPage<font class="kw">();<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>ChapterTitle<font class="kw">(</font>$num<font class="kw">,</font>$title<font class="kw">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font>$<font class="kw">this-&gt;</font>ChapterBody<font class="kw">(</font>$file<font class="kw">);<br>}<br>}<br><br></font>$pdf<font class="kw">=new </font>PDF<font class="kw">();<br></font>$title<font class="kw">=</font><font class="str">'20000 Leagues Under the Seas'</font><font class="kw">;<br></font>$pdf<font class="kw">-&gt;</font>SetTitle<font class="kw">(</font>$title<font class="kw">);<br></font>$pdf<font class="kw">-&gt;</font>SetAuthor<font class="kw">(</font><font class="str">'Jules Verne'</font><font class="kw">);<br></font>$pdf<font class="kw">-&gt;</font>PrintChapter<font class="kw">(</font>1<font class="kw">,</font><font class="str">'A RUNAWAY REEF'</font><font class="kw">,</font><font class="str">'20k_c1.txt'</font><font class="kw">);<br></font>$pdf<font class="kw">-&gt;</font>PrintChapter<font class="kw">(</font>2<font class="kw">,</font><font class="str">'THE PROS AND CONS'</font><font class="kw">,</font><font class="str">'20k_c2.txt'</font><font class="kw">);<br></font>$pdf<font class="kw">-&gt;</font>Output<font class="kw">();<br></font>?&gt;
</font>
</code></NOBR></TD></TR></TABLE><P></P>
<SCRIPT>
<!--
if(document.location.href.indexOf('http:')==0)
{
document.write("<P CLASS='demo'><A HREF='tuto3.php' TARGET='_blank' CLASS='demo'>[Demo]</A></P>");
}
//-->
</SCRIPT>
The <A HREF='../doc/getstringwidth.htm'>GetStringWidth()</A> method allows to determine the length of a string in the current font,
which is used here to calculate the position and the width of the frame surrounding the title.
Then colors are set (via <A HREF='../doc/setdrawcolor.htm'>SetDrawColor()</A>, <A HREF='../doc/setfillcolor.htm'>SetFillColor()</A> and <A HREF='../doc/settextcolor.htm'>SetTextColor()</A>) and the
thickness of the line is set to 1 mm (against 0.2 by default) with <A HREF='../doc/setlinewidth.htm'>SetLineWidth()</A>. Finally,
we output the cell (the last parameter to 1 indicates that the background must be filled).
<BR>
<BR>
The method used to print the paragraphs is <A HREF='../doc/multicell.htm'>MultiCell()</A>. Each time a line reaches the
right extremity of the cell or a carriage-return character is met, a line break is issued
and a new cell automatically created under the current one. Text is justified by default.
<BR>
<BR>
Two document properties are defined: title (<A HREF='../doc/settitle.htm'>SetTitle()</A>) and author (<A HREF='../doc/setauthor.htm'>SetAuthor()</A>).
Properties can be viewed by two means. First is open the document directly with Acrobat Reader,
go to the File menu, Document info, General. Second, also available from the plug-in, is click
on the triangle just above the right scrollbar and choose Document info.
</BODY>
</HTML>