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/TiffFlate.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.
//
//--------------------------------------------------------------------
//   TiffFlate.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');
   }
}

// Init PDF Library with enpty license name and key ( Demo version )   
$Lib = pdf_library_init( "", "" );           # Initialize PDF Library Handle

// Create new PDF file
$Doc = pdfdoc_create( $Lib );              
// Launch destination PDF file after work if Windows Presents
if ( is_windows() ) {
	 pdfdoc_set_auto_launch( $Doc, true );   
	 $ImageFile = getcwd().'\in\images\islandsbw.tif';
} else {
	 $ImageFile = 'in/images/islandsbw.tif';
}	 

// Insert new page into document
$PageIdx = pdfdoc_append_page2($Doc, PS_A4, PO_PAGE_PORTRAIT);   
// Assign image index 
$ImageIdx = pdfimage_append_to_doc_from_file( $Doc, $ImageFile, 0, ITC_FLATE ); 
$Pbx = pdfpage_create_paint_box( $Doc, $PageIdx, 72);    
// Insert image into document on the current page 
pbx_show_image( $Pbx, $ImageIdx, 0.0, 0.0, 590, 840, 0); 
// Close paintbox 
pbx_close( $Pbx, true );                                     

$SapiName = php_sapi_name();

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

pdfdoc_close( $Doc );

// Free PDF Library
pdf_library_done( $Lib ); 
?>