PDF Signatures with Aloaha and PHP

The Aloaha digital Signature API is implemented as an automation compatible COM Object. That allows virtually all known languages to use the signature API. Please find below some sample source code in PHP.



A valid Aloaha Enterprise License is required to use the Aloaha Signature API. Please contact our support at aloaha@wrocklage.de for an evaluation key.


<?php
$reason = "Signed by Aloaha PDF Suite";
$location= "Ibbenbueren, Germany";
$cert="0";
$image = "c:\\test2\\signature.jpg";

$px1 = 2;
$py1 = 98;

$px2 = 20;
$py2 = 93;

$zero=0;

$api = new COM("aloahapdf.edit");

$infile = "c:\\test2\\test.pdf";
$outfile = "c:\\test2\\test.pdf";
$api->set_unique($cert);
$test = $api->sign_pdf_file($infile, $outfile, $zero, $zero, $px1, $py1, $px2, $py2, $reason, $location, $cert, $image);

$api = NULL;
?>

The variable cert contains a reference to the certificate to be used. It can contain the path to a PFX file (without password), it can contain a UniqueContainerName or Serialnumber of the Certificate in the Windows Certificate Store or it can contain number 0-9 for cardreaders 0-9 in case a native supported card is used.




The most common problem of NOT getting this code to work is a wrongly configured Webserver. Please make sure that:

- the Webserver process as full access to the Aloaha directory (incl. subdirectories)

- that the Webserver properly unloads Objects. Per default IIS caches Objects even if you unload them. This results in unpredictable results such as no access to the private key.

Please have a look at the document below to find a sample IIS configuration.

Configure IIS Application Pool to use Aloaha Signature API from ASP.pdf (446,62 KB)


Please ask...

Although we really tried hard, there are always questions left open. But perhaps somebody else had already put the same question?
Please check!
  • I need to protect with a signature some PDF created by users, where every user have a signature. If I want to create a PDF in PHP, of what I need to do or to shop???
    You would need at least the Aloaha PDF Suite Server Edition. But please note that PDFs will always be generated via a virtual Printer Driver. If you have further questions you can contact us at info@aloaha.com
    Answered 23.09.2011
  • Hi,
    I have a PKCS1-RSA signature generated by a smartcard. I wish to append it to a PDF or create a Xades signature. I am using PHP. What I have on server side is the file original, the digest, the public certificates and the signature.

    Does one of your products could do this ?

  • I want to use it on a Linux Server.
    Can I?

If not, please do not hesitate to send us your question.
We would be glad to answer it.
PDF SDKPDF Signature APIc++ UsageText SignaturesVB6 Signature sampleSignature TypesPHP Signature SampleAloaha CustomSigner PluginModify signed PDFUniqueContainerNameSign PDF AttachmentsAloaha Commandline Signer (ACS)Interactive SignaturesExtract Signature CertificatesCertificate PropertiesSample CodeText StampsPDF AttachmentsImage 2 PDFPDF to Multipage TIFFAppend PDFInsert Blank PageRender ImageStamp PDF with PDFDraw PDF as LetterheadApply LetterheadPDF BackgroundsAdd NotesURL HotspotSecure PDF ViewerPDF OptimizerPDF Encryption APIPDF Printing APIPDF BookmarksPDF BarcodingMerge PDF DocumentsSample APIsResize PDFCrop PDF PagePDF InformationPDF2TXTNormalize PagesDirect PDF ConversionPDF Form Saver SDKSmart Card APIAloaha Web ServicesAloaha Print MonitorAloaha Remote ConfigurationWebDAVLDAP ClientProgramming Office MacrosIIS Event Sinks