public bool ExtractPDFPages(string srcpath, string destpath, int PagesCnt, out string err)//, int primaryid, int secondaryid, float ordinalNum)
        {
            bool result     = false;
            int  opsResult  = -1;
            int  FileHandle = -1;
            int  count      = PagesCnt;
            int  errorcode  = 0;

            err = "";
            try
            {
                if (isLibraryLoaded == false)
                {
                    result = LoadPDFLib();
                    if (result == false)
                    {
                        return(result);
                    }
                }

                //Page count is 0 - findout at runtime page count
                if (PagesCnt == -1)
                {
                    FileHandle = pdfLib.DAOpenFileReadOnly(srcpath, "");
                    if (FileHandle == 0)
                    {
                        errorcode = pdfLib.LastErrorCode();
                        err      += "Debenu Error Code " + errorcode;
                        //LogManager.Trace("PWPPDFMgr::ExtractPDFPages", TraceCategoryType.Error, "DAOpenFileReadOnly failed - Unable to open file-srcpath", srcpath, "errorcode", errorcode.ToString());
                        return(result);
                    }
                    count = pdfLib.DAGetPageCount(FileHandle);

                    if (FileHandle != -1)
                    {
                        pdfLib.DACloseFile(FileHandle);
                    }
                }


                string pagefilename = string.Empty;
                string pagewisepath = string.Empty;
                string pagesRange   = string.Empty;
                //PWPDocumentInfo docpageInfo = null;

                if (!Directory.Exists(Path.Combine(destpath, Path.GetFileName(srcpath))))
                {
                    Directory.CreateDirectory(Path.Combine(destpath, Path.GetFileNameWithoutExtension(srcpath)));
                    pagefilename = Path.Combine(destpath, Path.GetFileNameWithoutExtension(srcpath));
                }

                for (int idx = 1; idx <= count; idx++)
                {
                    pagewisepath = string.Empty;
                    pagesRange   = string.Empty;

                    pagewisepath = Path.Combine(pagefilename, "Page_" + idx + ".pdf");
                    pagesRange   = idx.ToString() + "-" + idx.ToString();
                    opsResult    = pdfLib.ExtractFilePages(srcpath, "", pagewisepath, pagesRange);
                    if (opsResult == 0)
                    {
                        errorcode = pdfLib.LastErrorCode();
                        err      += "Debenu Error Code " + errorcode;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                result = false;
                err   += ex.Message;
            }
            return(result);
        }