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>Visual C++>PDF Documents to JPEG

Converting PDF Documents to JPEG


//////////////////////////////////////////////////////////////////
// This example was designed for using in Microsoft Visual C++ from 
// Microsoft Visual Studio 2003 or above.
//
// 1. Adobe Acrobat Writer 4.0 or above should be installed and activated on your PC.
//    Adobe Acrobat Reader does not have COM interface and cannot be used as COM-server!
//
// 2. Universal Document Converter 5.2 or above should be installed, too.
//
// 3. You must initialize the COM before you call any COM method.
// Please insert "::CoInitialize(0);" in your application initialization
// and "::CoUninitialize();" before closing it.
//
// 4. Import Acrobat libraries for 32-bit version of Windows.
// For 64-bit version please change "C:\\Program Files\\" to
// "C:\\Program Files (x86)\\" in all pathes.

#pragma message("Import Acrobat API")
// Acrobat 4.0 -> "C:\\Program Files\\Adobe\\Acrobat 4.0\\Acrobat\\acrobat.tlb"
// Acrobat 5.0 -> "C:\\Program Files\\Adobe\\Acrobat 5.0\\Acrobat\\acrobat.tlb"
// Acrobat 6.0 -> "C:\\Program Files\\Adobe\\Acrobat 6.0\\Acrobat\\acrobat.tlb"
// Acrobat 7.0 -> "C:\\Program Files\\Adobe\\Acrobat 7.0\\Acrobat\\acrobat.tlb"
// Acrobat 8.0 -> "C:\\Program Files\\Adobe\\Acrobat 8.0\\Acrobat\\acrobat.tlb"
// Acrobat 9.0 -> "C:\\Program Files\\Adobe\\Acrobat 9.0\\Acrobat\\acrobat.tlb"
#import "C:\\Program Files\\Adobe\\Acrobat 4.0\\Acrobat\\acrobat.tlb"\
    rename_namespace("ACROBAT"), auto_rename

// 5. Import Universal Document Converter software API:
#import "progid:udc.apiwrapper" rename_namespace("UDC")
//////////////////////////////////////////////////////////////////

void PrintAdobePDFToJPEG( CString sFilePath )
{
  UDC::IUDCPtr pUDC(__uuidof(UDC::APIWrapper));
  UDC::IUDCPrinterPtr itfPrinter = pUDC->Printers["Universal Document Converter"];
  UDC::IProfilePtr itfProfile = itfPrinter->Profile;

// Adobe Acrobat API allow to print only on the default printer
  pUDC->DefaultPrinter = "Universal Document Converter";

// Use Universal Document Converter API to change settings of converterd document
  itfProfile->Load("C:\\Program Files\\Universal Document Converter\\UDC Profiles\\PDF to JPEG.xml");
 
  itfProfile->OutputLocation->Mode = UDC::LM_PREDEFINED;
  itfProfile->OutputLocation->FolderPath = L"C:\\Out";

  itfProfile->PostProcessing->Mode = UDC::PP_OPEN_FOLDER;

// Run Microsoft Visio as COM-server
  ACROBAT::CAcroAppPtr itfAdobeApp(L"AcroExch.App");
  ACROBAT::CAcroAVDocPtr itfAVDocument(L"AcroExch.AVDoc");
  ACROBAT::CAcroPDDocPtr itfPDDocument;
  int nPages;

// Open PDF document from file
  itfAVDocument->Open( (LPCTSTR)sFilePath, _T("") );
  itfPDDocument = itfAVDocument->GetPDDoc();

  nPages = itfPDDocument->GetNumPages();

// Print all pages of the document
  itfAVDocument->PrintPagesSilent(0, nPages - 1, 0, true, true);

// Close the document
  itfAVDocument->Close(true);

// Close Adobe Acrobat Writer
  itfAdobeApp->Exit();
}


© fCoder SIA Chi è fCoder SIA | Mappa del sito