title: How to open a word doc, enter data & save as PDF in React JS
body: <pre><code>let filename = &quot;document.doc&quot;;
  let downloadLink = document.createElement(&quot;a&quot;);
  downloadLink.href = &quot;data:application/vnd.ms-word;charset=utf-8,&quot; + encodeURIComponent(data);
  downloadLink.download = filename;
  downloadLink.click(); 
  </code></pre>
  <p>Currently we are using above code to create a .doc file with data</p>
  <p>But we want to save this file as .pdf using React JS</p>
  <p>When we replace the filename with <code>filename.pdf</code> it is showing error as</p>
  <pre><code>Failed to load PDF document
  </code></pre>