It is possible to override a calculated result. I'm reluctant, though, to post a suggestion for a revised code since things like drug dosing is serious business and it requires a thorough analysis and high quality design. The code should rigorously validate the inputs, intermediate results, and the final output, and may need to conform to certain standards. It then has to be thoroughly tested. Sorry I can't provide more help.
George is right. You should hire a professional to do this, and might want to consider not using a PDF at all. It can be too easily messed with.
Just as a side note, I know of a person who was involved in the development of an application for a pharmacy chain, and he told me that as a result of a bug in the code a patient died of an overdose. So you can't be too careful with things like that.
Thanks for the responses, I appreciate the honest feedback. I can agree to a point, but would never put patients at risk. Patients dying or patient harm is due to human error, not computer error. If a system allows for the complicated drug admixture to be given to a patient without human checking of the final product that is dangerous and illegal.
Currently orders in most small/medium systems are written by hand and calculated using a hand calculator and/or web based links that are just as risky. Both are prone to significant errors, but that is why there are double and triple human checks. The purpose of using adobe or programs similar to it is not to take away the human checking and safety component, but to speed up and standardize the ordering process. There are 5 or so different ways to calculate renal function for dosing with links and calculators online, but to have a system standard is much safer to patients as one example.
A webservice is much safer in the sense that the calculation is localized in a single, controllable place.
I can easily take your PDF, change the calculations in it and distribute it further to others. I can't do the same with a webservice that provides an answer based on the user's input.
Of course, there are ways of certifying and securing a document, and you might want to look into those if you continue using PDF files for this purpose.
Thanks try for the feedback. It was more of a research project if it could be done. If it can't or isn't secure, no problem.
It is entirely possible to include enough controls over the input and results to make this work.
Now the question is, is this the right tool for this task?
No it is not. There are not enough controls over the code and its modification for this type of application. Think about the type of medications your are dispensing, it is not sprain.
The only control over the code appears to be the ignorance of the user. And I would not even consider that a control of any kind.