Highlighted

How to draw rectangular position with mouse drag in PDF using javascript?

New Here ,
Aug 06, 2020

Copy link to clipboard

Copied

I want to get rectangular position with height & width on the mouse drag. 

Can I make below code more dynamic? For example, eRect value should be come from mouse drag and it position should not be hardcoded.   

 

var inch = 72;
var aRect = doc.getPageBox({ nPage: currentPage });
aRect[0] += 0.5 * inch; // from upper left hand corner of page.
aRect[2] = aRect[0] + 2 * inch; // Make it 2 inch wide
aRect[1] -= 0.5 * inch;
aRect[3] = aRect[1] - 0.5 * inch; // and 0.5 inch high
sigField = doc.addField("signature1", "signature", currentPage, aRect);

 

  

TOPICS
Acrobat SDK and JavaScript, Create PDFs, Edit and convert PDFs, General troubleshooting, How to, PDF forms, Security digital signatures and esignatures

Views

46

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to draw rectangular position with mouse drag in PDF using javascript?

New Here ,
Aug 06, 2020

Copy link to clipboard

Copied

I want to get rectangular position with height & width on the mouse drag. 

Can I make below code more dynamic? For example, eRect value should be come from mouse drag and it position should not be hardcoded.   

 

var inch = 72;
var aRect = doc.getPageBox({ nPage: currentPage });
aRect[0] += 0.5 * inch; // from upper left hand corner of page.
aRect[2] = aRect[0] + 2 * inch; // Make it 2 inch wide
aRect[1] -= 0.5 * inch;
aRect[3] = aRect[1] - 0.5 * inch; // and 0.5 inch high
sigField = doc.addField("signature1", "signature", currentPage, aRect);

 

  

TOPICS
Acrobat SDK and JavaScript, Create PDFs, Edit and convert PDFs, General troubleshooting, How to, PDF forms, Security digital signatures and esignatures

Views

47

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 06, 2020 0
Adobe Community Professional ,
Aug 06, 2020

Copy link to clipboard

Copied

Use Tools > Prepare Form and add the signature field with the mouse.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 06, 2020 0
New Here ,
Aug 06, 2020

Copy link to clipboard

Copied

My requirement is to place the new control based on mouse drag using javascript. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 06, 2020 0
Adobe Community Professional ,
Aug 06, 2020

Copy link to clipboard

Copied

May be not possible.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 06, 2020 0
try67 LATEST
Most Valuable Participant ,
Aug 06, 2020

Copy link to clipboard

Copied

No, it's not possible. The closest you can get to it is to use the mouse to mark the two opposite corners of the box (by clicking them) and then draw it. I've developed similar tools in the past so if you're interested I could help you set it up, for a fee.

You can contact me privately via [try6767 at gmail.com] to discuss it further.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 06, 2020 0