I got a message from Marcia, saying that TCPDF already available in sc8.
But I doubt coz there is no doc, article saying how to develop report via TCPDF
hope the developers can clarify
Thanks
I got a message from Marcia, saying that TCPDF already available in sc8.
But I doubt coz there is no doc, article saying how to develop report via TCPDF
hope the developers can clarify
Thanks
This is how I do it in SC7:
(I use this to convert a html document into pdf)
.
$myroot = $_SERVER["DOCUMENT_ROOT"];
$docid={VIN}.".pdf";
$myoutput = $_SERVER["DOCUMENT_ROOT"].'/temp';
$lib= $myroot.$me.'/third/html2pdf/html2pdf.class.php';
echo '<br>loading lib: '.$lib;
echo '<br> writing to: '.$myoutput;
echo '<br>';
include ($lib);
echo '<br> lib included';
$template = str_replace('[$vin$]',{VIN},$template);
// etc.etc.$template = str_replace('[$dealerpostcode$]',{DealerPostalCode},$template);
$html2pdf=new HTML2PDF('P','A4','en');
//$fontname = $html2pdf->pdf->addTTFfont('fonts/verdana.ttf', 'TrueTypeUnicode', '', 32);
//$fontname = $html2pdf->addFont('verdana', '', 'verdana.ttf');
//$html2pdf->setModeDebug();
$html2pdf->WriteHTML($template);
$html2pdf->Output($myoutput.'/'.$docid,'D');
//echo $template;
echo "PDF file has been generated successfully!";
If SC8 supports tcpdf I hope they have eliminated fpdf. The whole pdf libraries in SC take about 40% of the full lib space!
hi Albert, i followed closely how you manage to generate report
below are my code and, whenever i try run report, it return blank…
==========================================================
$libDir = $_SERVER["DOCUMENT_ROOT"] . '/xlibs/html2pdf/';
//$rptDir = $_SERVER["DOCUMENT_ROOT"] . '/reports/';
$rptDir = $_SERVER["DOCUMENT_ROOT"];
// echo $libDir . "<br>";
// echo $rptDir . "<br>";
// convert in PDF
require_once($libDir.'html2pdf.class.php');
$html2pdf=new HTML2PDF('P','A4','en');
$template = "this is report content ...";
$html2pdf->setModeDebug();
$html2pdf->WriteHTML($template);
// SC returned BLANK screen when execute with following statement
$html2pdf->Output($rptDir.'/'.'my_first_report.pdf','D');'
====================================================================
hit error one "$html2pdf->Output($rptDir.'/'.'my_first_report.pdf','D');'"
how to troubleshoot?
The blank screen might be ok, but it should give you the opportunity to download the pdf. So that’s the strange part as the above code comes from one of our production systems… you might go into the tcpdf docs to see how you can create a physical file to see if it generates the pdf. It might be a rigts issue.
I checked, “reports” directory rights is 755, so should be write-able and yet there is no PDF file generated
My folder structure
There shouldn’t be any problem right?
[QUOTE=weilies;25606]I checked, “reports” directory rights is 755, so should be write-able and yet there is no PDF file generated
My folder structure
There shouldn’t be any problem right?[/QUOTE]
No, if the paths are set correct etc. It simply is working here well as well at our customers. Can’t tell what’s wrong in your instance
is there any useful log i can generate or troubleshoot?
You could try to look into xdebug. Of course you can look into the apache logs to see if there are errors. Try a blank application first to see if you can get it running at all. On the site of pdf2html as well as tcpdf there are a lot of samples.
albert
there is an error_log generated in scriptcase/app/<my project>/<my app>/error_log
This log is meaningful enough to troubleshoot.
I am really sad with the support given from official site… speechless… terrible
Currently i required TCPDF rather than HTML2PDF (which latest update 2011)
could you explain why chinese characters shown correctly in TCPDF example and not in SC?
https://docs.google.com/document/d/15Uw7PZ0_r9V6qQugHR6gjz1qnT6qUL_OEHfE85-2fB4/edit?usp=sharing
weilies
[QUOTE=weilies;25660]there is an error_log generated in scriptcase/app/<my project>/<my app>/error_log
This log is meaningful enough to troubleshoot.
I am really sad with the support given from official site… speechless… terrible
Currently i required TCPDF rather than HTML2PDF (which latest update 2011)
could you explain why chinese characters shown correctly in TCPDF example and not in SC?
https://docs.google.com/document/d/15Uw7PZ0_r9V6qQugHR6gjz1qnT6qUL_OEHfE85-2fB4/edit?usp=sharing
weilies[/QUOTE]
Most likely that has something to do with locale / character settings in SC. You could try to set them before using the library. I’m not sure actually. I live in the ‘easy’ countries where the standard settings apply.
I have no idea what kinda language setting to be set, I am designing my app to show like Chinese, Japanese most Asia pacific languages at least.
Hope senior could give some input if u done that before
marcia is doing a webinar regarding tcpdf. You could ask the question there. She useually has technicials around her to answer difficult questions. As the devs are Portuguese speaking she translates.
Finally i managed to make it work!
http://sc.astudion.com/sc8/app/project/RPT_TCPDF_HTML/
a bit long winded way, i need to write the multi-languages content into a UTF8 text file and use file_get_content to grab it and output via TCPDF
But it worked fortunately!
Please,change your topic tittle and add [solved]
Could be interesting to tell us about the workaround to make it working
Regards
below are my code
// To get rid of error 'PHP Fatal error: Allowed memory size of 134217728 bytes exhausted'
ini_set('memory_limit', '-1');
$libHomeDir = $_SERVER["DOCUMENT_ROOT"] . '/xlibs';
$reportHomeDir = $_SERVER["DOCUMENT_ROOT"] . '/reports';
require_once($libHomeDir . '/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 006');
$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.' 006', 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 font
$pdf->SetFont('dejavusans', '', 10);
$pdf->SetFont('cid0cs', '', 10);
// add a page
$pdf->AddPage();
$html = file_get_contents($libHomeDir . '/tcpdf/examples/data/utf8test2.txt', false);
// output the HTML content
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
// reset pointer to the last page
$pdf->lastPage();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_006.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+