From trying to make a PDF report I saw that the webinar as Marcia gave it is not up to date or the best choice to proceed with.
She describes using $pdf->… which is not the best thing to do I think.
I have some generated code here
function inicializa()
{
global $nm_saida,
$rec, $nmgp_chave, $nmgp_opcao, $nmgp_ordem, $nmgp_chave_det,
$nmgp_quant_linhas, $nmgp_quant_colunas, $nmgp_url_saida, $nmgp_parms;
//
$this->nm_data = new nm_data("nl");
include_once("../_lib/lib/php/nm_font_tcpdf.php");
$this->default_font = 'Times';
$this->default_font_sr = '';
$this->default_style = '';
$this->default_style_sr = 'B';
$Tp_papel = "A4";
$old_dir = getcwd();
$File_font_ttf = "";
$temp_font_ttf = "";
$this->Font_ttf = false;
$this->Font_ttf_sr = false;
if (empty($this->default_font) && isset($arr_font_tcpdf[$this->Ini->str_lang]))
{
$this->default_font = $arr_font_tcpdf[$this->Ini->str_lang];
}
elseif (empty($this->default_font))
{
$this->default_font = "Times";
}
if (empty($this->default_font_sr) && isset($arr_font_tcpdf[$this->Ini->str_lang]))
{
$this->default_font_sr = $arr_font_tcpdf[$this->Ini->str_lang];
}
elseif (empty($this->default_font_sr))
{
$this->default_font_sr = "Times";
}
$_SESSION['scriptcase']['pdfreport_PS_RUG_DSS_HDR']['default_font'] = $this->default_font;
chdir($this->Ini->path_third . "/tcpdf/");
include_once("tcpdf.php");
chdir($old_dir);
$this->Pdf = new TCPDF('P', 'cm', $Tp_papel, true, 'UTF-8', false);
$this->Pdf->setPrintHeader(false);
$this->Pdf->setPrintFooter(false);
if (!empty($File_font_ttf))
{
$this->Pdf->addTTFfont($File_font_ttf, "", "", 32, $_SESSION['scriptcase']['dir_temp'] . "/");
}
$this->Pdf->SetDisplayMode('real');
$this->aba_iframe = false;
So in order to use a pdf for yourself it is better to use $this->Pdf instead of a new $pdf. Then the settings as you have filled in will then also be taken into account.
There is code being generated for another font but sadly enough that is not within the settings somewhere (: see the piece if (!empty($File_font_ttf))
Also why the pdf_scale function only uses Helvetica font is vague to me as well. There is no setting for that. So to me it appears that the pdf report is not yet fully developed. Of course this is just for developers so it is no big deal and can be ignored…
292| function Pdf_scale()
293| {
294| $NM_cont = 0;
295| $NM_num_h = 0;
296| $NM_num_v = 0;
297| $this->Pdf->SetFont('Helvetica', '', 6);
298| $this->Pdf->SetLineWidth(0.04);
299| $this->Pdf->SetAutoPageBreak(false);
Anyway it is worth digging into it.
I guess when you use your own $pdf = new TCPDF(‘P’, ‘cm’, ‘A4’, true, ‘UTF-8’, false); you may be better of but you would miss the settings in your application then. Setting default font and background and so on would then be totally useless…
Enough info for your own experiments. Check your generated code and you can learn a lot on how to finetune your pdf to your own liking using the settings as well as basis…