1. NOTICE: If you are using Fabrik and update to Joomla 3.10, you will need to update to Fabrik 3.10. And, if you are using Fabrik, do not upgrade to Joomla 4, we do not have a supported version ready for release. More information on a release date coming soon. Also, please note that Fabrik 3.10 will not install on any Joomla sites less than 3.8.
    Dismiss Notice

Problem with cirillic in dompdf

Discussion in 'Community' started by GorYa, Nov 8, 2016.

  1. GorYa

    GorYa Member

    Level: Community
  2. troester

    troester Well-Known Member Staff Member

    Level: Community
  3. GorYa

    GorYa Member

    Level: Community
    Thanks for the quick response. I decided to use a font already present in dompdf 'dejavu sans', as it already contains Cyrillic. Then I try to add a {font-family:! 'dejavu sans' important} file components/com_fabrik/views/form/tmpl/bootstrap/custom_css_example.php ? components/com_fabrik/views/details/tmpl/bootstrap/custom_css_example.php, but nothing has changed, and Cyrillic letters are also displayed with question marks, as in the admin panel and on the front-end. Replacement file "dompdf_config.inc.php" on
    def("DOMPDF_DEFAULT_FONT","DejaVu Sans"), too, nothing has changed.
    "Did I do something wrong?
     
    Last edited: Nov 8, 2016
  4. troester

    troester Well-Known Member Staff Member

    Level: Community
    Yup, wrong syntax
    * {font-family:'dejavu sans'!important} (ie ! directly before important)
     
    GorYa likes this.
  5. GorYa

    GorYa Member

    Level: Community
    Thank you, but in my case it does not work. The default style is used for a detailed view and to form, in what place is not my attributes (try almost in every line), nothing changes. All the necessary library in php included. Very strange that the forced change of the default font in dompdf on dejavu is not working
     
  6. troester

    troester Well-Known Member Staff Member

    Level: Community
    I really can't replicate.

    List, form, details PDF is showing Cirillic correctly (tested with ??????) if
    * {font-family:'dejavu sans'!important}
    is included in the particular templates selected as PDF templates.

    Are you using the domPDF lib from Fabrik GitHub?
     
  7. GorYa

    GorYa Member

    Level: Community
    Hi!
    I downloaded again from githab files, replaced them on the site. Nothing changed. It is possible that due to the fact that I'm using the default styles, I'm just not in that file I bring the font attribute (/components/com_fabrik/views/details/tmpl/bootstrap/custom_css_example.php)
    PHP:
    <?php
    * {font-family:'dejavu sans'!important}
    /**
    * Default Form Template: Custom CSS
    *
    * @package     Joomla
    * @subpackage  Fabrik
    * @copyright   Copyright (C) 2005-2016  Media A-Team, Inc. - All rights reserved.
    * @license     GNU/GPL http://www.gnu.org/copyleft/gpl.html
    * @since       3.0
    */


    /**
    * If you need to make small adjustments or additions to the CSS for a Fabrik
    * template, you can create a custom_css.php file, which will be loaded after
    * the main template_css.php for the template.
    *
    * This file will be invoked as a PHP file, so the view type and form ID
    * can be used in order to narrow the scope of any style changes.  You do
    * this by prepending #{$view}_$c to any selectors you use.  This will become
    * (say) #form_12, or #details_11, which will be the HTML ID of your form
    * on the page.
    *
    * See examples below, which you should remove if you copy this file.
    *
    * Don't edit anything outside of the BEGIN and END comments.
    *
    * For more on custom CSS, see the Wiki at:
    *
    * http://www.fabrikar.com/forums/index.php?wiki/form-and-details-templates/#the-custom-css-file
    *
    * NOTE - for backward compatibility with Fabrik 2.1, and in case you
    * just prefer a simpler CSS file, without the added PHP parsing that
    * allows you to be be more specific in your selectors, we will also include
    * a custom.css we find in the same location as this file.
    *
    */


    header('Content-type: text/css');
    $c = (int) $_REQUEST['c'];
    $view = isset($_REQUEST['view']) ? $_REQUEST['view'] : 'form';
    $rowid = isset($_REQUEST['rowid']) ? $_REQUEST['rowid'] : '';
    $form = $view . '_' . $c;
    if ($rowid !== '')
    {
        $form .= '_' . $rowid;
    }
    echo <<<EOT

    /* BEGIN - Your CSS styling starts here */

    #$form .foobar {
        display: none;
    }

    /* END - Your CSS styling ends here */

    EOT
    ;
     
  8. troester

    troester Well-Known Member Staff Member

    Level: Community
    Did you see
    in custom_css.php?

    + you must rename or copy custom_css_example.php to custom_css.php
    + if you are modifiying in /details/bootstrap you must use the bootstrap template as PDF template (usually it's wise to create a custom template because domPDF has it's restrictions (e.g. with float..) and you have to adapt CSS which you don't want to be changed for the normal output)
    http://www.fabrikar.com/forums/index.php?wiki/form-and-details-templates/
     
    Last edited: Nov 9, 2016
  9. GorYa

    GorYa Member

    Level: Community
    Thanks for the help!
    Unfortunately it did not happen to make Cyrillic readable. It is unfortunate that this attribute (* {font-family:'dejavu sans'!important}) is not present in the template parts and the default form, because it universal and is suitable for most languages. He was eventually forced to use a ready-made solution to create PDF with the ability to convert both by dompdf and mpdf, tspdf, wkhtmltopdf
     
    Last edited: Nov 9, 2016
  10. troester

    troester Well-Known Member Staff Member

    Level: Community
    It's working if you are using Fabrik's PDF.

    But if you have other stuff overriding Fabrik's functionality you have to solve it on this end on your own.
     
  11. lpro87

    lpro87 New Member

    Level: Community
    Hello dear masters. Help with displaying Cyrillic in PDF o_O


    [​IMG]
     
  12. troester

    troester Well-Known Member Staff Member

    Level: Community
  13. lpro87

    lpro87 New Member

    Level: Community

Share This Page