Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7997801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:03:15+00:00 2026-06-04T15:03:15+00:00

I’m building a tcpdf file for my web site, in that tcpdf file ther

  • 0

I’m building a tcpdf file for my web site, in that tcpdf file ther is a table with some data, But I cant get this charters to work properly. for encoding I’m using windows-1250.
The charters witch are not working : č,ć,đ. I have tried with utf-8 but still not geting this charters is there something wrong with tcpdf?

here is my php:

    <?php

require_once('tcpdf_files/config/lang/hrv.php');
require_once('tcpdf_files/tcpdf.php');

// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, false, 'windows-1250', false);

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 061');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');

// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 061', PDF_HEADER_STRING);

// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

//set some language-dependent strings
$pdf->setLanguageArray($l);

// ---------------------------------------------------------

// set font
$pdf->SetFont('times', '', 10);

// add a page
$pdf->AddPage();

//START OF DATA FOR PDF DOSJE


         $ime = "šiš čevap";
         $prezime = "čušpaiz";
         $rodjenje = "čakardič";
         $odjel = "četnik";
         $radno_mjesto = "čaćijađ";
         $poduzece = "čitluk";
         $putovnica = "čošak";
         $vozacka = "pićkica";


$html = <<<EOF
<!-- EXAMPLE OF CSS STYLE -->
<table width="100%" style="padding:3px;">
<tr>

<td>

    <table border="1" style="border:1px solid grey; width:60%;">

            <tr>

                <td rowspan="3">
                <p style="margin-top:-38px;">POSLODAVAC:</p>
                </td>

                <td>
                Ime firme
                </td>
            </tr>

            <tr>        


                <td>
                    adresa firme
                </td>
            </tr>

            <tr>        

                <td>
                    oib firme
                </td>
            </tr>
    </table><br>

    <table  border="1" style="border:1px solid #dddddd; width:60%;">    
            <tr>            
                <td>
                RADNIK: 
                </td>

                <td>
                $ime $prezime
                </td>
            </tr>

            <tr>        
                <td>
                Oib
                </td>

                <td>
                $rodjenje
                </td>
            </tr>

            <tr>        
                <td>
                Spol
                </td>

                <td>
                $odjel
                </td>
            </tr>

            <tr>        
                <td>
                Dan, mjesec i godina rođenja
                </td>

                <td>
                $radno_mjesto
                </td>
            </tr>

            <tr>        
                <td>
                Državljanstvo
                </td>

                <td>
                $radno_mjesto
                </td>
            </tr>
        </table><br>






EOF;

// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');


// reset pointer to the last page
$pdf->lastPage();


//Close and output PDF document
$pdf->Output('example_061.pdf', 'I');
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:03:16+00:00Added an answer on June 4, 2026 at 3:03 pm

    I’m not sure if it will work, but try iconv. I had to use it when I was making Japanese PDFs. I don’t know what your encoding needs to be, but this is what I used:

    $newtext = iconv("UTF-8", "SJIS", $oldtext);
    

    Obviously change ‘SJIS’ to whatever encoding you are using.

    EDIT

    Just repeating what I said in the comments below, but hopefully it is easier to read up here:

    Try changing the fourth constructor variable to TRUE, so it uses UTF-8:

    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, false, 'windows-1250', false);
                                                                        ⇓
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'windows-1250', false);
    

    If that doesn’t work, I don’t know what to tell you :-/

    EDIT (again)

    Probably a silly question, but did you look at the examples?

    http://www.tcpdf.org/examples/example_018.phps

    Is there nothing there that can help you?

    YET ANOTHER EDIT

    Okay, hopefully this should do it:

    <?php 
    
    require_once('tcpdf/config/lang/hrv.php'); 
    require_once('tcpdf/tcpdf.php'); 
    
    // create new PDF document 
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'utf-8', false);
    
    // set document information 
    $pdf->SetCreator(PDF_CREATOR); 
    $pdf->SetAuthor('Nicola Asuni'); 
    $pdf->SetTitle('TCPDF Example 061'); 
    $pdf->SetSubject('TCPDF Tutorial'); 
    $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); 
    
    // set default header data 
    $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 061', PDF_HEADER_STRING); 
    
    // set header and footer fonts 
    $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); 
    $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); 
    
    // set default monospaced font 
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); 
    
    //set margins 
    $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); 
    $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); 
    $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); 
    
    //set auto page breaks 
    $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); 
    
    //set image scale factor 
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); 
    
    //set some language-dependent strings 
    $pdf->setLanguageArray($l); 
    
    // --------------------------------------------------------- 
    
    // set font 
    $pdf->SetFont('freesans', '', 10); 
    
    // add a page 
    $pdf->AddPage(); 
    
    //START OF DATA FOR PDF DOSJE 
    
      $ime = "šiš čevap";
      $prezime = "čušpaiz";
      $rodjenje = "čakardič";
      $odjel = "četnik";
      $radno_mjesto = "čaćijađ";
      $poduzece = "čitluk";
      $putovnica = "čošak";
      $vozacka = "pićkica";
    
    $html = <<<EOF
    <!-- EXAMPLE OF CSS STYLE --> 
    <table width="100%" style="padding:3px;"> 
      <tr>
        <td>
          <table border="1" style="border:1px solid grey; width:60%;"> 
            <tr>
              <td rowspan="3"> 
                <p style="margin-top:-38px;">POSLODAVAC:</p> 
              </td>
              <td>
                Ime firme
              </td>
            </tr>
            <tr>
              <td>
                adresa firme
              </td>
            </tr>
            <tr>
              <td>
                oib firme
              </td>
            </tr>
          </table>
          <br>
          <table  border="1" style="border:1px solid #dddddd; width:60%;">     
            <tr>             
              <td> 
                RADNIK:  
              </td>
              <td> 
                $ime $prezime 
              </td> 
            </tr>
            <tr>         
              <td> 
                Oib
              </td>
              <td>
                $rodjenje
              </td>
            </tr>
            <tr>
              <td> 
                Spol 
              </td>
              <td>
                $odjel
              </td> 
            </tr>
            <tr>         
              <td>
                Dan, mjesec i godina rođenja 
              </td>
              <td>
                $radno_mjesto
              </td>
            </tr>
            <tr>
              <td>
                Državljanstvo
              </td>
              <td>
                $radno_mjesto 
              </td>
            </tr>
          </table>
          <br> 
        </td>
      </tr>
    </table>
    
    EOF;
    
    // output the HTML content 
    $pdf->writeHTML($html, true, false, true, false, ''); 
    
    
    // reset pointer to the last page 
    $pdf->lastPage(); 
    
    
    //Close and output PDF document 
    $pdf->Output('example_061.pdf', 'I');
    
    ?>
    

    If you are using values from your 1250-encoded database, you will need to convert them like this:

    $db = mysql_connect('localhost', 'user', 'password');
    mysql_select_db('databasename', $db);
    mysql_set_charset("cp1250");
    
    $query = mysql_query("SELECT * FROM `yourtable`");
    
    while ($row = mysql_fetch_assoc($query)) {
      $converted_value = iconv("windows-1250", "utf-8", $row['column_name']);
    }
    

    I made a test table with 1250 collation in my own database, and used the words you supplied. This worked for me. Let me know if it helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
This could be a duplicate question, but I have no idea what search terms
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I want to construct a data frame in an Rcpp function, but when I
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.