• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Custom PDF template doesn't print to PDF with polish characters

Status
Not open for further replies.
Hi,
I have my own list template:
/com_fabrik/views/list/tmpl/default-2015-12-14-table-zlicz-pakiety-pdf1
that i use as:
- Front-end-template
and
-PDF template ( PDF Orientation: Portrait, PDF Paper size: a2)

This is very customized template - list view include only:
-box for searching (field: ccjom_cc_kk_karta_rejestr___zamow_symbol) --
Szukaj:
Nr zam.

- calculations ( some calculations are fabrik calculations for columns, some calculations are my own advanced calculations with code in file:

/com_fabrik/views/list/tmpl/default-2015-12-14-table-zlicz-pakiety-pdf1/default.php

A piece of list view is in screenshoot: Zaznaczenie_127.png

My own code in default.php is for example this piece of code:
PHP:
<?php  $n=0;

                        foreach ($this->calculations as $cal) {

if($n >=7 and $n<8)  {
                                 echo '<tr class="fabrik_calculations">';
                                        echo "<td>";


echo " <div class='podkr1' style='margin-top: -7px; margin-bottom: -13px; text-align:right;'>  </div><br/>";
echo " <div class='tyt1'> Pakiety wej?? analogowych: - - - - - Add2 </div><br/>";
$db =& JFactory::getDBO();


for ($i=1; $i<=5; $i++){

if ($order1==0){
$query = "SELECT  `is_pak_xxxx`, `field_pakiety_analogowe` FROM  `ccjom_cc_kk_karta_rejestr` WHERE ( `rodzaj_karty_np_wzorzec`= '2' and `field_pakiety_analogowe`="$
}
else {
$query = "SELECT  `is_pak_xxxx`, `field_pakiety_analogowe`  FROM `ccjom_cc_kk_karta_rejestr` WHERE ( `zamow_symbol`=".$order1."  and `field_pakiety_analogowe`=".$i$
}


I have a problem with line like this:
echo " <div class='tyt1'> Pakiety wej?? analogowych: - - - - - Add2 </div><br/>";

"wej??" - include polish characters : ?, ? that are well displayed on list_view but wrong on PDF-printout.


I try also add at the beginning of file default.php - line with code:
PHP:
 header('Content-type: text/plain; charset=utf-8');
but this doesn't change nothing

On PDF-printout i get line:
echo " <div class='tyt1'> Pakiety wej?? analogowych: - - - - - Add2 </div><br/>";
without polish characters, i get instead them: "??".
Sample of PDF-output i have on screenshoot: Zaznaczenie_128.png.

I can copy directory:
/com_fabrik/views/list/tmpl/default-2015-12-14-table-zlicz-pakiety-pdf1
to directory:
/com_fabrik/views/list/tmpl/default-2015-12-14-table-zlicz-pakiety-pdf1-printout
And can do independent template for PDF-output.

But what and how to change code to get in PDF polish characters?
Now need to solve problem with lines like:
echo " <div class='tyt1'> Pakiety wej?? analogowych: - - - - - Add2 </div><br/>";
that are only in default.php file.

Link to list

Neccessary is login to site.
 

Attachments

  • Zaznaczenie_127.png
    Zaznaczenie_127.png
    46.8 KB · Views: 640
  • Zaznaczenie_128.png
    Zaznaczenie_128.png
    107.2 KB · Views: 804
  • Zaznaczenie_129.png
    Zaznaczenie_129.png
    71.3 KB · Views: 711
Last edited:
You may need to run the output through mb_convert_encoding. Around line 145 in ./libraries/joomla/document/pdf/pdf.php, just before we do the load_html(), try ...

Code:
$data = mb_convert_encoding($data,'HTML-ENTITIES','UTF-8');

You might also try using a different font, as per this Stack Overflow discussion:

http://stackoverflow.com/questions/16384517/dompdf-character-encoding-utf-8

You can see in that code where we've tested using different fonts before.

-- hugh
 
Hi,

This works (i get polish characters on pdf) when i use:
- in ./libraries/joomla/document/pdf/pdf.php: ---before we do the load_html()---
$data = mb_convert_encoding($data,'HTML-ENTITIES','UTF-8');

- in custom_css.php:
* {font-family:arial!important}

I need this 2 lines with code both to have polish characters in PDF.
-------------------------------------------------------------------------------

I try also second option in link from troester
- in custom_css.php:
* {font-family:'dejavu sans'!important}
but this doesn't work.
--------------------------------------------------------------------------------

This what i get now is enought for me for polish characters in PDF for that list.

Very thanks! :)
 
Yeah, I think there's an issue where certain characters get converted to HTML entities rather than UTF-8 encoded, when rendering a view.

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top