0

I am trying to run PDFTron for php following the instructions. However, when called: PDFNet::Initialize(); i'm getting an error

Fatal error: Uncaught Error: Call to undefined function PDFNet_Initialize() in .../PDFNetPHP_core.php

I assume that PDFNet_Initialize is part of extension because i can't see declaration in PDFNetPHP_core.php file

I setup exenstion PDFNetPHP.so and enable_dl = on in php.ini. Also when i run test in PDFNetWrappers/Samples/AddImageTest/PHP then it's looks ok:

PDFNet is running in demo mode.
Permission: write
Done. Result saved in addimage.pdf...<br />

when i run php -m module PDFNetPHP is on list

what am I doing wrong?

JanuszO
  • 1,140
  • 12
  • 25

1 Answers1

1

If the sample code is working on your end, it's likely that your project is unable to find the libPDFNetC.soshared library. The RunTest.sh in the AddImageTest sample sets the following environment variable:

export LD_LIBRARY_PATH=../../../PDFNetC/Lib

You might need to add the .so explicitly, or at least put the .so in a folder that PHP will load .so files from. See your PHP documentation. Please also see the following post: https://stackoverflow.com/a/35442777/3761687

  • Path to .so file is correct, if it were wrong then command ```php --ini``` would throw an exception for module – JanuszO Feb 02 '21 at 06:35