Example code is for an older version of Toolkit, newer code is available.
<?php
// Copyright (c) 2021 ActivePDF, Inc.
// ActivePDF Toolkit 2017
// Example generated 01/17/21
?>
<?php
// Get current path
$strPath = dirname(__FILE__) . "\\";
// Instantiate Object
$oTK = new COM("APToolkit.Object");
// Toolkit can directly convert an image to a PDF file
// If the image is a JPEG file use JPEGToPDF
$intJPEGToPDF = $oTK->JPEGToPDF($strPath . "IMG.jpg", $strPath . "JPEG.pdf");
if ($intJPEGToPDF < 1) {
Error("JPEGToPDF", $intJPEGToPDF);
}
// If the image file is a TIFF file use TIFFToPDF
$intTIFFToPDF = $oTK->TIFFToPDF($strPath . "IMG.tif", $strPath . "TIFF.pdf");
if ($intTIFFToPDF != 1) {
Error("TIFFToPDF", $intTIFFToPDF);
}
// Any supported image file can be converted to PDF with ImageToPDF
$intImageToPDF = $oTK->ImageToPDF($strPath . "IMG.jpg", $strPath . "IMG.pdf");
if ($intImageToPDF != 1) {
Error("ImageToPDF", $intImageToPDF);
}
// Release Object
$oTK = null;
// Process Complete
echo "Done!";
// Error Handling
function Error($method, $outputCode) {
echo "Error in " . $method . ": " . $outputCode;
}
?>