• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
Aug 06, 2020 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

Views

536

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
community guidelines
Community Expert ,
Aug 06, 2020 Aug 06, 2020

Copy link to clipboard

Copied

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

Votes

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
community guidelines
New Here ,
Aug 06, 2020 Aug 06, 2020

Copy link to clipboard

Copied

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

Votes

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
community guidelines
Community Expert ,
Aug 06, 2020 Aug 06, 2020

Copy link to clipboard

Copied

May be not possible.

Votes

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
community guidelines
Community Expert ,
Aug 06, 2020 Aug 06, 2020

Copy link to clipboard

Copied

LATEST

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.

Votes

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
community guidelines