<?php header('Access-Control-Allow-Origin: *'); ?>
<?php 
$pdf_64 = $_POST['pdf'];
$pdf_decoded = base64_decode ($pdf_64);
//Write data back to pdf file
$pdf = fopen ('test.pdf','w');
fwrite ($pdf,$pdf_decoded);
//close output file
fclose ($pdf);
?>