 <p>I managed to fix this using <code>FormData()</code>, here's how I did it:</p> <pre><code>$(document).on("click", "#PDF", function () { var table = document.getElementById("result"); var cols = [], data = []; function html() { var doc = new jsPDF('p', 'pt'); var res = doc.autoTableHtmlToJson(table, true); doc.autoTable(res.columns, res.data); var pdf =doc.output(); //returns raw body of resulting PDF returned as a string as per the plugin documentation. var data = new FormData(); data.append("data" , pdf); var xhr = new XMLHttpRequest(); xhr.open( 'post', 'upload.php', true ); //Post to php Script to save to server xhr.send(data); } html(); }); </code></pre> <p><strong>upload.php</strong></p> <pre><code>if(!empty($_POST['data'])){ $data = $_POST['data']; $fname = "test.pdf"; // name the file $file = fopen("testa/pdf/" .$fname, 'w'); // open the file path fwrite($file, $data); //save data fclose($file); } else { echo "No Data Sent"; } </code></pre> <p>The key part being <code>var pdf =doc.output();</code> where you want to get the raw pdf data. </p>