1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice
  2. If you update to Joomla 3.9.16, you will have to update Fabrik from the latest GitHub version, to fix a bug introduced in Joomla, which makes it impossible to list front end folder locations in backend JForms. This affects things like template selection.
    Dismiss Notice

PDF output

Mar 3, 2020
PDF output
  • Docu is work in progress.


    Installation(top)

    If Fabrik PDF output should be used you must install the "Fabrik Library" from Fabrik Download http://fabrikar.com/download to get the necessary files including the dompdf and mpdf library (it's to big to have it in Fabrik core).
    Go to Fabrik "Options" (button upper right on every Fabrik backend site).
    In the "Global" tab select your prefered PDF library.
    In "Debugging" tab: Debug PDF has to be NO
    In "List" and "Form" tab: you can choose global settings for showing the PDF button (can also be set individually in list and form "Layout" settings )
    In "List" tab you can enable "Allow PDF Localhost" and "Allow PDF IP" if you are running into issues with access settings (see tooltips for details)

    3rd party compatibility(top)

    Plugin System - Flexisystem, core functions: make sure "Redirect pdf format" is set to NO.
    http://fabrikar.com/forums/index.php?wiki/admintools/#joomla-feature-hardening-options

    Settings(top)

    PDF options can be set in list and form settings ("Layout" section)
    PDFSettings.PNG
    The PDF icon has also global options in Fabrik "Options".

    PDF templates(top)

    The standard templates can be used, but is recommended to create custom PDF templates.
    To create a custom template, copy the templates folder and rename it. Template locations are as follows:
    • Joomla 3+: Details: components/com_fabrik/views/details/tmpl/ (PDF template is always a details template)
    • Joomla 3+: List: components/com_fabrik/views/list/tmpl/
    • Joomla 2.5+: Form: components/com_fabrik/views/form/tmpl25/
    • Joomla 2.5+: Details: components/com_fabrik/views/details/tmpl25/
    • Joomla 2.5+: List: components/com_fabrik/views/list/tmpl25/
    Dompdf has issues in rendering e.g. float and boxes, in a custom template you can adapt the CSS settings to your needs.
    CSS example details view(top)
    To get labels left you can add or modify your custom CSS File.
    Code (Text):
    #{$form} .fabrikElementContainer.span12 {position:relative;margin-bottom:10px}
    #{$form} .fabrikElementContainer .span4 {display:inline-block;width:30%}
    #{$form} .fabrikElementContainer .span8 {display:inline-block;left:31%;width:68%}
    To display yes/no (domPDF standard fonts don't support the IcoMoon icons)
    Code (Text):
    #{$form} .icon-checkmark:before {content:'yes'}
    #{$form} .icon-remove:before {content:'no'}
    CSS example list div template(top)
    Code (Text):
    #listform_$c .fabrikList .row-fluid .span4 {display:inline-block;width:26%;float:none;}
    #listform_$c .fabrikList .row-fluid {page-break-inside:avoid;}

    PDF template with page header, footer and pagenumber(top)

    Create a custom template.
    Edit default.php (this example is referring to a copy of fabrik list bootstrap template):
    Below line "defined('_JEXEC') or die('Restricted access');" add
    Code (Text):
    ?>
    <div id="footdompdf">
        <span class="footleft"><?php echo $this->table->label;?></span>
        <span class="pagenum">Page </span>
    </div>
    <div id="headerdompdf">
        <span class="headleft"><?php echo $this->table->label;?></span>
        <span class="pdfdate">19-11-2013</span>
    </div>
    <?php
    Create/edit custom_css.php
    Add CSS
    Code (Text):
    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;
    }

    PDF fonts, UTF-8 characters(top)

    Dompdf uses it's own fonts included in (as of Fabrik 3.8) libraries/fabrik/vendor/dompdf/dompdf/lib/fonts. Only the dejavu fonts support UTF-8 characters.

    To force the PDF output to use DejaVu, put this in a custom_css.php in your template folder:
    Code (Text):

    * {font-family:'dejavu sans'!important}
     
    Too include a custom font in a pdf details view, you can add the following:

    Code (Text):

    @font-face {
    font-family: 'yourfontname';
    font-style: normal;
    font-weight: normal;
    src: url('https://websitedomain/subfoldername/yourfontname.ttf) format('truetype');
    }
     
  • Loading...
tagger likes this.