/// <summary>
        /// Load pdf file by stream
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        private bool LoadFileByStream(string fileName)
        {
            bool   isrmsProtect = true;
            Stream stream       = null;

            byte[] license         = null;
            string rmsUserPassword = string.Empty;


            if (rmsUserpEncrypt)
            {
                try
                {
                    //RMS化PDFファイルから、RMSライセンス情報と、暗号化された本文情報を分割する
                    //RMS署名情報から、RMSサーバー情報を抽出する
                    //RMSサーバーでの認証
                    //RMSサーバーからRMSライセンスの取得
                    license = SafeFileApiNativeMethods.IpcfGetSerializedLicenseFromFile(fileName);
                }
                catch (Exception ex)
                {
                    isrmsProtect = false;
                }
            }

            if (isrmsProtect && rmsUserpEncrypt)
            {
                try
                {
                    rmsUserPassword = GenerateRandom(32);

                    //RMSライセンスから、復号鍵の抽出
                    SafeInformationProtectionKeyHandle keyHandle = SafeNativeMethods.IpcGetKey(license, false, false, true, this);

                    //RMSライセンスから、権利リストの抽出
                    //Collection<UserRights> userRights = new Collection<UserRights>();
                    //userRights = SafeNativeMethods.IpcGetSerializedLicenseUserRightsList(license, keyHandle);

                    bool accessGranted = SafeNativeMethods.IpcAccessCheck(keyHandle, "VIEW");

                    //本文情報を復号鍵で、復号
                    tempFile = GenerateRandom(10);

                    //一時フォルダ作成 add kondo
                    System.IO.Directory.CreateDirectory(Path.GetTempPath() + @"PDFViewer\");

                    tempFile = Path.GetTempPath() + @"PDFViewer\" + tempFile;

                    Stream outPutRmsStream = new FileStream(tempFile, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
                    stream = new FileStream(fileName, FileMode.Open);
                    if (accessGranted)
                    {
                        SafeFileApiNativeMethods.IpcfDecryptFileStream(stream, fileName,
                                                                       SafeFileApiNativeMethods.DecryptFlags.IPCF_DF_FLAG_DEFAULT, false,
                                                                       false, false, this, ref outPutRmsStream);
                    }

                    outPutRmsStream.Close();
                    outPutRmsStream.Dispose();

                    PdfReader reader = new PdfReader(tempFile);
                    outPutStream = new FileStream(tempFile + ".tmp", FileMode.Create, FileAccess.ReadWrite, FileShare.None);
                    PdfEncryptor.Encrypt(reader, outPutStream, false, rmsUserPassword, "", 0);

                    rmsUserpEncrypt = false;
                    reader.Close();
                    reader.Dispose();
                    File.Delete(tempFile);
                }
                catch (InformationProtectionException ex)
                {
                    //DirectoryDelete MSIPC
                    DeleteDirectorySelect(true);

                    isrmsProtect = false;
                    MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK);
                }
                catch (Exception ex)
                {
                    isrmsProtect = false;
                }
            }


            try
            {
                if (isrmsProtect)
                {
                    pdfDoc.LoadPDF(tempFile + ".tmp");
                }
                else
                {
                    pdfDoc.LoadPDF(fileName);
                }
                if (stream != null)
                {
                    stream.Close();
                    stream.Dispose();
                }
                return(true);
            }
            catch (System.Security.SecurityException sex)
            {
                if (stream != null)
                {
                    stream.Close();
                    stream.Dispose();
                }

                if (pdfDoc != null)
                {
                    pdfDoc.Dispose();
                    pdfDoc = null;
                }
                pdfDoc = new PDFWrapper();

                if (!rmsUserpEncrypt)
                {
                    pdfDoc.UserPassword = rmsUserPassword;
                }
                else
                {
                    String password = Interaction.InputBox("Please enter the document password:"******"Document Password", "");
                    if (password.Equals(string.Empty))
                    {
                        return(false);
                    }
                    pdfDoc.UserPassword = password;
                }

                return(LoadFileByStream(fileName));
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.ToString());
                return(false);
            }
        }