public static void ShowDSErrorString(IWin32Window owner, int x)
        {
            int num  = 0;
            int num2 = 0;
            int num3 = 0;

            byte[] buf  = null;
            byte[] buf2 = null;
            byte[] buf3 = null;
            num  = PXCV_Lib36.PXCV_Err_FormatSeverity(x, buf, 0);
            num2 = PXCV_Lib36.PXCV_Err_FormatFacility(x, buf2, 0);
            num3 = PXCV_Lib36.PXCV_Err_FormatErrorCode(x, buf3, 0);
            buf  = new byte[num];
            buf2 = new byte[num2];
            buf3 = new byte[num3];
            string str = "";

            if (PXCV_Lib36.PXCV_Err_FormatSeverity(x, buf, num) > 0)
            {
                str = PXCV_Helper.BytesToString(buf, num);
            }
            str += " [";
            if (PXCV_Lib36.PXCV_Err_FormatFacility(x, buf2, num2) > 0)
            {
                str += PXCV_Helper.BytesToString(buf2, num2);
            }
            str += "]: ";
            if (PXCV_Lib36.PXCV_Err_FormatErrorCode(x, buf3, num3) > 0)
            {
                str += PXCV_Helper.BytesToString(buf3, num3);
            }
            MessageBox.Show(owner, str, "PXCV36 Demo");
        }
Example #2
0
 public void OpenFromMemory(byte[] pMemory, uint size, int flags)
 {
     if (b)
     {
         throw new ApplicationException("PDFDoc.OpenFromMemory");
     }
     if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_ReadDocumentFromMemory(this.m_a, pMemory, size, flags)))
     {
         throw new ApplicationException("PDFDoc.OpenFromPXCV_ReadDocumentFromMemory");
     }
 }
Example #3
0
 public void ReleaseCachedData(int flags)
 {
     if (m_bDisposed)
     {
         throw new ApplicationException("PDFDoc.ReleaseCachedData");
     }
     if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_ReleaseCachedData(m_Doc, flags)))
     {
         throw new ApplicationException("PDFDoc.ReleaseCachedData.PXCV_ReleaseCachedData");
     }
 }
Example #4
0
 public void GetPageDimensions(int pn, out double w, out double h)
 {
     if (m_bDisposed)
     {
         throw new ApplicationException("PDFDoc.GetPageDimensions");
     }
     if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_GetPageDimensions(m_Doc, pn, out w, out h)))
     {
         throw new ApplicationException("PDFDoc.OpenFromPXCV_GetPageDimensions");
     }
 }
Example #5
0
 public void OpenFromIStream(IStream aIStream, Int32 flags)
 {
     if (m_bDisposed)
     {
         throw new ApplicationException("PDFDoc.OpenFromIStream");
     }
     if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_ReadDocumentFromIStream(m_Doc, aIStream, flags)))
     {
         throw new ApplicationException("PDFDoc.OpenFromPXCV_ReadDocumentFromIStream");
     }
 }
Example #6
0
 public void OpenFromMemory(byte[] pMemory, UInt32 size, Int32 flags)
 {
     if (m_bDisposed)
     {
         throw new ApplicationException("PDFDoc.OpenFromMemory");
     }
     if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_ReadDocumentFromMemory(m_Doc, pMemory, size, flags)))
     {
         throw new ApplicationException("PDFDoc.OpenFromPXCV_ReadDocumentFromMemory");
     }
 }
Example #7
0
 public void Open(string aFileName)
 {
     if (b)
     {
         throw new ApplicationException("PDFDoc.OpenFromIStream");
     }
     if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_ReadDocumentW(this.m_a, aFileName, 0)))
     {
         throw new ApplicationException("PDFDoc.Open.PXCV_ReadDocumentW");
     }
 }
Example #8
0
 public void Delete()
 {
     if (!m_bDisposed)
     {
         if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_Delete(m_Doc)))
         {
             throw new ApplicationException("PDFDoc.Delete.PXCV_Delete");
         }
         m_bDisposed = true;
     }
 }
Example #9
0
 public void OpenFromIStream(IStream aIStream, int flags)
 {
     if (b)
     {
         throw new ApplicationException("PDFDoc.OpenFromIStream");
     }
     if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_ReadDocumentFromIStream(this.m_a, aIStream, flags)))
     {
         throw new ApplicationException("PDFDoc.OpenFromPXCV_ReadDocumentFromIStream");
     }
 }
Example #10
0
 public void Delete()
 {
     if (!b)
     {
         if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_Delete(this.m_a)))
         {
             throw new ApplicationException("PDFDoc.Delete.PXCV_Delete");
         }
         b = true;
     }
 }
Example #11
0
 public void DrawPageToDC(IntPtr hDC, int pn, PXCV_Lib36.PXV_CommonRenderParameters aCommonRenderParams)
 {
     if (b)
     {
         throw new ApplicationException("PDFDoc.DrawPage");
     }
     if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_DrawPageToDC(this.m_a, pn, hDC, ref aCommonRenderParams)))
     {
         throw new ApplicationException("PDFDoc.DrawPageToDC.PXCV_DrawPageToDC");
     }
 }
Example #12
0
 public void ReleaseCachedData(int flags)
 {
     if (b)
     {
         throw new ApplicationException("PDFDoc.ReleaseCachedData");
     }
     if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_ReleaseCachedData(this.m_a, flags)))
     {
         throw new ApplicationException("PDFDoc.ReleaseCachedData.PXCV_ReleaseCachedData");
     }
 }
Example #13
0
 public void Init(string aKey, string aDevCode)
 {
     if (!m_bDisposed)
     {
         throw new ApplicationException("PDFLib.Init");
     }
     if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_Init(out m_Doc, aKey, aDevCode)))
     {
         throw new ApplicationException("PDFDoc.Init.PXCV_Init");
     }
     m_bDisposed = false;
 }
Example #14
0
 public void Init(string aKey, string aDevCode)
 {
     if (!b)
     {
         throw new ApplicationException("PDFLib.Init");
     }
     if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_Init(out this.m_a, aKey, aDevCode)))
     {
         throw new ApplicationException("PDFDoc.Init.PXCV_Init");
     }
     b = false;
 }
Example #15
0
        public int GetPagesCount()
        {
            int count = 0;

            if (b)
            {
                throw new ApplicationException("PDFDoc.GetPagesCount");
            }
            if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_GetPagesCount(this.m_a, out count)))
            {
                throw new ApplicationException("PDFDoc.OpenFromPXCV_GetPageDimensions");
            }
            return(count);
        }
Example #16
0
        public int GetPagesCount()
        {
            int cnt = 0;

            if (m_bDisposed)
            {
                throw new ApplicationException("PDFDoc.GetPagesCount");
            }
            if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_GetPagesCount(m_Doc, out cnt)))
            {
                throw new ApplicationException("PDFDoc.OpenFromPXCV_GetPageDimensions");
            }

            return(cnt);
        }
Example #17
0
        public void DrawPageToDIBSection(IntPtr hBaseDC, int pn, Color aBkgColor, PXCV_Lib36.PXV_CommonRenderParameters aCommonRenderParams, out Bitmap aBitmap)
        {
            aBitmap = null;
            if (m_bDisposed)
            {
                throw new ApplicationException("PDFDoc.DrawPageToDIBSection");
            }
            IntPtr hBitmap   = IntPtr.Zero;
            int    backcolor = aBkgColor.ToArgb();

            if (PXCV_Error.IS_DS_FAILED(PXCV_Lib36.PXCV_DrawPageToDIBSection(m_Doc, pn, ref aCommonRenderParams, hBaseDC, backcolor, ref hBitmap, IntPtr.Zero, 0)))
            {
                throw new ApplicationException("PDFDoc.DrawPageToDIBSection.PXCV_DrawPageToDIBSection");
            }
            aBitmap = Image.FromHbitmap(hBitmap);
            DeleteObject(hBitmap);
        }
Example #18
0
        public const int PS_ERR_DocNotRead            = unchecked ((int)0x821427b5);  // Document is not read


        public static void ShowDSErrorString(IWin32Window owner, int x)
        {
            int sevLen  = 0;
            int facLen  = 0;
            int descLen = 0;

            byte[] sevBuf  = null;
            byte[] facBuf  = null;
            byte[] descBuf = null;

            sevLen  = PXCV_Lib36.PXCV_Err_FormatSeverity(x, sevBuf, 0);
            facLen  = PXCV_Lib36.PXCV_Err_FormatFacility(x, facBuf, 0);
            descLen = PXCV_Lib36.PXCV_Err_FormatErrorCode(x, descBuf, 0);

            sevBuf  = new byte[sevLen];
            facBuf  = new byte[facLen];
            descBuf = new byte[descLen];

            string s = "";

            if (PXCV_Lib36.PXCV_Err_FormatSeverity(x, sevBuf, sevLen) > 0)
            {
                s = PXCV_Helper.BytesToString(sevBuf, sevLen);
            }
            s += " [";
            if (PXCV_Lib36.PXCV_Err_FormatFacility(x, facBuf, facLen) > 0)
            {
                s += PXCV_Helper.BytesToString(facBuf, facLen);
            }
            s += "]: ";
            if (PXCV_Lib36.PXCV_Err_FormatErrorCode(x, descBuf, descLen) > 0)
            {
                s += PXCV_Helper.BytesToString(descBuf, descLen);
            }
            MessageBox.Show(owner, s, "PXCV36 Demo");
        }