note 20578 added to function.cpdf-text

From: Date: Mon, 08 Apr 2002 22:01:44 +0000
Subject: note 20578 added to function.cpdf-text
Groups: php.notes 
Request: Send a blank email to php-notes+get-28980@lists.php.net to get a copy of this message
XeROfun's Patch is somewhat cool, but it is missing a small but exiting part oft this function: the return value ! If the textbox ist too small to to hold all text, it returns the position within the text where displaying stopped (originally char*). In a bunch, this enables you to render text over multiple pages without calculating the page break. Apply XeROfun's patch above and add the line after this codepiece in cpdf.c: -------------------- [XeROfun] pval *argv[11]; int id, type, argc, mode=0; CPDFdoc *pdf; CPDFtboxAttr tbattr; [/XeROfun] char *ret=NULL; -------------------- Some lines down at the end, you'll find: -------------------- [XeROfun] RETURN_TRUE; [/XeROfun] -------------------- Replace that line by: -------------------- RETURN_LONG((ret-argv[7]->value.str.val>0) ? ret-argv[7]->value.str.val : 0); -------------------- Now recompile PHP. After this, cpdf_textbox will return the number of displayed characters or 0 if all text was rendered. Another tip: missing last word of the text ? ==> append a space (" ") to the end of the text. -- http://www.php.net/manual/en/function.cpdf-text.php http://master.php.net/manage/user-notes.php?action=edit+20578 http://master.php.net/manage/user-notes.php?action=delete+20578 http://master.php.net/manage/user-notes.php?action=reject+20578

« previous php.notes (#28980) next »