Hugo

Jquery to run php script

Hello!

I am trying to find a way to transform my web CV into pdf document (similar to this thread: Export a resume as a PDF). Following, the advice I am trying to use Pandoc. I also found a way to run terminal commands within php script which is called by jquery ajax (https://stackoverflow.com/questions/16941138/jquery-button-onclick-run-system-command).
So, I wrote the following things:
about.html
<button id="get_pdf">Download CV as pdf</button>

run_pandoc.js
(document).ready(function() { (’#get_pdf’).on(‘click’, function() {
$.ajax({
url : ‘run_pandoc.php’
}).done(function(data) {
console.log(data);
});
});
});

run_pandoc.php
<?php
echo shell_exec(‘pandoc -f html -t pdf -s -o CV_Nurfatima_Jandarova.pdf’)
?>

I’ve added the script, and jquery on its own works (I checked with console.log() function). But I don’t know where should I put run_pandoc.php file such that ajax can call it (I keep getting “The server has not found anything matching the requested URI” error).

I am a complete beginner with Hugo, so any help is appreciated. If it helps, I am using hugo-resume theme by Eddie Webb. If you know other ways of getting the desired pdf document, please let me know!

Thank you!

What you want isn’t supported by Hugo. You need to ask in a PHP forum.