1 (edited by apmuthu 02/09/2015 10:35:20 am)

Topic: Purpose of setSourceFile in reporting/forms - Header2.pdf, Header2.php

What is the purpose of placing a Header2.pdf file in reporting/forms folder (possibly in the company folder)?

On New page creation in reports, the function setSourceFile() in reporting/includes/fpdi/fpdi.php is called and returns the number of pages in the above Header2.pdf file.

On New page creation in reports another possibility is to place a Header2.php file in reporting/forms folder (possibly in the company folder) as well - what does it do?

Re: Purpose of setSourceFile in reporting/forms - Header2.pdf, Header2.php

You can either place a header.pdf or header2.pdf file here to be merged.
This feature hasn't really being documented.

You can place a pdf file here to be merged with the current report.

Usability could be to place a company logo on top of of the header.pdf.

Or a stamp underneath the existingg report, such as confidential data across the page in a vague color.

You can use a word processor, like MS Word or Open Office  Writer to print to a pdf file with a printer driver like doPdf.

Joe

Re: Purpose of setSourceFile in reporting/forms - Header2.pdf, Header2.php

setSourceFile() loads an existing pdf as a "background", onto which all output is "printed". I use it elsewhere for generating invoices, but here it's probably used to include a company letterhead.

4 (edited by apmuthu 02/10/2015 07:29:57 pm)

Re: Purpose of setSourceFile in reporting/forms - Header2.pdf, Header2.php

Uploaded the Watermark PDF file as company/1/reporting/includes/forms/Header2.pdf (case sensitive - must be same name as HeaderTmpl with pdf extension) and attached the sample invoice PDFs generated.

If the Watermark file is formatted as PDF v1.5 and above, then we get a "Unexpected data in xref table" error. FPDI Commercial version can read PDF v1.5 and higher.

We can convert such files to PDF v1.4 format using PDFCreator and then use it in FA without errors. PDFCreator is a virtual print driver to generate PDF files.

MS Word 2007 => Page layout => Watermark => Custom Watermark => File => Save As => PDF or XPS
yields a PDF v1.5 format that needs to be converted as above before using it in FA.

Please note that there is no option to turn it on or off and if the watermark file is present, then it will be used for all reports that use the header template.

Post's attachments

HeaderInvoices.zip 38.3 kb, 20 downloads since 2015-02-10 

You don't have the permssions to download the attachments of this post.

Re: Purpose of setSourceFile in reporting/forms - Header2.pdf, Header2.php

You can also print to a pdf printer driver, doPdf instead af saveas. This will give you lesser  Footprints. You save the pdf file when printing to pdf.

You can find a link to doPdf here.

Joe

Re: Purpose of setSourceFile in reporting/forms - Header2.pdf, Header2.php

@joe: Thanks for the doPDF tip. PDFCreator too generates small PDF files and is free but may try to install some nagware (optional) in the later versions.

Re: Purpose of setSourceFile in reporting/forms - Header2.pdf, Header2.php

Hello again,

Here is an OpenOffice Writer file, that can be used for laboration. Replace the logo with your own. Remember to not getting it too high. Click on the light gray rotated text, Change the text and maybe select Another color (mark the text and right mouse click and select Character...).

Finally Export to PDF (or print via doPdf print driver, see above) and name it header.pdf  for normal reports or header2.pdf if you will use it for documents. The file should be in the /reporting/forms folder.

Remember that this background works best with Portrait reports.

If you end up with a fancy background, please share it with us by sending an OpenOffice Writer .odt file. Thanks in advance.

/Joe

Post's attachments

header.odt 17 kb, 8 downloads since 2015-02-10 

You don't have the permssions to download the attachments of this post.

Re: Purpose of setSourceFile in reporting/forms - Header2.pdf, Header2.php

@joe: Thanks for the OpenWriter file. Will be useful in documenting this feature.

English translation of Swedish "laboration": Laboratory / Experimental Work.

Anyone used the Header.php / Header2.php in the reporting/forms folder in the company/#/ folder?

Re: Purpose of setSourceFile in reporting/forms - Header2.pdf, Header2.php

thanks mate!

10 (edited by apmuthu 02/11/2015 07:03:10 am)

Re: Purpose of setSourceFile in reporting/forms - Header2.pdf, Header2.php

Wikied "Watermarking and background / logo merging in reports". It now stands documented!

11 (edited by apmuthu 02/11/2015 10:16:05 am)

Re: Purpose of setSourceFile in reporting/forms - Header2.pdf, Header2.php

The Template (eg., Header2) function is executed only at the very end of the New page method and the the company/#/reporting/Header2.php if present will provide overrides for properties not defined in it and in doctext.inc and header2.inc or in cases where pre-defined property values in them are not overridden (like $this->formData['br_name']).

Any variables (need to global them) and properties referred to in the header2.inc and doctext.inc files that are not part of the core can be provided in the Header2.php file and assigned in header2.inc and doctext.inc only if absent.

If the Header2.pdf / Header.pdf files have more than one page, then each one is used in succession for the report and the last one for the remaining pages of the report.

Post's attachments

FA Watermarking Overlaying Reports.pdf 103.7 kb, 19 downloads since 2015-02-11 

You don't have the permssions to download the attachments of this post.

Re: Purpose of setSourceFile in reporting/forms - Header2.pdf, Header2.php

An example of company/1/reporting/forms/Header2.php usage and it's effect is attached. The wiki has been updated as well.

Post's attachments

Header2_php_example.zip 16.1 kb, 19 downloads since 2015-02-11 

You don't have the permssions to download the attachments of this post.

13 (edited by mark0300 07/03/2015 08:14:21 am)

Re: Purpose of setSourceFile in reporting/forms - Header2.pdf, Header2.php

Hi Joe/AP Muthu,

Is it possible to add a link on the screen (say Company Setup) and allow users to select the file (Header.pdf or Header2.pdf)  and upload the files to the company/X/reporting/forms/ directory?     We host FA in a server but we do not want the users to access to the FA directory.

If so, would you please advise the codes to add?

Thanks a lot.

Regards,
Mark

Re: Purpose of setSourceFile in reporting/forms - Header2.pdf, Header2.php

File uploading is generally avoided as far as is possible. In FA, document uploads for various classes of vouchers are supported. Watermarking pdfs, if used will need to be on a per company basis in the current FA dispensation and hence no choice of pdf file is provided and the custom files hardcoded. Having such a facility to choose the background PDF will then necessitate choosing one each time in what is already a long form for report generation. Furthermore, the choice appears to be hardcoded in several reports and if reduced (if not already) to just one or two functions, it may be feasible.