Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/mm/ada/examples/
Upload File :
Current File : /var/www/html/mmishra/mm/ada/examples/DigitalSignature.php

<?php
/********************************************************************

   SYBREX SYSTEMS INCORPORATED
   Copyright (C) 2005 Sybrex Systems Incorporated
   All rights reserved.

   NOTICE: Sybrex permits you to use, modify, and distribute this file
   in accordance with the terms of the Sybrex license agreement
   accompanying it. If you have received this file from a source other
   than Sybrex, then your use, modification, or distribution of it
   requires the prior written permission of Sybrex.

--------------------------------------------------------------------
   DigitalSignature.php
********************************************************************/ 
	
// Check Windows operating system
function is_windows() {
	return ( substr_count( php_uname( 's' ), 'Windows' ) ? true : false ) ;    
};
if (!extension_loaded('VersyPDF')) {
   if ( is_windows() ) {
       dl('php_versypdf.dll');
   } else {
       dl('versypdf.so');
   }
}
// Initialize PDF Library Handle
$Lib = pdf_library_init( "", "" );
  
if ( is_windows() ) {
	 $PDFFile = getcwd().'\in\pdf\island.pdf';
	 $SigFile = getcwd().'\in\other\dig-signature.pfx';
} else {
	 $PDFFile = 'in/pdf/island.pdf';
	 $SigFile = 'in/other/dig-signature.pfx';
}	 
// Open exists document 
$Doc = pdfdoc_load_from_file( $Lib, $PDFFile );
// Launch destination PDF file after work if Windows os Presents
if ( is_windows() ) {
	 pdfdoc_set_auto_launch( $Doc, true );   
}	 

// Append digital signature from PFX file
pdfdoc_append_signature_from_file( $Doc, $SigFile, "Document Signature", "Only for test...", false, "123456" );

$SapiName = php_sapi_name();

if ( $SapiName != 'cli' ) {
	$Mem = pdfdoc_save_to_buffer( $Doc, &$Size );
	header( "Content-Disposition: inline; filename =DigitalSignature.pdf", true );
	header( "Content-Type: application/pdf",  true );
	header( "Content-Length: $Size", true );
	echo( $Mem );
} else {
	pdfdoc_save_to_file( $Doc, "out/pdf/DigitalSignature.pdf" );
	print "Success...\n";
}	

// Close PDF Document and free memory  
pdfdoc_close( $Doc );
// Free PDF Library      
pdf_library_done( $Lib );