title: Edit text in PDF with python
body: <p>I have a <em>pdf</em> file and I need to edit some text/values in the <em>pdf</em>. For example, In the <em>pdf</em> files that I have <code>BIRTHDAY DD/MM/YYYY</code> is always <code>N/A</code>. I want to change it to whatever value I desire and then save it as a new document. Overwriting existing document is also alright.</p>
  <p>I have previously done this so far:</p>
  <pre class="lang-py prettyprint-override"><code>from PyPDF2 import PdfReader, PdfWriter
  
  reader = PdfReader(&quot;abc.pdf&quot;)
  page = reader.pages[0]
  
  writer = PdfWriter()
  writer.add_page(reader.pages[0])
  pdf_doc = writer.update_page_form_field_values(
      reader.pages[0], {&quot;BIRTHDAY DD/MM/YYYY&quot;: &quot;123&quot;}
  )
  with open(&quot;new_abc1.pdf&quot;, &quot;wb&quot;) as fh:
      writer.write(fh)
  </code></pre>
  <p>But this <code>update_page_form_field_values()</code> doesn't change the desired value, maybe because this is not a form field?</p>
  <p>Screenshot of <em>pdf</em> showing the value to be changed:</p>
  <p><img src="https://i.stack.imgur.com/bU8nu.png" alt="screenshot_image" /></p>
  <p>Any clues?</p>