[Solved] Using TCPDF class for generating PDF custom docs

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

[Solved] Using TCPDF class for generating PDF custom docs

Post by blast2007 »

Hi all,

I'm trying to generate 'on the fly' custom PDF files using TCPDF class included in print module, using an UDT.

The main problem is that I can't generate PDF becase UDT is processed after all page headers (HTML, HEAD, ...) are already sent.

Any hints apart avoid using UDT or creating a custom module?

Regards
blast
Last edited by blast2007 on Fri Jul 04, 2008 9:18 pm, edited 1 time in total.
cyberman

Re: Using TCPDF class for generating PDF custom docs

Post by cyberman »

Have you tried to use a modified PDF template with Printing module?
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: Using TCPDF class for generating PDF custom docs

Post by blast2007 »

cyberman wrote: Have you tried to use a modified PDF template with Printing module?
Hi cyberman, thanks for quick reply.

I have no ideas how to proceed in this direction. Can you me any hints?

My goal is to produce PDF documents generated from a custom mysql table using existing PDF class and UDT / plugin.

Thanks again
blast
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: Using TCPDF class for generating PDF custom docs

Post by blast2007 »

Solved by myself.

Just created an UDT with custom query on db.

This UDT is checked by FEU and CustomContent.

PDF docs are generated by a customized version of createpdf.php (module Printing) called inside my UDT.

If someone wants to know details I will post them.

blast
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: [Solved] Using TCPDF class for generating PDF custom docs

Post by Nullig »

Yes, please post them.

Nullig
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: [Solved] Using TCPDF class for generating PDF custom docs

Post by blast2007 »

Nullig wrote: Yes, please post them.

Nullig
Ok nullig,

I will post it on monday.

Best regards
blast
JeremyBASS

Re: [Solved] Using TCPDF class for generating PDF custom docs

Post by JeremyBASS »

Hey I think This would fix a problem that I’m been having for a while now... I don't know if you'll see this before Monday and would have a sec to post you solution...


Or I also took a whack at it as I need to complete this now, may be you would see why it did work for me...


this is the UDT (with a file out put to uploads and a mail call for phpmailer) called on page*this was for testing* APPzPDFoutput (with a blank template containing only {$content})

***look to file please***

in the PDF template I put

Code: Select all

{if $ccuser->loggedin() && $ccuser->memberof('Applicants')}
{capture assign='junk'}{cms_module module=FrontEndUsers form="changesettings" returnto="Job_Application_Success" }{/capture}
  {$title}
{if $message != ''}
  {if $error != ''}
    <p><font color="red">{$message}</font></p>
  {else}
    <p>{$message}</p>
  {/if}
{/if}
{$startform}
 {if $controlcount > 0}
  <center>
  <table width="75%">
     {foreach from=$controls item=control}
  <tr>
     <td>{$control->hidden}<font color="{$control->color}">{$control->prompt}{$control->marker}</font></td>
     <td>
       {if isset($control->image)}{$control->image}<br/>{/if}
       {$control->control}{$control->addtext}
       {if $control->required != true}
         {if isset($control->control2)}{$control->prompt2} {$control->control2}<br/>{/if}
       {/if}
     </td>
  </tr>
 {/foreach}
  </table>
  </center>
 {/if}
 {$hidden}{$hidden2}{$submit}{$cancel}
{$endform}

    {else}
<h1>{$title}</h1>
{$content}
    {/if}
If I go to the page directly I get for testing...
Fatal error: Call to a member function Properties() on a non-object in /home/content/*/html/Core/lib/content.functions.php(675) : eval()'d code on line 24
but the way I need this to work is to print the form that is being edited on the page ... or after the page is in the sending mode, (I try to put this in the events under the user setting)... any ways.... thanks there for the help... have a great one...
jeremyBass
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

Last edited by JeremyBASS on Sun Jul 06, 2008 4:46 am, edited 1 time in total.
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: [Solved] Using TCPDF class for generating PDF custom docs

Post by blast2007 »

JeremyBASS wrote: Hey I think This would fix a problem that I’m been having for a while now... I don't know if you'll see this before Monday and would have a sec to post you solution...
Hi Jeremy,
I will post tomorrow because the customized file is on my office PC.

Anyway the workflow is this:

Code: Select all

{if $customcontent_memberof_mygroup AND $customcontent_loggedin}
{search_docs}
{/if}
{cms_module module=FrontEndUsers}
Search_docs UDT is a custom query on db where I set also some session variable.

In result page of the same UDT I will generate as detail a new PDF docs (based on the previous db content) by clicking on a link like this: http://www.mysite.com/modules/Printing/ ... ?docn=1000

In createpdf-mod.php I check if user is already loggedin before generate PDF.

That's all.

Tomorrow I can post createpdf-mod.php complete.

Regards
blast

P.S. I know: it's an ugly, unclean method but it works.
JeremyBASS

Re: [Solved] Using TCPDF class for generating PDF custom docs

Post by JeremyBASS »

Thanks, I think I'll wait till you post the working model... I mostly get what you were driving at but I’m not so good with the smarty system... anyways.. can't wait.. thanks
jeremyBass
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: [Solved] Using TCPDF class for generating PDF custom docs

Post by blast2007 »

Here source code of /modules/Printing/createpdf-mod.php

Code: Select all

<?php

$path = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
require $path . DIRECTORY_SEPARATOR . 'include.php';


if ( $_SESSION['logged']=='1' && is_numeric ($_GET["n"]) ) {
$n = mysql_real_escape_string( $_GET["n"] );


$db = &$gCms->db;
$dbtable="custom_MYTABLE";


$sql = "SELECT * FROM " .cms_db_prefix(). $dbtable . " WHERE ID='$n';";


$dbresult = $db->Execute( $sql );
	if (!$dbresult)
	{
	    echo 'DB error: '. $db->ErrorMsg()."<br/>";
	}

$num_rows = $dbresult->numRows();
if ($num_rows >0) {

while ($dbresult && $row = $dbresult->FetchRow()){
	$mydata=$row["myfield"];
	}
}

$_owd = getcwd();
chdir( $config['root_path'] );

$output="";

require_once(dirname(__FILE__).'/tcpdf/tcpdf.php');

$fontname ='freemono';
$headerfontsize = 10;
$contentfontsize = 9;
$orientation = 'P';

$pdfhtml=$mydata;

$pdf = new TCPDF($orientation , PDF_UNIT, PDF_PAGE_FORMAT, true);
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); 
$pdf->setHeaderFont (Array($fontname,'', $headerfontsize));
$pdf->setFooterFont (Array($fontname,'', $headerfontsize));
$pdf->setFont($fontname, '', $contentfontsize );
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->write(1,$pdfhtml);

@ob_clean();
$pdf->Output("filename.pdf","D");
chdir( $_owd );

}
else
   header("Location: http://url_of_login_page");
?>

url_of_login_page is the page of:

Code: Select all

{if $customcontent_memberof_mygroup AND $customcontent_loggedin}
{search_docs}
{/if}
{cms_module module=FrontEndUsers}
If you have any suggestions...give it to me please!

Best regards
blast
Last edited by blast2007 on Mon Jul 07, 2008 8:50 am, edited 1 time in total.
JeremyBASS

Re: [Solved] Using TCPDF class for generating PDF custom docs

Post by JeremyBASS »

Well I have been try out what you were doing, and getting not so far... so I tried something else as well... as a test I put the script that I was working on in the UDT which dose work in the sense that it mails and saves that PDF... then attached it to the Event Handler OnUpdateUser.... So the way I figured it with the test code that works (it has the data that will be passed static in the UDT) I should just run through the action as the event pops off.... right?? so I think I'm doing something not right in the UDT, like I shouldn't just copy a working php script over???  Any help here would be great... once this works then I make the bend of what you did with what I need, where i just print the ChangeSettings form to pdf and save/mail it ... at least that’s the thought... :) thanks for the help

Code: Select all

require("../Core_files/PDFgenerator/tcpdf_php4/class.phpmailer.php");
require_once('../Core_files/PDFgenerator/tcpdf_php4/config/lang/eng.php');
require_once('../Core_files/PDFgenerator/tcpdf_php4/tcpdf.php');
 
function splitData(array $a_Data)
	{
	// We need to track levels so use a static variable.
	static $i_Level = 0;
 
 	// We are in a new level.
	++$i_Level;
 
 	// This levels results start life as an empty array.
	$a_Results = array();
 
 	// Iterate the supplied data to this level.
	foreach($a_Data as $s_Entry)
		{
		// Different levels have different formatting.
		switch($i_Level)
			{
			// Level 1 is {name:value} (even if value is an array).
			case 1 :
				$s_Entry = substr($s_Entry, 1, -1);
				$i_SplitPos = strpos($s_Entry, ':');
				$s_Key = substr($s_Entry, 0, $i_SplitPos);
				$s_Value = substr($s_Entry, 1 + $i_SplitPos);
				break;
			// Level 2 is where value is {name|value},{name|value},{name|value},{name|value}
			case 2 :
				$a_Results[] = splitData(explode(',', $s_Entry));
				break;
			// Level 3 is name|value
			case 3:
				list($s_Key, $s_Value) = explode('|', $s_Entry);
				break;
			}
 
		// If the value starts with a { it needs further refinement so call this function recursively.
		if (isset($s_Value) && (strlen($s_Value) > 0) && ('{' === $s_Value{0}))
			{
			$a_Results[$s_Key] = splitData(preg_split('`(?:}),(?:{)`', substr($s_Value, 1, -1)));
			}
		else
			{
			// Level 2 is not data generating.
			if (2 !== $i_Level)
				{
				// Store the results.
				$a_Results[$s_Key] = $s_Value;
				}
			}
		}
 
 	// We have finished with this level.
	--$i_Level;
 
 	// Return the results for this level.
	return $a_Results;
	}
 
function dataToPDF($PDF, array $a_Data, array $a_Keys = array())
	{
	// We need to track levels so use a static variable.
	static $i_Level = 0;
 
 	// We are in a new level.
	++$i_Level;
 
	// Iterate the supplied data array.
	foreach($a_Data as $s_Key => $m_Values)
		{
		// If the data is an array then call this function recursively.
		if (is_array($m_Values))
			{
			// Store the current key at the current level.
			$a_Keys[$i_Level] = $s_Key;
 
			// Call this function recursively with the PDF object we received,
			// the array of values and the accumulated keys.
			dataToPDF($PDF, $m_Values, $a_Keys);
			}
		else
			{
			// Remove any accumulated keys for this level
			unset($a_Keys[$i_Level]);
 
			// Generate a parameter array containing any supplied keys,
			// the current key and the current value.
			$a_Params = $a_Keys;
			$a_Params[] = $s_Key;
			$a_Params[] = $m_Values;
 
			// Call the PDF object to add a MultiRow with the array of parameters.
			call_user_func_array(array($PDF, 'MultiRow'), $a_Params);
			
			}
		}
 
 	// We have finished with this level.
	--$i_Level;
	}
 
// Prepare the data.
// This would normally come in from your flash.
$_POST["dataArray"] = '{name:value},{Applacation Date:Mon Jun 23 17:36:26 GMT-0700 2008},{emps_grd:{row|0,employer|asdfasdf,address|asdfasdf,phone|asdf,supervisor|asdf,contact|false,wage|,duties|,from|Mon Jun 2 00:00:00 GMT-0700 2008,to|,reason|},{row|1,employer|new Employee,address|asdfasdf,phone|,supervisor|asdfadf,contact|false,wage|asdfasdf,duties|,from|Tue Jun 3 00:00:00 GMT-0700 2008,to|Thu Jun 19 00:00:00 GMT-0700 2008,reason|}},{jobs_picks:{Job_Pick`0|CNA - MEDICAL UNIT},{Job_Pick`1|Unit Secretary / CNA Mental Health Center},{Job_Pick`2|CREDIT COUNSELOR},{Job_Pick`3|UNIT SECRETARY - ICU/PCU},{Job_Pick`4|CNA - SURGICAL UNIT},{Job_Pick`5|CNA - SURGICAL UNIT}},{name_title:Mr},{urstate:Choose},{primphonetype:Choose},{altphonetype:Choose},{emerg_contype:Choose},{days:3rd},{evenings:1st},{nights:2nd},{high_school_from:Mon Jun 9 00:00:00 GMT-0700 2008},{high_school_to:Tue Jun 17 00:00:00 GMT-0700 2008},{high_school_when:undefined},{prev_emplofrom:undefined},{prev_emploto:undefined},{skill_medterm_date:undefined},{college_from:undefined},{college_to:undefined},{college_when:undefined},{college2_from:Tue Jun 10 00:00:00 GMT-0700 2008},{college2_to:Tue Jun 17 00:00:00 GMT-0700 2008},{college2_when:Thu Jun 19 00:00:00 GMT-0700 2008},{college3_from:undefined},{college3_to:undefined},{college3_when:undefined},{college4_from:undefined},{college4_to:undefined},{college4_when:undefined},{current_ed_completdate:undefined},{license_xdate:undefined},{license2_xdate:undefined},{em_data_rec_brith:undefined},{lastname:Dude},{firstname:Man},{middlename:Hit},{suffix:sr},{ssn:5946565632},{street:},{city:},{zip:},{primphone:},{altphone:},{email:},{emerg_con:},{emerg_connumber:},{learnabout_job_othertxt:},{relative_name:},{relative_rela:},{undefined:undefined},{undefined:undefined},{undefined:undefined},{undefined:undefined},{high_school_name:},{high_school_loca:},{college_name:},{college_loca:},{college2_name:},{college2_loca:},{college3_name:},{college3_loca:},{college4_name:},{college4_loca:},{college_major:},{college2_major:},{college3_major:},{college4_major:},{current_ed_name:},{current_ed_loca:},{current_ed_study:},{license_type:},{license_number:},{license_state:},{license2_type:},{license2_number:},{license2_state:},{skill_typn_wpm:},{skill_medterm_school:},{skill_monitors_type:},{leg_othername_1:},{leg_othername_2:},{leg_othername_3:},{leg_othername_4:},{leg_able_work_note:},{leg_convic_note:},{undefined:undefined},{undefined:undefined},{em_data_rec_notes:},{digitalsign:},{full_time:yes},{part_time:Yes},{temp:},{on_call:Yes},{avaiable_mon:},{avaiable_tus:},{avaiable_wed:Yes},{avaiable_thru:Yes},{avaiable_fri:},{avaiable_sat:},{avaiable_sun:Yes},{ssnoptout:},{learnabout_job_ad:},{learnabout_job_friend:},{learnabout_job_other:},{skill_typn:},{skill_dataentry:},{skill_medterm:},{skill_medtrans:Yes},{skill_accounting:Yes},{skill_insure_bill:Yes},{skill_credit_collect:Yes},{skill_switchborad:},{skill_cashier:},{skill_10key:Yes},{skill_invoicing:},{skill_reception:Yes},{skill_floorcare_man:},{skill_floorcare_mac:},{skill_dishman:},{skill_dishindus:},{skill_linen:},{skill_sterilizer:},{skill_autoclave:},{skill_sewing:},{skill_maintengen:},{skill_maintencraft:},{skill_maintencraft_el:Yes},{skill_maintencraft_pl:Yes},{skill_maintencraft_co:Yes},{skill_maintencraft_pt:Yes},{skill_steriletechique:},{skill_vitalsigns:},{skill_charting:},{skill_pre_opprep:},{skill_isolation:},{skill_cateterization:},{skill_coronarycare:},{skill_intensive:},{skill_monitors:},{skill_orthopedic:},{skill_pediatic:},{skill_obstertrics:},{skill_medical:},{skill_surgical:},{skill_geriatric:},{skill_oncology:},{skill_family_homecare:},{em_data_rec_w:},{em_data_rec_b:},{em_data_rec_h:},{em_data_rec_a:},{em_data_rec_a_i:},{em_data_rec_v:},{em_data_rec_d:},{em_data_rec_di:},{appstate_cb:},{drugtest:},{digital_agree:},{Em_HIS_Con_Y:Yes},{rotate_shifts_N:No},{weekends_Y:Yes},{relativeemplo_N:},{high_school_did_atend_N:No},{college_did_atend_Y:Yes},{college2_did_atend_Y:Yes},{college3_did_atend_N:},{college4_did_atend_N:},{current_ed_N:},{licensed_N:},{app4license_N:},{leg_othername_N:},{leg_able_work_N:},{leg_visa_N:},{em_data_rec_sex_M:},{leg_convic_N:},{_18_N:},{prev_emplo_N:}';
 
// Convert the long string into an array.
preg_match_all( '`({[^{},]*?:{.*?}}|{[^{},]*?:.*?})`sim', $_POST['dataArray'], $a_Matches);
 
// Convert the simple array into a nested array.
$a_Data = splitData($a_Matches[1]);

// Remove any log file.
@unlink('./debug.log');
 
// DEBUG : Uncomment the next line to create a debug log file.
file_put_contents('./debug.log', var_export($a_Data, True) . PHP_EOL, FILE_APPEND);
 
// extend TCPF with custom functions
class MYPDF extends TCPDF {
 
function MultiRow($left, $right) {
		//MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0)
		
		$a_Params = func_get_args();
		// DEBUG : Uncomment the next line to create a debug log file.
		//file_put_contents('./debug.log', implode(' | ', $a_Params) . PHP_EOL, FILE_APPEND);
		
		$page_start = $this->getPage();
		$y_start = $this->GetY();
		
		// write the left cell
		$this->MultiCell(40, 0, $left, 1, 'R', 0, 2, 0 ,0, true, 0);
		
		$page_end_1 = $this->getPage();
		$y_end_1 = $this->GetY();
		
		$this->setPage($page_start);
		
		// write the right cell
		$this->MultiCell(0, 0, $right, 1, 'J', 0, 1, $this->GetX() ,$y_start, true, 0);
		
		$page_end_2 = $this->getPage();
		$y_end_2 = $this->GetY();
		
		// set the new row position by case
		if (max($page_end_1,$page_end_2) == $page_start) {
			$ynew = max($y_end_1, $y_end_2);
		} elseif ($page_end_1 == $page_end_2) {
			$ynew = max($y_end_1, $y_end_2);
		} elseif ($page_end_1 > $page_end_2) {
			$ynew = $y_end_1;
		} else {
			$ynew = $y_end_2;
		}
		
		$this->setPage(max($page_end_1,$page_end_2));
		$this->SetXY($this->GetX(),$ynew);
		$htmlcontent = $a_Params; 
		$this->writeHTML($htmlcontent, true, 0, true, 0);
	}
}
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true); 
$pdf->SetProtection(array('print')); 
 
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor("Nicola Asuni");
$pdf->SetTitle("TCPDF Example 011");
$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, 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 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); 
 
//initialize document
$pdf->AliasNbPages();
 
// add a page
$pdf->AddPage();
 
// ---------------------------------------------------------
 
// set font
$pdf->SetFont("vera", "", 12);
 
//Column titles
$header=array('something','Capital');
 
dataToPDF($pdf, $a_Data);
//dataToPDF($htmlcontent, $a_Data);


// set font 
$pdf->SetFont("dejavusans", "", 9); 
 
// create some HTML content 
//$htmlcontent = $a_Data; 
 
// output the HTML content 
//$pdf->writeHTML($htmlcontent, true, 0, true, 0); 
 
// reset pointer to the last page 
$pdf->lastPage(); 

////////////////////////////////
/////////EMAIL AREA
//////////////////////////////
// create your pdf file. maybe give it a unique filename.
$filename = "example_011.pdf";
// use for Upload folder >>>>>>>>>>>>>>>>>
$pdf->Output("/home/content/*/html/Core/uploads/apps/" . $filename,"F"); 
$pdf->Output($filename, "F");  
$mail = new PHPMailer();
$mail->MsgHTML($body);
$mail->AddAddress("dbjeremy@cableone.net", "John Doe");
$mail->From     = "*@sjrmc.org";
$mail->FromName = 'SJRMC  Personnel Department';
$mail->Subject  =  'Employment Application CC';
$mail->Body     =  'Thank you for submiting your application. REPLACE TEXT';
 
if(!$mail->AddAttachment("example_011.pdf"))	{
    echo "There was a problem attaching the pdf.";
    echo $mailer->ErrorInfo;
}
$dataResponse_1 = "passed";
if(!$mail->Send()) {
	print("&response=error");
} else {
	print("&response=passed");
}
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: [Solved] Using TCPDF class for generating PDF custom docs

Post by blast2007 »

Hi Jeremy,
nice solutions!

But I think we have different needs. I need to create docs (like invoice) fetching data from a custom db table.

The code I post above is a working script that I'm currently using.

What I haven't post is code of {search_docs} because I think not pertaining to this topic.

Anyway {search_docs} generate, after a parametric search on db, a list of link, something like:

Download PDF invoice # 1
Download PDF invoice # 3
Download PDF invoice # 6
Download  PDF invoice # 12

And createpdf-mod.php does the creation of document.

Hope it helps.

Best regards
blast
JeremyBASS

Re: [Solved] Using TCPDF class for generating PDF custom docs

Post by JeremyBASS »

Damn... I get what you were doing.... well I still need to get mine going and your right they are a little off... instead of printing link I need to have the changeSetting form printed to PDF and mailed after the form has submitted and the data saved to the db... would you have any ideas on that may-be... or do you think I should make a new post?


********************************************
***here is the new post in case your interested*******
http://forum.cmsmadesimple.org/index.ph ... 568.0.html
Last edited by JeremyBASS on Tue Jul 08, 2008 4:09 am, edited 1 time in total.
surfandfun
New Member
New Member
Posts: 4
Joined: Mon Aug 04, 2008 4:38 pm

Re: [Solved] Using TCPDF class for generating PDF custom docs

Post by surfandfun »

Hi Everybody,

I am very new here.
I have a problem with tcpdf.

ı try to clip an image

$pdf->StartTransform();
$pdf->StarPolygon(50, 70, 30, 4, 1, 0, 0, "CNZ");
$pdf->Image('images/wo_20_190_0.jpg', 0,0, 200, 200, '', '', '', true, 72);
$pdf->StopTransform();

functions

but

$pdf->StartTransform();
$pdf->rect(0, 0, 50, 50, "CNZ");
$pdf->Image('images/wo_20_190_0.jpg', 0,0, 200, 200, '', '', '', true, 72);
$pdf->StopTransform();

does not.

I also tried

$pdf->Clip(0,0,50,50);

with no success.

can somebody help me?

1000 thanks
JeremyBASS

Re: [Solved] Using TCPDF class for generating PDF custom docs

Post by JeremyBASS »

tcpdf Has a forum that may be better suited for your question here...
jeremyBass
Locked

Return to “Tips and Tricks”