Example code is for an older version of Toolkit, newer code is available.
<?php
// Copyright (c) 2019 ActivePDF, Inc.
// ActivePDF Toolkit 2017
// Example generated 12/10/19
?>
<?php
// Get current path
$strPath = dirname(__FILE__) . "\\";
// Instantiate Object
$oTK = new COM("APToolkit.Object");
// Set the PDF page Height and Width to Letter (72 = 1")
$oTK->OutputPageHeight = 792.0;
$oTK->OutputPageWidth = 612.0;
// Create the new PDF file
$intOpenOutputFile = $oTK->OpenOutputFile($strPath . "new.pdf");
if ($intOpenOutputFile != 0) {
Error("OpenOutputFile", $intOpenOutputFile);
}
// Create a new blank page to place the scaled image
$oTK->NewPage();
// Place the image in a box the size of the page
// Setting the persist ration parameter to true will
// make is so the image is not distorted and properly scaled
$oTK->PrintImage($strPath . "Big.jpg", 0.0, 0.0, 612.0, 792.0, true, 0);
// Close the new file to complete PDF creation
$oTK->CloseOutputFile();
// Release Object
$oTK = null;
// Process Complete
echo "Done!";
// Error Handling
function Error($method, $outputCode) {
echo "Error in " . $method . ": " . $outputCode;
}
?>