Universal Document Converter
Informazioni sul prodotto
Scarica
Acquista
Tutorial
Soluzioni per sviluppatori
Servizio di assistenza
Chi fCoder SIA


      Cerca nel sito
   


      Conversioni più richieste
Da Adobe PDF a JPEG
Da documento Word a PDF
Da foglio di lavoro Excel a PDF
Da PowerPoint a JPEG
Da disegno Visio a PDF
Da disegno AutoCAD a TIFF
Da pagina Web a JPEG
Convertire di lavoro Excel in PDF
Convertire da DjVu in PDF
Pagine Web in PDF



Pagina principale>Developer Solutions>Examples>PHP>AutoCAD Drawings to PDF

Converting AutoCAD Drawings to PDF


'----------------------------------------------------------------------
' 1) Autodesk AutoCAD 2000 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->Adjustments->Crop->Mode = 0;
  $itfProfile->PostProcessing->Mode = 0;
  $itProfile->ShowProgressWnd = 1;
			
  	//Create AutoCAD object and open .DWG file
	
  $file = 'my_chart.dwg';
	
  $ACADApp = new COM("AutoCAD.Application");
  $Drawing = $ACADApp->Documents->Open($file,false);
	
  //Change the preferences of AutoCAD for scaling the drawing to page
	
   If ($Drawing->ActiveSpace = 0){
	$Layout = $Drawing->PaperSpace->Layout;
	}
   Else {
	$Layout = $Drawing->ModelSpace->Layout;
	}
		
  $Layout->PlotType = 1;
  $Layout->UseStandardScale = True;
  $Layout->StandardScale = 0;
  $Layout->CenterPlot = True;
	
  $Drawing->SetVariable("BACKGROUNDPLOT", 0);
  $Drawing->SetVariable("FILEDIA", 0);
  $Drawing->SetVariable("CMDDIA", 0);

  // Plot the drawing 
	
  $Drawing->Plot->QuietErrorMode = True;
  $Drawing->Plot->PlotToDevice("Universal Document Converter");
	
  //Pause for processing
	
  sleep(5);
	
  // Close drawing
	
  $Drawing->Close(False);
	
  //Close Autodesk AutoCAD
	
  $ACADApp->Quit();
		
  echo "READY!";
	
 ?> 



© 2001-2017 fCoder SIA Chi fCoder SIA | Mappa del sito