We need a pdf file inside the exe



  • Programme: opens a lecture, offers to pass a test at the end of the lecture. After the test, the results are out.

    The project is written in windows forms. Lecture pdf. Open the file with Adobe PDF Reader:

            string filePath = "C:\\Users\\q\\1.pdf";
            this.axAcroPDF1.LoadFile(filePath);
            this.axAcroPDF1.src = filePath;
            this.axAcroPDF1.setShowToolbar(false);
            this.axAcroPDF1.setView("FitH");
            this.axAcroPDF1.setLayoutMode("SinglePage");
            this.axAcroPDF1.Show();
    

    Problem: need pdf-Fyle to be in the project (inside) .exeto read it only in the program.



  • On the menu of the Project, select the paragraph of the War. Get the resources. In the resource designer ' s toolbox, indicate the addition of resources, lick the arrow, then add the existing file.

    However, it is likely that we will not maintain able to download from the strime (which was mentioned by Vlad) I mean...

    this.axAcroPDF1.src=WindowsFormsApplication1.Properties.Resources.1.pdf
    

    No way.♪ Then we'll have to do a hell's castle, keep somewhere in the speed through FileStream,

    File.WriteAllBytes("1.pdf", MyResources.1.pdf);
    

    And then open like a CD.

            string filePath = "1.pdf";
            this.axAcroPDF1.LoadFile(filePath);
            this.axAcroPDF1.src = filePath;
            this.axAcroPDF1.setShowToolbar(false);
            this.axAcroPDF1.setView("FitH");
            this.axAcroPDF1.setLayoutMode("SinglePage");
            this.axAcroPDF1.Show();
    

    After reading, clean the directory. ♪ ♪

    if(File.Exists(filePath))File.Delete(filePath);

    As always, I'm probably wrong and there's a better way. ♪ ♪




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2