Universal Document Converter
Información general
Descargas
Comprar
Tutoriales
Desarrolladores
Soporte técnico
Acerca de fCoder SIA


      Búsqueda en el sitio
   


      Conversiones populares
Adobe PDF a JPEG
Word Document a PDF
Hojas de cálculo Excel a PDF
PowerPoint a JPEG
Diseño Visio a PDF
Diseño AutoCAD a TIFF
Página web a JPEG
Convertir de cálculo Excel a PDF
Convertir DjVu a PDF
Convertir una página web a PDF

      Tutorial de vídeo
Ver el tutorial



Página principal>Developer Solutions>Examples>PHP>Word Documents to PDF

Converting Word Documents to PDF


'----------------------------------------------------------------------
' 1) Microsoft Word 97 or above should be installed and activated on your PC.
'
' 2) Universal Document Converter 5.2 or above should also be installed.
'
' 3) Apache WEB server and PHP 4.0 or above should be installed and adjusted.
'----------------------------------------------------------------------

 <?PHP  
	
  //Create Universal Document Converter object 
	
  $objUDC = new COM("UDC.APIWrapper");
	
  //Set up Universal Document Converter 
		
  $itfPrinter = $objUDC->Printers("Universal Document Converter");
		
  $itfProfile = $itfPrinter->Profile;
		
  $itfProfile->PageSetup->ResolutionX = 300;
  $itfProfile->PageSetup->ResolutionY = 300;
  $itfProfile->PageSetup->Orientation = 0;
	
  $itfProfile->FileFormat->ActualFormat = 7;
  $itfProfile->FileFormat->PDF->ColorSpace = 24;
  $itfProfile->FileFormat->PDF->Compression = 4;
  $itfProfile->FileFormat->PDF->Multipage = 2;
	
  $itfProfile->OutputLocation->Mode = 1;
  $itfProfile->OutputLocation->FolderPath = '&[Documents]\UDC Output Files\\';
  $itfProfile->OutputLocation->FileName = '&[DocName(0)].&[ImageType]';
  $itfProfile->OutputLocation->OverwriteExistingFile = 1;
		
  $itfProfile->PostProcessing->Mode = 0;
			
  //Create MS Word object
	
  $file = 'my_document.doc';
	
  $WordApp = new COM("Word.Application");
	
  //Print the document 
	
  $WordDoc = $WordApp->Documents->Open($file,0,1);
  $WordApp->ActivePrinter = "Universal Document Converter";
  $WordApp->PrintOut(False);
	
  //Close the document and MS Word
	
  $WordDoc->Close();
  $WordApp->Quit();
	
  echo "READY!";
	
 ?> 



© fCoder SIA Acerca de fCoder SIA | Mapa del sitio