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>Post-Print Examples

Send Image File to Printer Directly


Universal Document Converter is virtual printer software that saves any document you print as a raster PDF or an image file. You can use a post-print feature of Universal Document Converter to apply additional processing to every output file. The example below is just one of many post-print processing solutions. Please let us know if you cannot find the solution you need.

// Some professional printers allow you send image files directly
// without opening in graphics viewer. In some cases you can receive
// better results if you print your drawing to high-resolution
// image file using Universal Document Converter and then send this
// image file to the printer directly.

#include "Winspool.h"
#include <io.h>

BOOL Img2Printer(char* filePath, char* prnName)
{
  HANDLE     prnHandle;
  DOC_INFO_1 di;
  DWORD	     cWritten, len;
  BOOL	     retCode;
  FILE       *fp;
  char       *buff;
////
  fp = fopen( filePath, "rb" );
  if( !fp ) return 0;

  len = _filelength( fileno(fp) );
  buff = new char[len];

  fread( buff, len, 1, fp );
  fclose( fp );
////
  if( !::OpenPrinter( prnName, &prnHandle, 0 ) )
  {
    delete buff;
    return 0;
  }
////
  di.pDocName = "My Image File";
  di.pOutputFile = 0;
  di.pDatatype = "RAW";

  if( !::StartDocPrinter( prnHandle, 1, (LPBYTE)&di ) )
    return 0;

  retCode = ::WritePrinter( prnHandle, buff, len, &cWritten );

  ::EndDocPrinter( prnHandle );
  ClosePrinter( prnHandle );

  delete buff;
  return retCode;
}



Related topics
Popular pages
Popular solutions


© fCoder SIA Acerca de fCoder SIA | Mapa del sitio