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>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 Acerca de fCoder SIA | Mapa del sitio