Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Dear all,
 
I am building a windows forms application where people can view PDF (preview).
I am successfully able to locate a file on the local computer and preview this in the PDF viewer control.
 
What I want to do is:
 
My file is located on an internet location which you can point to as:
http://localhost:2323/Documents/Document.pdf
 
I am aware that I can download the file and then preview it to the viewer control. I do not want to do this due to random files and number of files to be downloaded on local computer and for privacy reasons.
 
Can anyone suggest an idea that if I can reference the document to the PDF viewer control as the above path?
 
Also my other other question is:
 
This PDF viewer control works only if I put x86 in the build options for this windows forms application. I want it for any CPU.
 
Please help.
 
Thanks.
 
Regards,
Nayan
Posted 2-May-13 19:43pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I found that this is possible with PdfSharp. Please see:
http://www.pdfsharp.com/PDFsharp/[^],
http://pdfsharp.codeplex.com/[^].
 
Some code sample demonstrating a PDF viewer using this library and System.Windows.Forms can be found in Google Code:
http://reactivity.googlecode.com/svn/trunk/1.0/tools/PDF-2-JPEG/PDFsharp/PdfViewer/PdfViewer.Demo/PdfViewer.cs[^].
 
—SA
  Permalink  
Comments
Nayan Ambaliya at 3-May-13 2:01am
   
Thanks you very much...
Sergey Alexandrovich Kryukov at 3-May-13 10:40am
   
Sure. Will you accept the answer formally (green button)?
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Well, one way or another it has to be downloaded to be viewed. A program can't work with data it doesn't have. Every file you view in your web browser (e.g. images, video, documents) has to be downloaded to your machine first, the only difference is it goes somewhere temporary where it will be deleted when it's no longer needed.
 
That said, what you could do is have the user install a PDF viewer with an IE compatible plug-in (in the off chance they don't already have one), and display it via a Web Browser control instead, which should forward it to the PDF viewer plug-in. It doesn't seem very elegant to me, but it does work. The other option is to download it to a temporary file, use it as you normally would, then delete it when you're done.
  Permalink  
Comments
Nayan Ambaliya at 3-May-13 2:02am
   
Thank you very much...
But the web browser control has the limitation of 32 bit and 64 bit machines by its own...
I think I will have to download and delete it as done..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 431
1 Afzaal Ahmad Zeeshan 184
2 /\jmot 176
3 Sergey Alexandrovich Kryukov 175
4 Marcin Kozub 175
0 OriginalGriff 8,344
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,634
3 Maciej Los 5,024
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 3 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100