The following PHP example demonstrates the PSToPDF method, which converts a PostScript® file to PDF.
NOTE: This example is available in other script languages, you may select from the Code Sample list above to download the example in the language appropriate for your environment.
These files are required:
File.PS - The PS file to convert to PDF.
PSToPDF.PHP - Code detail provided below.
Click here to download this example (includes required files):
<?php
// Define Variables
// PDF output name
$varPDFName = getcwd() . "\ps.pdf";
// File To Convert
$varFile = getcwd() . "\file.ps";
// Instantiate Object
$APS = new COM("APServer.Object");
// PS To PDF conversion
$varReturn = $APS->PSToPDF($varFile, $varPDFName);
if ($varReturn != '0') { Error("PSToPDF", $varReturn); }
// Clear Server Object
$APS = null;
// Conversion Successful
echo "Done!";
// Error Handling
function Error($Method, $varReturn) {
echo "'$Method' failed with a '$varReturn'<br>";
$APS = null;
exit(); }
?>
Keywords
PSToPDF, Post, Script, PostSCript, To, Convert, Server, method, methods, property, properties, asp, cfm, cf, coldfusion, php, hypertext, preprocessor, cold, fusion, VBS, VBScript, vb, script, example, sample
The information in this article is for the use of activePDF Customers and Evaluation Users Only. No part of this document may be transmitted or reproduced without the express written consent of activePDF.