![]() |
|
[PHP] How do I get the X and Y axis of a paragraph? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183) +---- Thread: [PHP] How do I get the X and Y axis of a paragraph? (/showthread.php?tid=5202959) |
How do I get the X and Y axis of a paragraph? - mothh - Mar 14, 2016 I tried using the `.position` function from jQuery, but that doesn't work. I have a HTML page which gets converted to a PDF document, on that document is a paragraph and a string inside. I want to know how I can get the location in pixels of that string, but the `.position` function does not work for a PDF file, therefor it has to happen with PHP I think. * - ASDA - Mar 14, 2016 This is going to be super fun for you. /s imagettfbbox or imagefontwidth/imagefontheight. * - mothh - Mar 14, 2016 (Mar 14, 2016 05:56 AM)ASDA Wrote: This is going to be super fun for you. /s Did you even bother to read the thread? * - Sakuto - Mar 14, 2016 And why something in DOM should be linked to the PHP? * - mothh - Mar 14, 2016 (Mar 14, 2016 09:27 AM)Sakuto Wrote: And why something in DOM should be linked to the PHP? I have tried it with jQuery already, but you can't get data from jQuery from a PDF file. * - ASDA - Mar 14, 2016 (Mar 14, 2016 09:23 AM)mothh Wrote: Did you even bother to read the thread? how about you don't be a cunt. yes i did. the only way you're going to do this is figure out the width and height of your text. yano, unless you decide to use phantomjs or something. you don't have a DOM server side. * - Quad - Mar 14, 2016 (Mar 14, 2016 05:52 AM)mothh Wrote: I tried using the `.position` function from jQuery, but that doesn't work. offsetTop and offsetLeft. document.getElementById('paragraph').offsetTop; Oops, misread your post. Not sure how you would go about reading a PDF file programatically. You're probably better off doing all the positioning before you create the PDF. * - Sakuto - Mar 14, 2016 There is no way to do what you want in PHP, just properly define yout HTML before converting it into a PDF, or use a better way to do it (template?) * - mothh - Mar 14, 2016 (Mar 14, 2016 10:08 AM)Sakuto Wrote: There is no way to do what you want in PHP, just properly define yout HTML before converting it into a PDF, or use a better way to do it (template?) I can't, I am using PDFMaker which is a PDF template maker for vtiger CRM, so I have to work with that. I can't edit the code of the module, I can only add custom function. I will explain the problem a bit more in depth: People need to be able to sign a document digitally, this is possible with Docusign, but in order to get that to work I need the X and Y axis of where the signature is supposed to go. * - mothh - Mar 16, 2016 I am still looking for a way to do this. I appreciate any help you can give me. |