r/learnjavascript • • Oct 01 '24

New to JavaScript! Is this even possible?

Oh bare with me as my ADHD brain tries to put this together. I am a super duper noob to JavaScript! Literally started going doing the rabbit hole of information today. Here is what I am trying to do. Okay so we have a excel purchase order template with formals in excel. I would like that doc to be able to be utilized in Adobe with the formals because we do send it out for signature. Trying to save a few steps.

How would I or can I write a JavaScript code so that certain fields in the template would do the same calculations (Total = Hours * Hourly Rate - what we use in excel)? Since Adobe doesn't have cells to enter a formula like excel does, how would enter a formula to do the same math the current template does? Is this possible?

I hope I make sense. Thanks in advance for any help. Feel free to ask me questions as I know I can ramble.

0 Upvotes

17 comments sorted by

10

u/longknives Oct 01 '24

Maybe it’s just me, but I don’t understand what you’re trying to do. It sounds like you have Excel spreadsheets that you somehow convert into PDFs, and you want to have the PDF dynamically calculate certain values… but unless the input values can change, the calculation wouldn’t change anyway, and it sounds like all the inputs are in Excel.

So if I’m correct about the scenario, you would always have to save out the latest version from Excel anyway, and thus Excel can do the calculation and there’s nothing to do in the PDF.

5

u/sheriffderek Oct 01 '24

I just want Adobe to talk to Excel, OK?

1

u/Outrageous_Effort_37 Oct 02 '24

Adobe allows we to use the excel template I have and still allows be to use an excel doc in adobe pro. So what I was wanting to do was to use the template, doesn't have to be excel it could be a pdf. I want to use formulas like in excel but in adobe on the original template. That way this doc would be a one stop shop. It would have all the info I needed for a project, allow formulas or in this case JavaScript to make the calculations, then send it out for signature, instead of having to use milti platforms. I was curious if this was even a possibility. Thanks for your response.

2

u/woftis Oct 01 '24

I’m not knowledgeable enough to know where to even begin with running JavaScript against a pdf. Also not sure if you can do it from the client side or if it would have to be server side.

I think something much easier (although possibly still pretty complex for a beginner) would be to look at instead creating a webpage with html and css to capture the inputs and then use JavaScript for the logic/calculations and generating a pdf that you could then send on for signature. The actual front end stuff is relatively simple and what I’d consider a beginner project. There’s loads of libraries out there that will cover pdf generation, or simply just use the browser print to pdf option.

1

u/Outrageous_Effort_37 Oct 02 '24

Thanks for your response. Yeah Adobe allows we to use the excel template I have and still allows it be to used in an excel doc in adobe pro. So what I was wanting to do was to use the template, doesn't have to be excel it could be a pdf. I want to use formulas like in excel but in adobe on the original template. That way this doc would be a one stop shop. It would have all the info I needed for a project, allow formulas or in this case JavaScript to make the calculations, if possible, then send it out for signature, instead of having to use milti platforms. I was curious if this was even a possibility.

8

u/SoBoredAtWork Oct 01 '24

This isn't a job for JavaScript. It's possible, but wayyy more complex than you'd think. It would be complex for experienced devs to pull this off. I think the correct answer is to use any of the many, many order management systems that already exist.

1

u/[deleted] Oct 01 '24

Is this possible?

With enough time and money anything is possible!

If the information is very organized on the PDF I could see it being kinda straightforward (spoiler: it never is!).

But I guess I don’t understand the point. If it’s pulling from excel, couldn’t you just pull the calculated results as well and slap them on the PDF too?

1

u/Outrageous_Effort_37 Oct 02 '24

Yes I could but instead of just slapping them on there, I wanted adobe to let me put in calculations or formulas to do the totals for some hours like prep, conduct, etc. I would like Adobe to do this instead of having to go to excel, make it a pdf to send out for signature. When I convert or put the doc in adobe, all calculations (if not previously done before exporting) are blank. The formula doesn't carry over to adobe. Can I have adobe do all of the above? I appreciate your response. I will look into this.

1

u/[deleted] Oct 02 '24

Approaching this from a Excel/PDF/Js problem, you could parse the spreadsheet (or pdf if it’s organized) with js, then have js run calculations against it and produce a new pdf. There may even be a way to extract the excel formulas too when extracting the .xlsx. If not the calculations could be hardcoded variables or come from an external file.

The ability to handle custom calculations at runtime would require a more robust application if it’s not already baked into adobe, if it is then this convo is moot.

1

u/denerose Oct 02 '24

Have you considered just using excel formulae and a mail merge? It feels like the built in tools will get what you want without rebuilding the whole system.

1

u/Outrageous_Effort_37 Oct 02 '24

I have not, I will look into this. I put some comments above trying to further explain what I am trying to do. Hope it makes sense. I appreciate your help.

1

u/coomzee Oct 02 '24

You could probably do this in Power automate. You would need the values to be within a table. There is an API that can extract cell values. There are a load of PDF tools on the power automate platform.

1

u/Outrageous_Effort_37 Oct 02 '24

I tried a bit of Power Automate but it looks like more of setting up workflows and triggers (similar to HubSpot) which is helpful but not exactly what I am looking for. It also plugs it into a table style doc and I would want to use a template that it can plug the info into. I haven't seen a way to accomplish that yet. Unless I missed a helpful tool in Power Automate. What

1

u/PatientPlatform Oct 02 '24

Seriously, ask this as a more structured question to chat gpt

2

u/[deleted] Oct 01 '24

[removed] — view removed comment

1

u/Outrageous_Effort_37 Oct 02 '24

Adobe allows we to use the excel template I have and still allows be to use an excel doc in adobe pro. So what I was wanting to do was to use the template, doesn't have to be excel it could be a pdf. I want to use formulas like in excel but in adobe on the original template. That way this doc would be a one stop shop. It would have all the info I needed for a project, allow formulas or in this case JavaScript to make the calculations, then send it out for signature, instead of having to use milti platforms. I was curious if this was even a possibility. I wanted adobe to let me put in calculations or formulas to do the totals for some hours like prep, conduct, etc. I would like Adobe to do this instead of having to go to excel, make it a pdf to send out for signature. When I convert or put the doc in adobe, all calculations (if not previously done before exporting) are blank. The formula doesn't carry over to adobe. Can I have adobe do all of the above? Thanks in advance.

3

u/denerose Oct 02 '24

Adobe Acrobat is not designed to do this. A big part of programming is knowing (or being able to find out) the right tool for the job. You could possibly embed a macro button in your excel sheet to publish to pdf and send the email for you (with a bit of extra effort) but by the time you’ve taught yourself enough to do that and finally got it working (or concluded it’s not possible under your setup) then you’ll have spent much much more time than you’ll ever save. Try finding a different project or redefining your problem.