• Payment Plugins Poll

    We need your feedback on the need for updated payment plugins. Please go here and give us your feedback.

  • Joomla 5.1

    For running J!5.1 you must install Fabrik 4.1
    See also Announcements

  • Subscription and download (Fabrik 4.1 for J!4.2+ and J!5.1) are working now

    See Announcement
    Please post subscription questions and issues here

    We have resolved the issue with the J! updater and this will be fixed in the next release.

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.

Members online

No members online now.
Back
Top