<?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>Patrick&#039;s playground &#187; fpdf</title>
	<atom:link href="http://www.vankouteren.eu/blog/tag/fpdf/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vankouteren.eu/blog</link>
	<description>Random thoughts, problems and solutions</description>
	<lastBuildDate>Sun, 29 Jan 2012 07:53:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>FPDF error: Unable to find xref table</title>
		<link>http://www.vankouteren.eu/blog/2009/07/fpdf-error-unable-to-find-xref-table/</link>
		<comments>http://www.vankouteren.eu/blog/2009/07/fpdf-error-unable-to-find-xref-table/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 14:16:34 +0000</pubDate>
		<dc:creator>Patrick van Kouteren</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[fpdf]]></category>
		<category><![CDATA[fpdi]]></category>
		<category><![CDATA[xref error]]></category>

		<guid isPermaLink="false">http://www.vankouteren.eu/blog/?p=124</guid>
		<description><![CDATA[Today I faced a problem with FPDF and FPDI when trying to concatenate some PDF files. The only output I got was 'FPDF error: Unable to find xref table.' When I did a search on this error message, I wasn't able to extract the answer from it. After some searching, the problem was located. One of [...]]]></description>
			<content:encoded><![CDATA[<p>Today I faced a problem with FPDF and <a title="FPDI: concatenate PDF files" href="http://www.setasign.de/products/pdf-php-solutions/fpdi/demos/concatenate-fake/" target="_blank">FPDI when trying to concatenate some PDF files</a>. The only output I got was 'FPDF error: Unable to find xref table.' When I did a search on this error message, I wasn't able to extract the answer from it. After some searching, the problem was located.</p>
<p><span id="more-124"></span></p>
<p>One of the PDFs which should be merged was originally created from Word by a PDF creator which placed its signature in the properties of the PDF document. After removing this signature (in this case opening the PDF with Adobe Illustrator and saving it again) the problem was solved.</p>
<p><strong>Compression and stream<br />
</strong></p>
<p>The FPDF / FPDI classes use the input stream of the PDF file to create the concatenated PDF. Setasign <a title="Setasign remark" href="http://www.setasign.de/products/pdf-php-solutions/fpdi/demos/concatenate-fake/" target="_blank">remarks</a> that the stream is only used (and altered) in the free version. The paid version should not give such errors. As I've experimented with the free version, I'll treat that one here.</p>
<p>Because of compression, some applications might leave out or mess up the xref property. Although this results in a PDF file which can be opened in a PDF reader, the stream is not according to the 'standards'. In such a case the document markup is 'lost' and applications / scripts using this property cannot handle these files any more.</p>
<p><strong>PDF merging code example</strong></p>
<p>To show how PDF files can be merged by using FPDF and FPDI I've compiled a little example which can be downloaded <a title="Downloads" href="http://www.vankouteren.eu/blog/downloads/" target="_self">here</a>. The archive consists of FPDF version 1.6, FPDI version 1.3.1, FPDI_TPL and two sample PDF files which were created with Microsoft Word 2007. The executing script is concat.php. Run this script to concatenate the two sample PDF files together in a new PDF file.</p>
<p><strong>Possible solutions</strong></p>
<p>A paid version of FPDI might be an option, but let's have a look at other possible solutions.</p>
<p>Opening the file and saving it again with a better pdf creator might fix the problem as it reformats the stream which is saved.</p>
<p><strong>Final remarks</strong></p>
<p>When you're creating the source PDF files yourself, watch out which pdf creator you use. Although the visual result might be the same, the stream might not be.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vankouteren.eu/blog/2009/07/fpdf-error-unable-to-find-xref-table/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
	</channel>
</rss>

