title: How do I dynamically give a value to an existing barcode created in acrobat
body: <p>How do I dynamically give a value to an existing barcode created in acrobat.</p>
  
  <p>I created the bar code in a pdf form by following <a href="https://helpx.adobe.com/acrobat/using/pdf-barcode-form-fields.html" rel="nofollow noreferrer">this</a> guide.</p>
  
  <p>When I type something into the form fields , the bar code does get updated with the values. However the catch is , the pdf is dynamically generated through ruby code, and the form is prefilled. However the barcode doesn't include the data dynamicallly filled into the pdf form. If I make any change in the pdf form data , the bar code is reloaded and now includes the entire form data , but this doesn't happen when the generated pdf is opened for the first time.</p>
  
  <p>To summarize.</p>
  
  <p>1) Added barcode to a pdf form and added javascript to calcuate bar code value.</p>
  
  <p>2) Bar code gets updated with newly calcuated value as form data is changed.</p>
  
  <p>3) Dynamically filled the pdf form created in step 1. All form fields are filled , but bar code doesn't include the data.</p>
  
  <p>4) If I make a change to data in pdf created in 3 , the bar code gets redrawn with all the data filled on the server and also includes the data change I just made.</p>
  
  <p>The problem is in step 3 , when the pdf form is filled with data on the server , I am expecting the bar code to include the data. </p>
  
  <p>P.S , I have used <a href="https://github.com/jkraemer/pdf-forms" rel="nofollow noreferrer">pdf-forms</a> to fill out pdf on server. I have also tried itext java api to fill out the form.
  In addition,  with both pdf-forms and itext , I have tried to provide an initial value for the bar code. However if I do this , the barcode doesn't even show in the generated pdf and instead the provided values show.</p>
  
  <p>P.S 2nd. I have also been able to generate a bar code image using itext. However I need this bar code to be updated as the user changes form data in the generated pdf. Obviously the image doesn't update. and hence I tried the above approch of using a script in the pdf to calcuate barcode value on the fly.</p>