PHP developers can use the ActiveX edition of Foxit Quick PDF Library to add PDF functionality to their PHP websites running on the Windows operating system. Here’s a quick guide on how to get up and running:
- The first thing you’ll need to do is register the ActiveX edition of Foxit Quick PDF Library. The sample code below uses the 32-bit version of the library.
- Create a PHP file that includes the code below.
- Make sure that the version of library that you’re using is updated on line 3.
- Make sure that you have added your license key to the UnlockKey function on line 4.
$root = $_SERVER['DOCUMENT_ROOT'] . '/'; $FileName = $root . '/hello_world.pdf'; $qp = new COM('DebenuPDFLibraryAX1312.PDFLibrary'); $validKey = $qp->UnlockKey('...'); if ($validKey == 1) { echo 'License validation successful!'; echo 'Valid license key: '; echo $qp->LicenseInfo; } else { echo 'License validation failed!'; } $qp->SetOrigin(1); $qp->DrawText(100, 100, 'Hello PHP! This text has been drawn using the DrawText function.'); $qp->DrawHTMLText(100, 125, 400, '<b>Quick PDF Library Version:</b> ' . $qp->LibraryVersion); $qp->DrawHTMLText(100, 140, 400, '<b>License Information:</b> ' . $qp->LicenseInfo); $qp->DrawBox(50, 50, 500, 150, 0); $r = $qp->SaveToFile($FileName); if ($r == 1) { echo 'The file was saved successfully.'; } elseif ($r == 2) { echo 'The file was not saved successfully.'; } $qp = null; |