diff --git a/content/post/2024_09_06_Convert_anything_to_PDF.md b/content/post/2024_09_06_Convert_anything_to_PDF.md new file mode 100644 index 0000000..f2e9b3e --- /dev/null +++ b/content/post/2024_09_06_Convert_anything_to_PDF.md @@ -0,0 +1,145 @@ ++++ +title = 'Convert anything to PDF' +date = 2024-09-06T09:22:43+02:00 +draft = false +showonlyimage = true +image = "img/posts/convert_to_pdf.png" +writer = "Peter Makra" +categories = [ "web", "files" ] +weight = 1 +tags = [ "docker", "office", "pdf", "convert", "api", "node" ] ++++ + + + +### Try it out +
+
+
    +
  1. + Choose a file +
  2. +
  3. + Enter the result of the calculation with numbers before clicking convert. +
    + + +
  4. +
  5. + Click convert -> + +
  6. +
  7. + Get your pdf +
  8. +
  9. + Be happy :) +
  10. +
+
+
+ + + + + +> Be aware that the deployed demo instance is with minimal resources. +If it does not work it may be maxxed out, or scaled to zero. +In the second case after few seconds it should work again. +In the first.. well stop ddosing pls. + + +### tl;dr for the curious ones +Resources: +- + + github logo + mcraa/libre-to-pdf-node +- + + docker logo + docker pull mcraa/libre-to-pdf-node +- special thanks to [Libre office](https://www.libreoffice.org/) as most of the work is done by them. +- as well as to the creator of the node lib used [ office-to-pdf](https://www.npmjs.com/package/office-to-pdf?activeTab=readme) + +#### So what is added here? + +Simple web server created with one endpoint making that CLI command happening. +So you can use it with one click. + +[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fgist.githubusercontent.com%2Fmcraa%2Ffc199581ecee2ccdb69699d5b66f70d4%2Fraw%2Fe6c87b7485404bdf84230b8b84ca1e7474b94e07%2Farmtemplate-container-pdfconverter.json) + +Or one `docker run`. +Or simply adding it to a kubernetes cluster. +You choose your cup of tea. + +#### Background story + +Recently a client who handles documents with sensitive data on their web application +wanted to have previews online of all the files uploaded. +My colleague quickly realized converting to PDF is the way to go, +but all solutions he quickly found were sending the file to an unknown thirdparty blackbox. +Which was not acceptable of course. + +Luckily a very similar problem existed years ago (just check the commit date in the repo). +Search on docker hub improved since then, while writing this I found a similar solution 4 years older. + +So we added a container to the clients cluster, the files never leave our solution, and all files can have preview now as the browser handles pdf easily. \ No newline at end of file diff --git a/static/img/posts/convert_to_pdf.png b/static/img/posts/convert_to_pdf.png new file mode 100644 index 0000000..7f62a41 Binary files /dev/null and b/static/img/posts/convert_to_pdf.png differ