Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

How do I get the X and Y axis of a paragraph?

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.
Sometimes a fail leads to the solution.
This is going to be super fun for you. /s

imagettfbbox or imagefontwidth/imagefontheight.
(Mar 14, 2016 05:56 AM)ASDA Wrote:  This is going to be super fun for you. /s

imagettfbbox or imagefontwidth/imagefontheight.

Did you even bother to read the thread?
Sometimes a fail leads to the solution.
And why something in DOM should be linked to the PHP?
(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.
Sometimes a fail leads to the solution.
(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.
(Mar 14, 2016 05:52 AM)mothh Wrote:  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.

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.
/* No comment */
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?)
(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.
Sometimes a fail leads to the solution.
I am still looking for a way to do this.

I appreciate any help you can give me.
Sometimes a fail leads to the solution.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Javascript]  by Melkor333Jun 23, 2014 12:37 PM 2 94 Jun 23, 2014 12:37 PM
Last Post: Melkor333
[PHP] by camrympsNov 12, 2013 06:01 AM 3 82 Nov 12, 2013 06:01 AM
Last Post: Mafugsa Bob