PDF Output Template

homoapm

New Member
Hi,
I want to have my own PDF output template from a Fabrik List. If I follow the wiki part explaining this I don?t achieve the desired result.
I?ve got a PDF_TEMPLATE folder (a copy from BOOTSTRAP) in the folder:

COMPONENTS/COM_FABRIK/VIEWS/LIST/TMPL/MY_PDF_TEMPLATE

with a CUSTOM_CSS.PHP. But no matter what I put in this file the PDF output remains the same (for example the code in the wiki, i.e. header and footer).
http://fabrikar.com/forums/index.php?wiki/pdf-output/

I?ve checked a lot of times the wiki. But I only achieve the desired result when I put css code into the file html.css in

/libraries/pdf/lib/res/html.css

But, obviously, changing this file is not the right way to proceed, or at least, the standard way...
Any ideas???

Thanks in advance!
 
Did you select your template as PDF template? Enable the PDF button?
For header/footer you must also modify default.php
You may select the PDF template (temporary) as list template and check with e.g. firebug, if your custom_css.php is loaded and not empty (it will be empty if you have a syntax error etc. in it)
/libraries/pdf/lib/res/html.css
This is no folder coming with Joomla or Fabrik, so it seems you are not running the Fabrik PDF output at all.
 
Hi

I have developed in past and now also the custom PDF Output with Fabrik Forms and List

Here i can give you high level steps

1. First you use the PDF Button that is provided for Fabrik Form
2. This PDF button operates with view.pdf.php that is available in components/com_fabrik/...view/view.pdf.php
3. You can generate via using DOM pdf library or mPDF library.
4. I suggest use mPDF library , much more good and user friendly in writing code and very easy ( as i not a developer)
5. In this view.pdf.php file use all your mpdf related code.
6. User Fabrik url to get the parameters like rowid and formid and other element values
5.Create a Copy of the bootstap template and name as "pdftemplate" or something like that
6. In the Fabrik Form setting in admin side you will find the PDF layout selection. select the new pdf template "pdftemplate"
7. Of this template use default_group.php file to give all your outputs.
8 Generate PDF from this template

I am building same now with Fabrik3.1 Release, if it is done i will post it.

I have done in past for Fabrik previous release for one of my customer.
 
Did you select your template as PDF template? Enable the PDF button?
For header/footer you must also modify default.php
You may select the PDF template (temporary) as list template and check with e.g. firebug, if your custom_css.php is loaded and not empty (it will be empty if you have a syntax error etc. in it)
This is no folder coming with Joomla or Fabrik, so it seems you are not running the Fabrik PDF output at all.


Hi Troester, thanks for your reply.
Yes, I selected MY_PDF_TEMPLATE as the PDF template, and enabled the PDF button.
Yes, I modified the default.php file in the template folder as the wiki shows.

I'll give a try to Firebug but I think everything is okay. My custom_css.php is the same in the wiki:

PHP:
<?php
 
header('Content-type: text/css');
$c = $_REQUEST['c'];
$buttonCount = (int) $_REQUEST['buttoncount'];
$buttonTotal = $buttonCount === 0 ? '100%' : 30 * $buttonCount ."px";
echo "
 
body {
margin-top:1.5em;margin-bottom:1.5em;
}
#headerdompdf {
    display:block;
    position: fixed;
    top: 0px;
    width:100%;
    height:1.1em;
    border-bottom: 1px solid red;
}
#footdompdf {
    display:block;
    position: fixed;
    bottom: 0px;
    width:100%;
    height: 1.1em;
    border-top: 1px solid red;
}
#footdompdf .pagenum { position:absolute;
    right: 20px;}
#footdompdf .pagenum:after {
  content: counter(page) ; //This is including the page number at bottom right
}
#footdompdf .footleft {
    color:red;
}";?>

This is no folder coming with Joomla or Fabrik, so it seems you are not running the Fabrik PDF output at all.

Yes, I'm sorry. I mistyped it. It's:

/libraries/dompdf/lib/res/html.css

If I add css code to this file, then the PDF layout changes. No other way works for me, and I don't know why. I am missing something.

Thanks for you help, Troester!
 
Hi

I have developed in past and now also the custom PDF Output with Fabrik Forms and List

Here i can give you high level steps

1. First you use the PDF Button that is provided for Fabrik Form
2. This PDF button operates with view.pdf.php that is available in components/com_fabrik/...view/view.pdf.php
3. You can generate via using DOM pdf library or mPDF library.
4. I suggest use mPDF library , much more good and user friendly in writing code and very easy ( as i not a developer)
5. In this view.pdf.php file use all your mpdf related code.
6. User Fabrik url to get the parameters like rowid and formid and other element values
5.Create a Copy of the bootstap template and name as "pdftemplate" or something like that
6. In the Fabrik Form setting in admin side you will find the PDF layout selection. select the new pdf template "pdftemplate"
7. Of this template use default_group.php file to give all your outputs.
8 Generate PDF from this template

I am building same now with Fabrik3.1 Release, if it is done i will post it.

I have done in past for Fabrik previous release for one of my customer.


Hi ritesh123,
Thanks for your reply!

I'm having a look at mPDF and it seems fine to me. It's pretty well documented. Maybe I'll give it a try.
Thanks for your time and your explanation!
 
Hi ritesh123,

Thanks for mentioning mPDF. Did you managed to make it work with Fabrik 3.1? If so, could it be possible to have an example of how you did it.
 
I've just tested with the copy/pasted code from homoapm (custom_css.php), it is loaded and the list's PDF is created as expected including header/footer + page number using the domPDF lib.
Latest Fabrik3.1 GitHub version.

If you are using a very recent list bootstrap copy in default.php you have to modify
<tbody class="fabrik_groupdata">
<tr >

to
<tbody class="fabrik_groupdata">
<tr style="<?php echo $this->emptyStyle?>" >
 
FYI Troester commit a fix for this which is available in today's Fabrik3.1 release
 
I would like to make a customized detail output. Now if I print the pdf of the details the elements are in list format, I would like to arrange them differently (eg 4 or 5 per line). To those who can help me infinite thanks.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top