Copy link to clipboard
Copied
Hi! I am trying to pull form data from a PDF document and place it in an email using app.mailMsg - I have a button placed on the page where the data will come from with a mouseup trigger. I've cleaned up the data and email structure that I want to use a few times so I'm not sure if there is an error in my code/syntax (I'll paste below) or it is something that I am completely oblivious to. Any help is greatly appreciated! Thank you!
var cMyMsg = "DOEE Notification\n\n"
cMyMsg += "Client Name: " + this.getField("custName").value + "\n";
cMyMsg += "Date Inspected: " + this.getField("inspectionDate").value + "\n";
cMyMsg += "Address: \n";
cMyMsg += "Structure Type: " + this.getField("structureType").value + "\n";
cMyMsg += "Year Built: " + this.getField("yearBuilt").value + "\n";
cMyMsg += "Owner: " + this.getField("buildingOwner").value + "\n";
cMyMsg += "Building Structure Consists of:\n";
cMyMsg += " *Framing: " + this.getField("typeStudFraming").value + "\n";
cMyMsg += " *Walls: " + this.getField("typeWalls").value + "\n";
cMyMsg += " *Floors: " + this.getField("typeFloors").value + "\n";
cMyMsg += " *Ceiling Height: " + this.getField("maxCeiling").value + "\n";
cMyMsg += "Approx Amt of Visible Mold: ≈" + this.getField("amountMold").value + "\n";
cMyMsg += "Lead and/or Asbestos Testing:\n";
cMyMsg += " *Lead: " + this.getField("testLead").value + "\n";
cMyMsg += " *Asbestos: " + this.getField("testAsbestos").value + "\n";
cMyMsg += "Love,\n";
cMyMsg += "Name Here\n";
cMyMsg += "Director of Production & 3rd Degree White Belt\n"
cMyMsg += "DOEE License: 867-5309\n";
app.mailMsg({
bUI: true,
cTo: "email@gmail.com",
cSubject: "DOEE Info",
cMsg: cMyMsg
});
That suggests there was some kind of character corruption that caused it. My guess would be on the "≈" symbol...
Copy link to clipboard
Copied
The code seems fine. You never really explained what's the issue with it... Is there an error message? If so, what does it say?
Copy link to clipboard
Copied
Sorry - I'm not getting an error message from the document or within Acrobat DC. I am testing it out on an iPad (iOS 12) using PDF Expert - and within PDF Expert the button shows that I am pressing down on it, but the email window does not come up at all.
I can send/attach the file if that will help in anyway.
I also checked the overall email size and it is well under the 67k byte limit.
Copy link to clipboard
Copied
Does the email window appear correctly when you test it with Adobe products (those that support it, of course, not Reader)?
Copy link to clipboard
Copied
I found an older document where I use mailMsg and it works fine. I also just checked Readdle's PDF Expert supported methods and mailMsg is fully supported. The email that is produced in the older file is also slightly larger than the expected email produced from this current code.
Copy link to clipboard
Copied
I can't explain what exactly fixed this - I figured I would just retype everything over again into the custom script box within Acrobat DC instead of writing the code in Atom and copying/pasting into Acrobat DC. Doing that made the code work.
Copy link to clipboard
Copied
That suggests there was some kind of character corruption that caused it. My guess would be on the "≈" symbol...
Copy link to clipboard
Copied
That's a good call. I did leave it out when I re-typed it. I will add it to the working code shortly and see what it does. Thanks for helping!
Copy link to clipboard
Copied
Glad you've fixed it. I hate when retyping makes my coding problems go away!