<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Add massive Terms and Conditions/import PDF]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=10222</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=10222&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Add massive Terms and Conditions/import PDF.]]></description>
		<lastBuildDate>Sun, 19 Mar 2023 07:35:44 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=42187#p42187</link>
			<description><![CDATA[<p>Hi kvvaradha,</p><p>I am no PHP-programmer, so please provide the code / instructions (dummy-proof ;-)).</p><p>It seems that the fpdi-files need an update for later PHP-versions.</p><p>I rewrote the function, and it works very well :</p><div class="quotebox"><blockquote><p>function TermsAndConditions()<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; $tmpl_pdf = find_custom_file(&quot;/reporting/forms/TermsAndConditions.pdf&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($tmpl_pdf) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;tmplSize = $this-&gt;setSourceFile($tmpl_pdf);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; for ($i = 1; $i &lt;= $this-&gt;tmplSize; $i++) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $id = $this-&gt;importPage($i);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;AddPage();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;useTemplate($id);<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; }</p></blockquote></div><p>Ofcourse one can define and set a separate header too, calling the TermsAndConditions-file. The problem for me was that &#039;importPage()&#039; only included 1 page, where the TermsAndConditions-file had 2 (or more) pages.</p><p>Kind regards,<br />F.</p>]]></description>
			<author><![CDATA[null@example.com (advocaat.pollet)]]></author>
			<pubDate>Sun, 19 Mar 2023 07:35:44 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=42187#p42187</guid>
		</item>
		<item>
			<title><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=42185#p42185</link>
			<description><![CDATA[<p>I guess its little messy way to customize the fpdi.</p><br /><p>Its possible with a template header. And it can designed as a php file and put it inside the forms directory.</p><p>Before end of the myrow while loop there we need to call the newpage and set the header again. This header should call the file name which you dropped inside forms directory. </p><p>It will get you the&nbsp; terms and conditions in a separate page after each invoice generated.&nbsp; </p><p>Hope this will be less complicated then modifying the fpdi files.</p>]]></description>
			<author><![CDATA[null@example.com (kvvaradha)]]></author>
			<pubDate>Sun, 19 Mar 2023 06:12:27 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=42185#p42185</guid>
		</item>
		<item>
			<title><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=42183#p42183</link>
			<description><![CDATA[<p>Oh, PHP Version 8.0.23</p>]]></description>
			<author><![CDATA[null@example.com (advocaat.pollet)]]></author>
			<pubDate>Sat, 18 Mar 2023 18:41:59 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=42183#p42183</guid>
		</item>
		<item>
			<title><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=42181#p42181</link>
			<description><![CDATA[<p>The ?? construct is for later versions of PHP alone and will fail in PHP 5.x.<br />Verify that $res[0] is set to 9 before the if check.</p><p>No code change is required at all for PHP 5.x.<br />Kindly state your PHP version.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sat, 18 Mar 2023 14:37:12 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=42181#p42181</guid>
		</item>
		<item>
			<title><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=42180#p42180</link>
			<description><![CDATA[<p>Changed it like this :</p><div class="quotebox"><blockquote><p>function _getPageRotation ($obj) { // $obj = /Page<br />&nbsp; &nbsp; &nbsp; &nbsp; $obj = $this-&gt;pdf_resolve_object($this-&gt;c, $obj);<br />&nbsp; &nbsp; &nbsp; &nbsp; if (isset ($obj[1][1][&#039;/Rotate&#039;])) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $res = $this-&gt;pdf_resolve_object($this-&gt;c, $obj[1][1][&#039;/Rotate&#039;]);<br />//DEV:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($res[0] ?? &#039;default value&#039; == PDF_TYPE_OBJECT)<br />//:DEV<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $res[1];<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $res;<br />&nbsp; &nbsp; &nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!isset ($obj[1][1][&#039;/Parent&#039;])) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $res = $this-&gt;_getPageRotation($obj[1][1][&#039;/Parent&#039;]);<br />//DEV:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($res[0] ?? &#039;default value&#039; == PDF_TYPE_OBJECT)<br />//:DEV<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;return $res[1];<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $res;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; }</p></blockquote></div><p>Solved the warning.</p>]]></description>
			<author><![CDATA[null@example.com (advocaat.pollet)]]></author>
			<pubDate>Sat, 18 Mar 2023 14:30:05 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=42180#p42180</guid>
		</item>
		<item>
			<title><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=42179#p42179</link>
			<description><![CDATA[<p><strong>fpdi</strong> v1.2.1 is used in FA 2.4.x.</p><p>The warning may be safely ignored. The said line is:<br /></p><div class="codebox"><pre><code>if ($res[0] == PDF_TYPE_OBJECT)</code></pre></div><p>It can better be modified as:<br /></p><div class="codebox"><pre><code>if ((gettype($res[0] == &#039;boolean&#039; || gettype($res[0]) == &#039;integer&#039; ) &amp;&amp; $res[0] == PDF_TYPE_OBJECT)</code></pre></div><p>Which version of PHP are you using?</p><p>The said constant is defined in <strong>reporting/includes/fpdi/pdf_parser</strong> lines 38, 39:<br /></p><div class="codebox"><pre><code>if (!defined (&#039;PDF_TYPE_OBJECT&#039;))
    define (&#039;PDF_TYPE_OBJECT&#039;, 9);</code></pre></div><p>It is probably expecting an &#039;integer&#039; and not a &#039;boolean&#039;.</p><p>Alternatively, the said line can be modified as:<br /></p><div class="codebox"><pre><code>$res[0] = $res[0]+0;
if ($res[0] == PDF_TYPE_OBJECT)</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sat, 18 Mar 2023 14:21:35 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=42179#p42179</guid>
		</item>
		<item>
			<title><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=42178#p42178</link>
			<description><![CDATA[<p>Thanks apmuthu !</p><p>This is what I have done :</p><p>1/ Created my Terms and Conditions (2 pages), saved them in a pdf-file, named &#039;TermsAndConditions.pdf&#039;.<br />2/ Placed this file in /reporting/forms.<br />3/ Made a new function &#039;TermAndConditions&#039; in /reporting/includes/pdf_report.inc :</p><div class="quotebox"><blockquote><p>function TermsAndConditions()<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; if ($this-&gt;pageNumber &gt; 1)<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; $tmpl_pdf = find_custom_file(&quot;/reporting/forms/TermsAndConditions.pdf&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($tmpl_pdf) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;tmplSize = $this-&gt;setSourceFile($tmpl_pdf);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if ($this-&gt;tmplSize)<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for ($i = 1; $i &lt;= $this-&gt;tmplSize; $i++) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parent::newPage();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $id = $this-&gt;importPage(min($i, $this-&gt;tmplSize));<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;useTemplate($id);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; }</p></blockquote></div><p>4/ In the reports where I need my Terms and Conditions (ex. &#039;rep107.php&#039; (invoices)), before &#039;if ($email == 1) ...&#039;, added :</p><div class="quotebox"><blockquote><p>// START my modification<br />&nbsp; &nbsp; $rep-&gt;TermsAndConditions();<br />&nbsp; &nbsp; // END my modification</p></blockquote></div><p>This works as expected (the report with Terms and Conditions is created as it must be), but I get a php-warning in Frontaccouting :</p><div class="quotebox"><blockquote><p>Trying to access array offset on value of type bool in file: /.../reporting/includes/fpdi/fpdi_pdf_parser.php op regel 336</p></blockquote></div><p>What should be done ?</p><p>F.</p>]]></description>
			<author><![CDATA[null@example.com (advocaat.pollet)]]></author>
			<pubDate>Sat, 18 Mar 2023 12:52:30 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=42178#p42178</guid>
		</item>
		<item>
			<title><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=42171#p42171</link>
			<description><![CDATA[<p>http://frontaccounting.com/punbb/viewtopic.php?id=4511</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Wed, 15 Mar 2023 16:03:29 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=42171#p42171</guid>
		</item>
		<item>
			<title><![CDATA[Add massive Terms and Conditions/import PDF]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=42165#p42165</link>
			<description><![CDATA[<p>Hi,</p><p>In an older thread (https://frontaccounting.com/punbb/viewtopic.php?id=6629) I found :</p><p>&quot;You can have a generic PDF included into the invoice. Alternatively, you can have a link in the Invoice pointing to a PDF file hosted at your site. Use the TCPDF page number variables at will in the report.&quot;</p><p>But how can I include a PDF into an invoice ?</p><p>Thanks !</p><p>F.</p>]]></description>
			<author><![CDATA[null@example.com (advocaat.pollet)]]></author>
			<pubDate>Sun, 12 Mar 2023 19:35:00 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=42165#p42165</guid>
		</item>
	</channel>
</rss>
