changed values not showing after PDF conversion with wkhtmltopdf

Currently inside my html page I change some values, the way it works is like this:

The function:

function change1(){
   var myNewTitle = document.getElementById('myTextField1').value;
   if( myNewTitle.length==0 ){
       alert('Write Some real Text please.');
   return;
   }
   var titles = document.getElementsByClassName('title1');
   Array.prototype.forEach.call(titles,title => {
    title.innerHTML = myNewTitle;
   });
}

The values that get changed and the textfield used for input:

      Voornaam: <h3 class="title1">Kevin</h3>
      <input type="text" id="myTextField1"/>
      <input type="submit" id="byBtn" value="Change" onclick="change1()"/><br/>

      <p class="title1">Test.</p>

And I convert using wkhtmltopdf, which is a command line tool for html to PDF conversion. However the changes I make are ofcourse not done on the server but locally, and this is why my changes do not show in my conversion.

I was thinking about downloading the changed html page first and then convert it with wkhtmltopdf.
Would anybody be able to give me an example of how this could be done or perhaps some me another and better way?


Source: stackoverflow-php