Esempio n. 1
0
 private void OpenPDFDocument(Windows.Storage.StorageFile file)
 {
     if (file != null)
     {
         IAsyncOperation <Windows.Storage.FileProperties.BasicProperties> file_property = file.GetBasicPropertiesAsync();
         Windows.Storage.FileProperties.BasicProperties properties = file_property.GetResults();
         m_SDKDocument = new FSDK_Document();
         int result = m_SDKDocument.OpenDocumentAsync(file, (int)properties.Size, null).GetResults();
         if (result != 0)
         {
             return;
         }
         m_PDFDoc.pointer = m_SDKDocument.m_hDoc.pointer;
         result           = LoadPage(m_iCurPageIndex);
         if (result != 0)
         {
             return;
         }
         m_dbScaleFator = (m_dbCommonFitWidthScale < m_dbCommonFitHeightScale) ? m_dbCommonFitWidthScale : m_dbCommonFitHeightScale;
         ShowPage();
     }
     else
     {
         //ShowErrorLog("Error: Fail to pick a valid PDF file.", ref new UICommandInvokedHandler(this, renderPage.ReturnCommandInvokedHandler));
         return;
     }
 }
Esempio n. 2
0
        public renderPage()
        {
            this.InitializeComponent();


            m_PDFFunction     = new Inherited_PDFFunction();
            m_SDKDocument     = new FSDK_Document();
            m_PDFDoc.pointer  = 0;
            m_iCurPageIndex   = 0;
            m_PDFPage.pointer = 0;
            m_fPageWidth      = 0.0f;
            m_fPageHeight     = 0.0f;

            m_iStartX          = 0;
            m_iStartY          = 0;
            m_iRenderAreaSizeX = 0;
            m_iRenderAreaSizeY = 0;
            m_iRotation        = 0;

            m_dbScaleDelta           = 0.05f;
            m_dbScaleFator           = 1.0f;
            m_dbCommonFitWidthScale  = 1.0f;
            m_dbCommonFitHeightScale = 1.0f;
            m_dbRotateFitWidthScale  = 1.0f;
            m_dbRotateFitHeightScale = 1.0f;

            m_bFitWidth  = false;
            m_bFitHeight = false;
        }
Esempio n. 3
0
        //bool[] annotLoadFlagList;
		
        public renderPage()
        {
            this.InitializeComponent();

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

            m_bReleaseLibrary = false;
            m_SDKDocument = null;

            m_PDFFunction = new Inherited_PDFFunction();

            //Initialize, otherwise no method of SDK can be used.
            int iRet = m_PDFFunction.FSDK_Initialize();
            if (0 != iRet)
            {
                return;
            }
            m_bReleaseLibrary = true;

            m_SDKDocument = new FSDK_Document();

            m_PDFDoc.pointer = 0;
            m_PDFPage.pointer = 0;

            //m_iCurPageIndex = 0;
            m_iPageCount = 0;
            m_fPageWidth = 0.0f;
            m_fPageHeight = 0.0f;

            m_iStartX = 0;
            m_iStartY = 0;
            m_iRenderAreaSizeX = 0;
            m_iRenderAreaSizeY = 0;
            m_iRotation = 0;

            m_dbScaleDelta = 0.25f;
            m_dbScaleFator = 1.0f;
            m_dbCommonFitWidthScale = 1.0f;
            m_dbCommonFitHeightScale = 1.0f;
            //m_dbRotateFitWidthScale = 1.0f;
            //m_dbRotateFitHeightScale = 1.0f;

            m_bFitWidth = false;
            m_bFitHeight = false;

            m_mousestate = false;

            firstVisibleIndex = 0;
            nextInvisibleIndex = 0;
            visiblePage = new Dictionary<int, pageInfo>();
            shadowHeight = 10;
			//totalPageNum = 0;

            selectPageStartIndex = -1;
            selectPageEndIndex = -1;
            selectCharStartIndex = -1;
            selectCharEndIndex = -1;

            rSelectPageStartIndex = -1;
            rSelectPageEndIndex = -1;
            rSelectCharStartIndex = -1;
            rSelectCharEndIndex = -1;

            selectBmpTemp = new byte[0];

            Windows.UI.Core.CoreWindow.GetForCurrentThread().KeyDown += RenderPage_KeyDown;
            Windows.UI.Core.CoreWindow.GetForCurrentThread().KeyUp += RenderPage_KeyUp;
            
            wordInfoList = new List<wordInfo>();
        }
Esempio n. 4
0
        //////////////////////////////////////////////////////////////// open pdf and load pdf and calculate pdf size and unload pdf      
        private async void OpenPDFDocument(Windows.Storage.StorageFile file)
        {
            if (file != null)
            {
                Windows.Storage.FileProperties.BasicProperties properties = await file.GetBasicPropertiesAsync();
                m_SDKDocument = new FSDK_Document();
                //Load PDF document
                int result = await m_SDKDocument.OpenDocumentAsync(file, (int)properties.Size);
                if(result != 0)
                {
                    return;
                }
                m_PDFDoc.pointer = m_SDKDocument.m_hDoc.pointer;
                m_iPageCount = m_PDFFunction.My_Doc_CountPages(m_PDFDoc);

                //import wordlist into struct
                string[] testStr = new string[WordNumber];
                testStr = Wordlist;
                wordInfo wInfo;
                for (int count = 0; count < testStr.Length; count++)
                {
                    bool[] testData = new bool[m_iPageCount];
                    for (int count1 = 0; count1 < testData.Length; count1++)
                    {
                        testData[count1] = false;
                    }
                    wInfo.word = testStr[count];
                    wInfo.annotFlag = testData;
                    wordInfoList.Add(wInfo);
                }

                //Load first two PDF page
                result = LoadPage(0);
                if(result != 0)
                {
                    return;
                }
                result = LoadPage(1);
                if (result != 0)
                {
                    return;
                }
                nextInvisibleIndex = 2;
                 
                //get page size and calculate suitable render size
                GetPageInfo();
                m_dbScaleFator = (m_dbCommonFitWidthScale < m_dbCommonFitHeightScale) ? m_dbCommonFitWidthScale : m_dbCommonFitHeightScale;
                CalcRenderSize();

                //Show PDF page to device.
                initPdfGrid(m_iPageCount);
                ShowPage();

                //initial preview page 
                preview_visiblePage = new Dictionary<int, PageHandle>();
                Preview_InitGrid();
            }
            return;

        }