Search code examples
phplaravelazurepdftkvoyager

Azure web app with PDFtk (PHP laravel backend)


I am trying to override the Voyager admin panel read view with a PDF form that is filled from fields in the DB.

I achieved this through FPDM with PDFtk on localhost on a windows machine. The problem is that the web app is hosted on Azure. Is there any way to install PDFtk on the Azure side.

And if not, is there another solution to approach this situation?

Any help is appreciated. Thanks in advance.


Solution

  • It sounds like your real question is how to install PDFtk on Azure WebApp for Windows.

    Yes, I tried to install it and run a command pdftk.exe *.pdf cat output combined.pdf successfully.

    Here is my steps below.

    1. I downloaded an installation PDFtk Free from PDFtk offical website https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/.

      enter image description here

    2. I installed it into D:\Program Files\PDFtk my local Windows machine and move into the directory PDFtk\bin.

      enter image description here

    3. I was ready for two PDF files, such as Google.pdf and Bing.pdf which I got them via browse and print them as pdf in Chrome.

      enter image description here

    4. I opened the Kudu console of my Azure WebApp, and command cd site\wwwroot to move to wwwroot path , and then I drag and drop these four files above in Step 2 & 3 into it.

      enter image description here

    5. Finally, I tried to only run pdftk.exe to get the help information successfully, and then to run pdftk.exe *.pdf cat output combined.pdf command and it works fine to get the combined.pdf file as Step 4 shown.

      enter image description here

    So if you want to invoke it in programming, you just invoke its absolute path D:\home\site\wwwroot\pdftk.exe with its parameters from your code, it will work fine for you.

    Note: Due to the Win32k.sys (User32/GDI32) Restrictions of Azure Web App sandbox, not every pdf conversion software can be installed on Azure WebApp as my did above. So PDFtk is a special software which not be implemented by using GDI.