Topic: Image as a template?

Hi! I downloaded FrontAccounting and it seems like a good software. I'm kinda playing around with it this past few days but there are areas where I get confused. I'm just a newbie programmer, by the way.

Well, I just wanna ask. Is it possible to make an image or a PDF page as background or template for the forms?
You see, I think there are times when businesses require to pass some forms/reports which have formats that are already predefined such as government tax forms that can be downloaded from the internet, etc. So, I think it would be great if somehow I can use these forms as templates or backgrounds and just worry about filling up the forms.

I hope for your help. Thanks a lot guys and to the FA team! smile

Re: Image as a template?

Yes, you can use any pdf file as background image for pdf report:
. put the pdf template file in reporting/forms folder;
. after creating FrontReport object call SetHeaderType() method passing basename of the template file;
. if you want to add any additional constant elements printed on every page (like titles, additional graphics) you can create *.php file with the same base name in the reporting/forms folder, and put any needed code here.

The pages in template file are used in cycle, so if there is only one page in template file - this page will be used for every page of report generated, if your template has 3 pages and the generated report has 4 - the last page of report will use page 1 as background again.
Janusz

3 (edited by danubi 10/08/2012 08:46:29 am)

Re: Image as a template?

Thank you for the reply, Janusz.  I've already got how to make it work. yay!
One more question though, is there a sample *.php file that may serve as a guide for creating those additional constant elements that you mentioned? If I'm not mistaken, there is no such file existing yet in the default installation. I've already got the PDF template part but  the extra info might be helpful.

Again, thank you very much. smile

Re: Image as a template?

Wikied it.

Re: Image as a template?

Thank you apmuthu smile.
@danubi,
Look into  reporting/includes/header2.inc - this is typical template file for document layout.
Janusz

Re: Image as a template?

Thank you for your replies, Janusz and Apmuthu. Great help smile

Re: Image as a template?

I am trying to follow these instructions as I would like to add a pdf file as a template for the invoice.
After creating the pdf file ( I called it back.pdf) I placed it in fa/reporting/forms folder.

What I don't understand is exactly where to call SetHeaderType() and what would the correct syntax be for the above file.

Thanks in advance
Carmelo

8 (edited by apmuthu 10/11/2013 02:14:32 am)

Re: Image as a template?

I have updated the Wiki on this score.

Search for

$rep->SetHeaderType('Header2');

in some of the reporting/*.php files and you will see how and where to include the function name.

Re: Image as a template?

Thanks apmuthu for updating the wiki.

What is not clear is that apart from the PDF file that I placed in reporting/forms do I have to create another headerX.inc file with code to add my PDF file?

Would I be asking too much if you could add some simple code example in the wiki?

Thanks in advance
Carmelo

Re: Image as a template?

If you want to use pdf template you have to add it to reporting/forms, and file content will be used as report background. But I guess most of the fields on your invoice template has different coordinates than those printed in standard FA invoice report. Then you have to copy Header2.php file to 'reporting/forms/back.php' and change the file content in such a way that invoice fields are printed in proper positions on your blueprint.
Janusz