0

以下に示すように、PDFファイルを含むWPFプロジェクトにフォルダーがあります。

ここに画像の説明を入力

ファイルにアクセスするにはどうすればよいですか?

私はこれを試しました:

 fileList.Add(new FileList() { FileName = "AngularJS Example", FilePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "//media/pdf/AngularJS-Example.pdf" });

また、これ:

            fileList.Add(new FileList() { FileName = "AngularJS Up And Running", FilePath = "Reader.AngularJS-Example.pdf" });

FilePath は文字列を期待する Foxit PDF Viewer メソッドに渡される文字列です。

this.axFoxitCtl1.OpenFile(filePath);

調整:

ファイル:

fileList.Add(new FileList() { FileName = "AngularJS Up And Running", FilePath = "Reader.AngularJS-Example.pdf" });

ビューアー:

public ViewerTemplate(string fileName)
        {
            InitializeComponent();
            var assembly = Assembly.GetExecutingAssembly();
            var resourceName = fileName;

            using (Stream stream = assembly.GetManifestResourceStream(resourceName))
            using (StreamReader reader = new StreamReader(stream))
            {
                string result = reader.ReadToEnd();
                this.axAcroPDF1.LoadFile(result);

            }
        }
4

0 に答える 0