Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2006

Tip: Looking for answers? Try searching our database.

Winform open WebService dime pdf attachment

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve - 25 Sep 2006 20:03 GMT
I have a C#.net windows form project that connects to a webservice that
returns a dime attachment (pdf document).  I need the winform to open and
load the pdf document into acrobat reader.  I do not want to write the file
to the hard drive to create a path so that I can call
System.Diagnostics.Process.Start("AcroRd32.exe", strFileName); if I do not
have too.

I have a web project with an aspx page that opens the file without writing
to a filepath.  I am looking for a similar solution in my winform.
Here is my web project aspx code:

System.IO.Stream objAtt = objResponseContext.Attachments[0].Stream;
byteContent = new Byte[objAtt.Length];
int len = objAtt.Read(byteContent, 0, (int)objAtt.Length);

Response.ContentType = "Application/pdf";
Response.BinaryWrite(byteContent);
Response.End();

The above code opens acrobat reader and loads the document.

I need some help finding a similar solutiion to the Response.ContnetType and
Response.BinaryWrite in windows forms.  I would like to open the byteContent
directly into Acrobat reader.  I am not sure how to do this.
Linda Liu [MSFT] - 26 Sep 2006 11:21 GMT
Hi Steve,

Firstly, I would say that in the sample web project you mentioned, when we
browse the aspx page that opens a pdf file, the pdf file is downloaded and
saved to the IE temporary folder on the client machine.

In Windows applications, we could lauch an exe file only using
System.Diagnostics.Process.Start method. It is not supported to pass an
argument of type byte array to this method.

What's more, since Acrobat Reader is a 3rd party product, Microsoft doesn't
provide some other ways to launch Acrobat Reader and open a pdf file in it
with a byte array.

In short, you should write the pdf file to the hard drive and then open it
in Acrobat Reader.

If you have any concerns, please feel free to let me know.


Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Steve - 29 Sep 2006 00:39 GMT
Linda,

Thank you for the update.

This confirms what we are currently doing in our windows forms projects.  I
just wanted to make sure that we did not miss something that was in the .net
architecture.

Thank you,
Steve

> Hi Steve,
>
[quoted text clipped - 21 lines]
> ==================================================
> Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> ications.
>
[quoted text clipped - 12 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.