note 20578 deleted from function.cpdf-text by vincent

From: Date: Mon, 25 Aug 2003 15:50:08 +0000
Subject: note 20578 deleted from function.cpdf-text by vincent
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-55042@lists.php.net to get a copy of this message
Note Submitter: php@michael-plate.net ---- 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.

« previous php.notes (#55042) next »