Exemple #1
0
        public bool PrintPDF(string FilePath)
        {
            bool       result = false;
            CAcroApp   mApp;
            CAcroPDDoc pdDoc;
            CAcroAVDoc avDoc;

            //string szStr;
            //string szName;
            //int iNum = 0;

            //Initialize Acrobat by creating App object
            //Embed Interop T->F
            mApp = new AcroAppClass();

            //Show Acrobat
            //mApp.Show();

            //set AVDoc object
            avDoc = new AcroAVDocClass();
            //open the PDF
            if (avDoc.Open(FilePath, ""))
            {
                //set the pdDoc object and get some data
                pdDoc = (CAcroPDDoc)avDoc.GetPDDoc();
                //compose a message
                if (avDoc.PrintPages(0, pdDoc.GetNumPages() - 1, 0, 0, 0))
                {
                    result = true;
                }
                pdDoc.Close();
                mApp.CloseAllDocs();
                mApp.Exit();
            }
            return(result);
        }