problem finding ReadInfo.dll library, an unhandled exception of type ‘System.DllNotFoundException’ error message

I am using the trial version of your Spool File Page Counter SDK to count color pages. I have requested that we purchase the product. The csharp sample you provided works perfectly. However, when I test within my own application I get the following error for the ReadInfo.dll file,

An unhandled exception of type 'System.DllNotFoundException'

Can you provide instructions on how to use the dll within a C# program? I have included the code I use,
sing System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using SawgrassMutualShared;

namespace SawgrassMutualBL
    public class ColorCounter
        [DllImport("ReadInfo.dll", EntryPoint = "ReadInfoFromPCLFile")]
        public static extern Int32 ReadInfoFromPCLFile(
        string fileName,
        Int32 bIsRenderToPDF,
        ref uint bwPageCount,
        ref uint colorPageCount,
        ref uint copyCount,
        ref double pagewidth,
        ref double pageheight,
        StringBuilder paperSizeName);
        [DllImport(@"ReadInfo.dll", EntryPoint = "ReadInfoSetCode")]
        public static extern void ReadInfoSetCode(string strCode);
        public SawgrassMutualShared.ColorCounts Count(string FileType)
            var InputDir = Properties.Settings.Default.Input;
            var WorkDir = Path.Combine(InputDir, FileType);
            var files = Directory.GetFiles(WorkDir, "*.pdf");
            var cCounts = new ColorCounts();
            cCounts.FileType = FileType;
            foreach(var fileName in files)
                int bIsRenderToPDF = 1;
                uint bwPageCount = 0;
                uint colorPageCount = 0;
                uint copyCount = 0;
                double nPageWidth = 0;
                double nPageHeight = 0;
                StringBuilder strPaperSizeName = new StringBuilder(300);
                ReadInfoFromPCLFile(fileName, bIsRenderToPDF, ref bwPageCount,
                       ref colorPageCount, ref copyCount, ref nPageWidth,
                       ref nPageHeight, strPaperSizeName);
                cCounts.ColorCount += (int)colorPageCount;
                cCounts.BWCount += (int)bwPageCount;
            return cCounts;

Please compile your C# code into an EXE file first, place this EXE and DLL files into same folder, run your EXE from this folder, your EXE will able to load necessary DLL files properly.

The folder should contain following files,



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!