Is there a .Net PictureBox control that can show PDFs?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bradyounie
    New Member
    • Aug 2008
    • 20

    Is there a .Net PictureBox control that can show PDFs?

    I have an application that displays a user-supplied image as part of what the app does. I need to include a PDF as a supported image type.

    Is there a PictureBox or some control that can show PDFs? The AxAcroPDF COM control comes close, but I need to be able to access a page of the PDF as a Bitmap object, which I haven't been successful at with AxAcroPDF.
  • GaryTexmo
    Recognized Expert Top Contributor
    • Jul 2009
    • 1501

    #2
    I did a bit of searching and you can use a WebBrowser object to display a PDF file quite easily.

    As a test, I made a form and dropped down a WebBrowser object, then had a button get a file name, which I assumed would be a PDF file and put that to the Url of the web browser.

    Here's the code for the button... as you can see, it's actually pretty straightforward .

    Code:
            private void button1_Click(object sender, EventArgs e)
            {
                OpenFileDialog ofd = new OpenFileDialog();
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    webBrowser1.Url = new Uri(ofd.FileName);
                }
            }
    I hope that helps!

    Comment

    • vishal1082
      New Member
      • Apr 2009
      • 92

      #3
      Originally posted by GaryTexmo
      I did a bit of searching and you can use a WebBrowser object to display a PDF file quite easily.

      As a test, I made a form and dropped down a WebBrowser object, then had a button get a file name, which I assumed would be a PDF file and put that to the Url of the web browser.

      Here's the code for the button... as you can see, it's actually pretty straightforward .

      Code:
              private void button1_Click(object sender, EventArgs e)
              {
                  OpenFileDialog ofd = new OpenFileDialog();
                  if (ofd.ShowDialog() == DialogResult.OK)
                  {
                      webBrowser1.Url = new Uri(ofd.FileName);
                  }
              }
      I hope that helps!
      i think that would only work if the user have Acrobat reader installed on his comp since the web browser needs it..

      Comment

      • GaryTexmo
        Recognized Expert Top Contributor
        • Jul 2009
        • 1501

        #4
        Originally posted by vishal1082
        i think that would only work if the user have Acrobat reader installed on his comp since the web browser needs it..
        Oh, yes, I believe that's true as well. Thanks for pointing that out.

        Comment

        • bradyounie
          New Member
          • Aug 2008
          • 20

          #5
          Originally posted by vishal1082
          i think that would only work if the user have Acrobat reader installed on his comp since the web browser needs it..
          Ultimately, what I need is to get each page of the PDF as an image (like a Bitmap object) that I can then draw things on top of and print. Basically, my app will use a user-selected PDFs as a backdrop for other stuff that they place on the page.

          Comment

          • GaryTexmo
            Recognized Expert Top Contributor
            • Jul 2009
            • 1501

            #6
            Oh I see, sorry for misunderstandin g.

            I don't think there's anything in .NET to handle this... I found something that may help you, but I'm not sure. It uses some library to convert to a .tiff file, but that doesn't help you display a specific page.

            The home for technical questions and answers at Microsoft. Get started asking, answering, and browsing questions about products like .Net, Azure, or Teams.


            See the post by Ravi Bhatt. Sorry I couldn't help you.

            Comment

            • bradyounie
              New Member
              • Aug 2008
              • 20

              #7
              There seems to be a bunch of commercial solutions that would do what I want, but they're expensive, and I don't have the budget for that. I was hoping there'd be something on SourceForge, but no such luck.

              Thanks anyway.

              Comment

              • vishal1082
                New Member
                • Apr 2009
                • 92

                #8
                Originally posted by bradyounie
                There seems to be a bunch of commercial solutions that would do what I want, but they're expensive, and I don't have the budget for that. I was hoping there'd be something on SourceForge, but no such luck.

                Thanks anyway.
                i dont know i should "suggest" this on this forum, but you can try torrent to download those expensive commercial solutions, i know its illegel..but..y ou can try it if you really wanna do the job

                Comment

                • bradyounie
                  New Member
                  • Aug 2008
                  • 20

                  #9
                  Originally posted by vishal1082
                  i dont know i should "suggest" this on this forum, but you can try torrent to download those expensive commercial solutions, i know its illegel..but..y ou can try it if you really wanna do the job
                  Well, that's a good point. At least, it will let me see if the library does what I need it to do. If it does, then I can decide if it's worth the fee. This is for a commercial product, so if I do decide to use it, I will pay the fee.

                  Most of them have a trial version, so I might just go with that.

                  Comment

                  • cloud255
                    Recognized Expert Contributor
                    • Jun 2008
                    • 427

                    #10
                    Originally posted by vishal1082
                    i dont know i should "suggest" this on this forum, but you can try torrent to download those expensive commercial solutions, i know its illegel..but..y ou can try it if you really wanna do the job
                    No, you should not suggest such things. Many of the people at this forum are professional developers, which means we make a living by selling code.
                    If you are OK with downloading an illegal copy of any application you are also OK with having other people take your code for free. So if you create in-house solutions your employer is then entitled to not pay you a salary at the end of the month.

                    Yes many applications are way over-priced, but you do a bit of searching you will generally find an open source alternative or a trial version which you could use. These alternatives are often not as good as the expensive solutions but you get what you pay for.

                    You want to use a specific tool to help you create a larger solution, this is the same as a construction company just stealing the cement, building plans and required machinery to build a bridge.

                    My point is just, software is a part of the supply chain, just like any tangible product...

                    Comment

                    Working...