Display And Embed PDF in the browser

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phoenie
    New Member
    • Mar 2008
    • 12

    Display And Embed PDF in the browser

    Coding in vb, framework .net 2.0, vs2005

    When an user want to click on to view the report which is in the .pdf format,
    I will be able to display the file and embed it in the browser.

    What codes should i include?
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    Well, if they have the proper reader installed, you can just link to the PDF. It will be displayed in the embedded PDF reader.

    Comment

    • phoenie
      New Member
      • Mar 2008
      • 12

      #3
      Originally posted by insertAlias
      Well, if they have the proper reader installed, you can just link to the PDF. It will be displayed in the embedded PDF reader.
      i am sorry...i cant catch what you mean...what is the "proper reader" u meant?
      can give some examples?

      well...i want to display the pdf file in browser, but not open the pdf file like using Adobe...example as link below:

      http://www.beansoftwar e.com/ASP.NET-Tutorials/PDF-View-Custom-Control.aspx

      but unfortunately i cannot run the program successfully...
      there have some problem on the library...

      thanx...

      Comment

      • Curtis Rutland
        Recognized Expert Specialist
        • Apr 2008
        • 3264

        #4
        Well, I meant Adobe Reader. Maybe somebody else knows more. Did you try to follow the tutorial you linked step by step?

        Comment

        • phoenie
          New Member
          • Mar 2008
          • 12

          #5
          Originally posted by insertAlias
          Well, I meant Adobe Reader. Maybe somebody else knows more. Did you try to follow the tutorial you linked step by step?
          Yes...i do follow the tutorial step by step, debug it line by line...
          that why only figure out the ShowPDF.dll is refer to the C:\\Scott.....

          By the way...
          I've tried other method...
          When i try to add the reference named acrobat.dll in my project
          but my toolbox do not appear its components...
          do you have any idea what going wrong?

          Comment

          • Curtis Rutland
            Recognized Expert Specialist
            • Apr 2008
            • 3264

            #6
            I don't have access to my test PC right now (stuck on my mac right now) but check in tomorrow, I should be able to help once I get my PC set up again.

            The general idea is that you don't need to add a reference, you need to right click in the toolbox and choose components, and look through the COM objects to find Adobe Reader.

            Comment

            • phoenie
              New Member
              • Mar 2008
              • 12

              #7
              Originally posted by insertAlias
              I don't have access to my test PC right now (stuck on my mac right now) but check in tomorrow, I should be able to help once I get my PC set up again.

              The general idea is that you don't need to add a reference, you need to right click in the toolbox and choose components, and look through the COM objects to find Adobe Reader.
              Really million thanx for your help....

              I've tried "dig through" the toolbox,
              still cant find any components for AdobeReader

              Comment

              • DrBunchman
                Recognized Expert Contributor
                • Jan 2008
                • 979

                #8
                Not sure if I'm missing the point here but if the client machine has at least got Adobe Reader installed then you can use the <iframe/> tag to embed a pdf can't you?
                Code:
                <iframe src="PDFDirectory/Test.pdf"></iframe>
                Just set up PDFDirectory as a virtual directory in your IIS and you should be able to point to it as above.

                Hope this helps,

                Dr B

                Comment

                • phoenie
                  New Member
                  • Mar 2008
                  • 12

                  #9
                  Originally posted by DrBunchman
                  Not sure if I'm missing the point here but if the client machine has at least got Adobe Reader installed then you can use the <iframe/> tag to embed a pdf can't you?
                  Code:
                  <iframe src="PDFDirectory/Test.pdf"></iframe>
                  Just set up PDFDirectory as a virtual directory in your IIS and you should be able to point to it as above.

                  Hope this helps,

                  Dr B
                  thanx for your input...
                  But now I do not have virtual directory yet...
                  So what should I do?
                  (I am sorry...I am a newbie..so may be lot easy question cant understand by me)

                  Comment

                  • DrBunchman
                    Recognized Expert Contributor
                    • Jan 2008
                    • 979

                    #10
                    Sorry phoenie, ignore the part about virtual directories for now.

                    Just put the unc of the pdf into the src property of the iframe tag and it should embed. e.g.
                    Code:
                    <iframe src="\\servername\sharename\folder\test.pdf" height="100" width="200"></iframe>
                    Hope this helps,

                    Dr B

                    Comment

                    • phoenie
                      New Member
                      • Mar 2008
                      • 12

                      #11
                      Thanx again for your helping hand...

                      I've tried on your codes...
                      It really helped me...

                      now the next step I need to do is:
                      How to disable the print icon in the Adobe reader when displaying the .pdf file?

                      Comment

                      • Plater
                        Recognized Expert Expert
                        • Apr 2007
                        • 7872

                        #12
                        Originally posted by phoenie
                        How to disable the print icon in the Adobe reader when displaying the .pdf file?
                        The availablitiy of the print button in a pdf file is a security property in the PDF file itself. If you want the button disabled, you will need to generate the pdf with the correct security settings.
                        You should take note though that just because you set that security feature, does not mean that pdf readers have to abide by it.

                        Comment

                        • DrBunchman
                          Recognized Expert Contributor
                          • Jan 2008
                          • 979

                          #13
                          As I mentioned in another thread recently, if you are concerned about people 'stealing' your pdf's then you should consider watermarking them or reducing the resolution so they are only suitable for previews.

                          Dr B

                          Comment

                          • phoenie
                            New Member
                            • Mar 2008
                            • 12

                            #14
                            Originally posted by Plater
                            The availablitiy of the print button in a pdf file is a security property in the PDF file itself. If you want the button disabled, you will need to generate the pdf with the correct security settings.
                            You should take note though that just because you set that security feature, does not mean that pdf readers have to abide by it.
                            what are the security features that I need to set?
                            thanx in advance

                            Comment

                            • phoenie
                              New Member
                              • Mar 2008
                              • 12

                              #15
                              Originally posted by DrBunchman
                              As I mentioned in another thread recently, if you are concerned about people 'stealing' your pdf's then you should consider watermarking them or reducing the resolution so they are only suitable for previews.

                              Dr B
                              Em...this requirement is request by the client...
                              The system need user to log in before using it...
                              then will keep track the log in id to see the user has the privillege to print it...
                              maybe we cant prevent from others to print down the document...
                              but at least can make a little control telling that user he/she does not has the right to print...

                              ya...i jz have another thinking...
                              convert the pdf file to TIFF file
                              since the file only has 2 types, TIFF and pdf
                              is it a good idea?possible?

                              Comment

                              Working...