<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Agence de Développement Informatique du Nord &#187; fpdf</title>
	<atom:link href="http://blog.adin.pro/tag/fpdf/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.adin.pro</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Thu, 26 Dec 2019 08:54:31 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<item>
		<title>fpdf € transform into ? with UTF-8</title>
		<link>http://blog.adin.pro/2013-10-06/fpdf-e-transform-into-with-utf-8/</link>
		<comments>http://blog.adin.pro/2013-10-06/fpdf-e-transform-into-with-utf-8/#comments</comments>
		<pubDate>Sun, 06 Oct 2013 14:34:00 +0000</pubDate>
		<dc:creator><![CDATA[blogadmin]]></dc:creator>
				<category><![CDATA[FPDF]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[fpdf]]></category>

		<guid isPermaLink="false">http://blog.adin.pro/?p=296</guid>
		<description><![CDATA[<p>You try to write a € character on your pdf doc but it is transformed into a &#8220;?&#8221;. You can replace it by the chr(128) sign. When the sign is inside a string, you can use this But you have &#8230; <a href="http://blog.adin.pro/2013-10-06/fpdf-e-transform-into-with-utf-8/">Continue reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2013-10-06/fpdf-e-transform-into-with-utf-8/">fpdf € transform into ? with UTF-8</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>You try to write a € character on your pdf doc but it is transformed into a &#8220;?&#8221;.<br />
You can replace it by the chr(128) sign.</p>
<pre class="brush: php; title: ; notranslate">
$this-&gt;MultiCell(170, $this-&gt;hh, $price.&quot; &quot;.chr(128), 0, 'L', false);
</pre>
<p>When the sign is inside a string, you can use this</p>
<pre class="brush: php; title: ; notranslate">
$contenu = str_replace('€', chr(128), $contenu);
$this-&gt;MultiCell(170, $this-&gt;hh, $contenu, 0, 'L', false);
</pre>
<p>But you have special characters too, you need to encode string into UTF-8</p>
<pre class="brush: php; title: ; notranslate">
$contenu = str_replace('€', chr(128), $contenu);
$this-&gt;MultiCell(170, $this-&gt;hh, utf8_decode($contenu), 0, 'L', false);
</pre>
<p>This works well for &#8220;é&#8221; or &#8220;ç&#8221; but not for &#8220;€&#8221;.<br />
The ultimate solution is :</p>
<pre class="brush: php; title: ; notranslate">
$contenu = str_replace('€', utf8_encode(chr(128)), $contenu);
$this-&gt;MultiCell(170, $this-&gt;hh, utf8_decode($contenu), 0, 'L', false);
</pre>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2013-10-06/fpdf-e-transform-into-with-utf-8/">fpdf € transform into ? with UTF-8</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.adin.pro/2013-10-06/fpdf-e-transform-into-with-utf-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>fpdf import pdf file</title>
		<link>http://blog.adin.pro/2013-05-17/fpdf-import-pdf-file/</link>
		<comments>http://blog.adin.pro/2013-05-17/fpdf-import-pdf-file/#comments</comments>
		<pubDate>Fri, 17 May 2013 11:05:49 +0000</pubDate>
		<dc:creator><![CDATA[blogadmin]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[fpdf]]></category>

		<guid isPermaLink="false">http://blog.adin.pro/?p=200</guid>
		<description><![CDATA[<p>You are using fpdf to generate PDF file in php. You want to use an existing PDF file to import header and footer ? This is easy : First, download FPDI lib here and do that on your code : &#8230; <a href="http://blog.adin.pro/2013-05-17/fpdf-import-pdf-file/">Continue reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2013-05-17/fpdf-import-pdf-file/">fpdf import pdf file</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>You are using fpdf to generate PDF file in php. You want to use an existing PDF file to import header and footer ? This is easy :</p>
<p>First, download FPDI lib <a href="http://www.setasign.de/products/pdf-php-solutions/fpdi/downloads/" title="here" target="_blank">here</a></p>
<p>and do that on your code :</p>
<pre class="brush: php; title: ; notranslate">
require_once('fpdf.php'); 
require_once('fpdi.php'); 

$pdf = new FPDI();   // FPDI and not FPDF
$pdf-&gt;AliasNbPages();
$pdf-&gt;AddPage();
$pagecount = $pdf-&gt;setSourceFile(SF_ROOT_DIR.'/lib/fpdf/courrier.pdf');
$tplix = $pdf-&gt;importPage(1);
$pdf-&gt;useTemplate($tplix);
$pdf-&gt;Output('newdocument.pdf', 'D'); 
</pre>
<p>If you get this error</p>
<pre class="brush: bash; title: ; notranslate">
Warning: require_once(fpdf_tpl.php): failed to open stream:
</pre>
<p>you need to get the FPDF_TPL class too.</p>
<p>This only import file for the first page, if you want it on every page, override AddPage() function :</p>
<pre class="brush: php; title: ; notranslate">
public function AddPage($orientation='', $size='', $keepmargins=false, $tocpage=false)
{
    parent::AddPage();
    $pagecount = $this-&gt;setSourceFile(SF_ROOT_DIR.'/lib/fpdf/courrier.pdf');                                                          
    $tplix = $this-&gt;importPage(1);
    $this-&gt;useTemplate($tplix);
}
</pre>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2013-05-17/fpdf-import-pdf-file/">fpdf import pdf file</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.adin.pro/2013-05-17/fpdf-import-pdf-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>fpdf add page number</title>
		<link>http://blog.adin.pro/2013-01-07/fpdf-add-page-number/</link>
		<comments>http://blog.adin.pro/2013-01-07/fpdf-add-page-number/#comments</comments>
		<pubDate>Mon, 07 Jan 2013 13:30:46 +0000</pubDate>
		<dc:creator><![CDATA[blogadmin]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[fpdf]]></category>

		<guid isPermaLink="false">http://blog.adin.pro/?p=82</guid>
		<description><![CDATA[<p>Here an easy way to add page number at the end of a fpdf document In your fpdf class, before calling addpage(), call the AliasNbPages() fonction then create a footer() fonction to override the default empty footer The complete class &#8230; <a href="http://blog.adin.pro/2013-01-07/fpdf-add-page-number/">Continue reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2013-01-07/fpdf-add-page-number/">fpdf add page number</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Here an easy way to add page number at the end of a fpdf document</p>
<p>In your fpdf class, before calling addpage(), call the AliasNbPages() fonction</p>
<pre class="brush: php; title: ; notranslate">
$this-&gt;AliasNbPages();
</pre>
<p>then create a footer() fonction to override the default empty footer</p>
<pre class="brush: php; title: ; notranslate">
function Footer()
{
        $this-&gt;SetY(-10);
        $this-&gt;SetFont('Arial', '', 8);
        $this-&gt;Cell(0,10,'Page '.$this-&gt;PageNo().'/{nb}', 0, 0, 'C');
        $this-&gt;SetY(-10);
        $this-&gt;Cell(0,10,&quot;date d'impression: &quot;.date('d/m/Y'), 0, 0, 'R');
}
</pre>
<p>The complete class : file pdfListeDemandes.class.php</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

class pdfListeDemandes extends FPDF
{
   function init()
   {
                $this-&gt;AliasNbPages();
                ...
   }
   function writeListe()
   {
         $this-&gt;init();
         ...
   }

   function Footer()
   {
        $this-&gt;SetY(-10);
        $this-&gt;SetFont('Arial', '', 8);
        $this-&gt;Cell(0,10,'Page '.$this-&gt;PageNo().'/{nb}', 0, 0, 'C');
        $this-&gt;SetY(-10);
        $this-&gt;Cell(0,10,&quot;date d'impression: &quot;.date('d/m/Y'), 0, 0, 'R');
   }

}
</pre>
<p>And the code to call your class</p>
<pre class="brush: php; title: ; notranslate">
$pdf = new pdfListeDemandes();
$pdf-&gt;writeListe();
$pdf-&gt;output('Liste_demande.pdf', 'D');
exit;

</pre>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2013-01-07/fpdf-add-page-number/">fpdf add page number</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.adin.pro/2013-01-07/fpdf-add-page-number/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
