Determine the number of pages in TIFF, PDF, JPEG, PCL, PS, PRN, XPS, PXL, etc. spool documents. Determine Color Depth (color, black/white, grey scale) and DPI for Each Page.

SPL (PCL, PS, PDF, PRN) Page Counter is an easy to use PCL, PS, PRN, TIFF, PDF, and JPEG page counting and measurement application. It supports all versions of single page and multi-page TIFF, PCL, PS, PRN and PDF files as well as single page JPEG files. Quickly and efficiently process large groups of images and folders at one time to analyze page count, page size.

VeryPDF Spool File Page Counter SDK:
https://www.verypdf.com/app/hookprinter/spool-file-page-counter-sdk.html
https://www.verypdf.com/dl2.php/ps-and-pcl-info-sdk.zip

SPL (PCL, PS, PDF, PRN) Page Counter was developed to count black/white and color pages in PCL, PS, PDF, PRN, etc. spool documents. Whether you need to generate a page count on the fly, or generate a page count on a scheduled basis, this is the software product that places the power into your hands.

SPL (PCL, PS, PDF, PRN) Page Counter Features:

  • Processes: TIFF, PDF, JPEG, PCL, PS, PRN, XPS, PXL
  • Single Page and Multi Page Files
  • Reports Number of Pages
  • Records Dimensions of Each Page
  • Measures Dimensions in Imperial and Metric System (feet and meters)
  • Determine color depth (color, black/white, grey scale) and DPI for Each Page
  • Extremely Fast counting routine!!!
  • Works with Command Lines (GREAT for scheduled tasks!!)
  • Suppress output to the background
  • Unequaled tech support

The following is a C++ example to retrieve color information from each page from PDF, PS, PCL, etc. formats,

#include <windows.h>

#include <windowsx.h>

#include <commctrl.h>

#include <commdlg.h>

 

#include <time.h>

#include <stdio.h>

#include <sys/types.h>

#include <sys/timeb.h>

#include <stdlib.h>

 

#include <string>

#include <vector>

using namespace std;

 

/////////////////////////////////

//If you set bIsRenderToPDF to TRUE, bwPageCount and colorPageCount will
//return valid values,
if you set bIsRenderToPDF to FALSE, bwPageCount will
// return total pages.

//

//Return value:

//  TRUE is successful

//  FALSE is failed

//

/////////////////////////////////

extern "C" __declspec(dllexport)

BOOL WINAPI ReadInfoFromAllFormats(LPCTSTR fileName, BOOL bIsRenderToPDF, DWORD* bwPageCount, DWORD* colorPageCount, DWORD* copyCount, double* pagewidth, double* pageheight, LPTSTR paperSizeName);

 

extern "C" __declspec(dllexport)

BOOL WINAPI ReadInfoFromPSFile(LPCTSTR fileName, BOOL bIsRenderToPDF, DWORD* bwPageCount, DWORD* colorPageCount, DWORD* copyCount, double* pagewidth, double* pageheight, LPTSTR paperSizeName);

 

extern "C" __declspec(dllexport)

BOOL WINAPI ReadInfoFromPCLFile(LPCTSTR fileName, BOOL bIsRenderToPDF, DWORD* bwPageCount, DWORD* colorPageCount, DWORD* copyCount, double* pagewidth, double* pageheight, LPTSTR paperSizeName);

 

extern "C" __declspec(dllexport)

BOOL WINAPI ReadInfoFromEMFFile(LPCTSTR fileName, BOOL bIsRenderToPDF, DWORD* bwPageCount, DWORD* colorPageCount, DWORD* copyCount, double* pagewidth, double* pageheight, LPTSTR paperSizeName);

 

extern "C" __declspec(dllexport)

BOOL WINAPI ReadInfoFromSPLEMFFile(LPCTSTR fileName, BOOL bIsRenderToPDF, DWORD* bwPageCount, DWORD* colorPageCount, DWORD* copyCount, double* pagewidth, double* pageheight, LPTSTR paperSizeName);

 

extern "C" __declspec(dllexport)

void WINAPI ReadInfoSetCode(const char *lpCode);

 

extern "C" __declspec(dllexport)

void WINAPI ReadInfoEnableDebug(int bEnable);

 

extern "C" __declspec(dllexport)

int WINAPI ReadInfoGetPageCount();

 

extern "C" __declspec(dllexport)

int WINAPI ReadInfoGetPageColorInfo(int nPage);

 

extern "C" __declspec(dllexport)

int WINAPI ReadInfoGetAllInfo(char *lpszBuffer, int nBufferLen);

 

 

void GetModulePath(char *out_path,char *in_name)

{

         char *p;

         GetModuleFileName(NULL,out_path,256);

         p =strrchr(out_path,'\\');

         p[1]=0;

         strcat(out_path,in_name);

}

 

void DumpInformation(char *lpInFile, BOOL bIsRenderToPDF)

{

         char drive[_MAX_DRIVE];

         char dir[_MAX_DIR];

         char fname[_MAX_FNAME];

         char ext[_MAX_EXT];

        

         _splitpath(lpInFile, drive, dir, fname, ext );

        

         DWORD bwPageCount = 0;

         DWORD colorPageCount = 0;

         DWORD copyCount = 0;

         double nPageWidth = 0;

         double nPageHeight = 0;

         char szPaperSizeName[200] = {0};

         BOOL bRet = FALSE;

        

         ReadInfoSetCode("XXXXXXXXXXXXXXXXXXX");

         ReadInfoEnableDebug(1);

         if(!stricmp(ext, ".ps") || !stricmp(ext, ".eps"))

                   bRet = ReadInfoFromPSFile(lpInFile, bIsRenderToPDF,
                          &bwPageCount, &colorPageCount, &copyCount,
                          &nPageWidth, &nPageHeight, szPaperSizeName);

         else if(!stricmp(ext, ".pcl"))

                   bRet = ReadInfoFromPCLFile(lpInFile, bIsRenderToPDF,
                          &bwPageCount, &colorPageCount, &copyCount,
                          &nPageWidth, &nPageHeight, szPaperSizeName);

         else

                   bRet = ReadInfoFromAllFormats(lpInFile, bIsRenderToPDF,
                          &bwPageCount, &colorPageCount, &copyCount,
                          &nPageWidth, &nPageHeight, szPaperSizeName);

         printf("=======================================\n");

         printf("File = '%s'\n", lpInFile);

         printf("Return Value = %s\n", bRet?"TRUE":"FALSE");

         printf("bIsRenderToPDF = %d\n", bIsRenderToPDF);

         printf("bwPageCount = %d\n", bwPageCount);

         printf("colorPageCount = %d\n", colorPageCount);

         printf("copyCount = %d\n", copyCount);

         printf("PageWidth = %g\n", nPageWidth);

         printf("PageHeight = %g\n", nPageHeight);

         printf("PaperSizeName = '%s'\n", szPaperSizeName);

 

         if(bIsRenderToPDF)

         {

                   int nPageCount = ReadInfoGetPageCount();

                   printf("Color Information for each page (%d pages):\n",
                          nPageCount);

                   for(int i = 0; i < nPageCount; i++)

                   {

                            int nColor = ReadInfoGetPageColorInfo(i);

                            switch(nColor)

                            {

                            case 1:

                                     printf("Page %3d is [Color]\n", i+1);

                                     break;

                            case 2:

                                     printf("Page %3d is [   BW]\n", i+1);

                                     break;

                            case 3:

                                     printf("Page %3d is [ Gray]\n", i+1);

                                     break;

                            default:

                                     printf("[Failed to get color information
                                            from Page %3d]\n"
, i+1);

                                     break;

                            }

                   }

         }

 

         char szBuffer[5000] = {0};

         int nRet = ReadInfoGetAllInfo(szBuffer, sizeof(szBuffer));

         printf("[ReadInfoGetAllInfo] Begin\n%s\n[ReadInfoGetAllInfo] End\n",
                szBuffer);

         printf("\n\n\n");

}

 

void main(int argc, char *argv[])

{

         if(argc != 2)

         {

                   printf("%s C:\\test.ps\n", argv[0]);

                   printf("%s C:\\test.pcl\n", argv[0]);

                   printf("%s C:\\test.spl\n", argv[0]);

                   printf("%s C:\\test.pdf\n", argv[0]);

                   printf("%s C:\\test.emf\n", argv[0]);

                   printf("%s C:\\test.prn\n", argv[0]);

                   return;

         }

 

         char *lpInFile = argv[1];

         DumpInformation(lpInFile, TRUE);

         DumpInformation(lpInFile, FALSE);

}

 

 

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!