<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Add massive Terms and Conditions/import PDF]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=10222&amp;type=atom" />
	<updated>2023-03-19T07:35:44Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=10222</id>
		<entry>
			<title type="html"><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42187#p42187" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[advocaat.pollet]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=46170</uri>
			</author>
			<updated>2023-03-19T07:35:44Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42187#p42187</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42185#p42185" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[kvvaradha]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19348</uri>
			</author>
			<updated>2023-03-19T06:12:27Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42185#p42185</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42183#p42183" />
			<content type="html"><![CDATA[<p>Oh, PHP Version 8.0.23</p>]]></content>
			<author>
				<name><![CDATA[advocaat.pollet]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=46170</uri>
			</author>
			<updated>2023-03-18T18:41:59Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42183#p42183</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42181#p42181" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2023-03-18T14:37:12Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42181#p42181</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42180#p42180" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[advocaat.pollet]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=46170</uri>
			</author>
			<updated>2023-03-18T14:30:05Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42180#p42180</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42179#p42179" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2023-03-18T14:21:35Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42179#p42179</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42178#p42178" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[advocaat.pollet]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=46170</uri>
			</author>
			<updated>2023-03-18T12:52:30Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42178#p42178</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Add massive Terms and Conditions/import PDF]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42171#p42171" />
			<content type="html"><![CDATA[<p>http://frontaccounting.com/punbb/viewtopic.php?id=4511</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2023-03-15T16:03:29Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42171#p42171</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Add massive Terms and Conditions/import PDF]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42165#p42165" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[advocaat.pollet]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=46170</uri>
			</author>
			<updated>2023-03-12T19:35:00Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42165#p42165</id>
		</entry>
</feed>
