473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Convert byte array to PDF without saving as a file

I have a Windows app created in VS2012. I'm calling a web service that is returning a pdf as a byte array. I want to convert the array back to a pdf and display it to the user without having to save it as a file first.
Nov 27 '12 #1
3 16806
Can you please put in the code you tried so far.

Thank you.
Nov 27 '12 #2
That's the problem. I haven't found many examples for a Windows form that I could test with. I did try this, but I'm missing whatever makes the document display.

Expand|Select|Wrap|Line Numbers
  1.  Dim arrPage() As Byte = Nothing
  2.  arrPage = pdfWS.RetrieveDocument(docID, docRefID)
  3.  
  4.  Dim ms As MemoryStream = New MemoryStream
  5.  ms.Write(arrPage, 0, arrPage.Length)
  6.  
Nov 28 '12 #3
!NoItAll
297 100+
Without adding a reference to a PDF reader of some sort then you are pretty much stuck with writing it to a file and then calling whatever PDF reader is installed on the machine.
The following code will write your byte array to a pdf document, then load it in the currently installed pdf reader (adobe reader).

Expand|Select|Wrap|Line Numbers
  1. My.Computer.FileSystem.WriteAllBytes("MyPDF.pdf", MyByteArray, False)
  2. System.Diagnostics.Process.Start("MyPDF.pdf")
  3.  
Otherwise you would need a PDF control (preferably a native .net one) with it's own methods for accepting a byte array directly from and into its own buffers.
That might be expensive. One like the following might work:

http://www.softpedia.com/get/Program...r-dotNET.shtml

But you need $299.00
Dec 1 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Gator | last post by:
Hi All, Basically my situation is this, I have a server implemented in C++, unmanaged code, using proprietery protocol over TCP/IP to communicate with the cilent(c++ also). Now, I am implementing...
5
by: Andrew Inwards | last post by:
Can anyone tell me how to convert a byte array to a stream.? Thanks Andrew
4
by: Dan | last post by:
I need to convert a byte array to a string in order to upload a binary file with an httpWebRequest. What's the most efficient way to do such a conversion?
2
by: Dave | last post by:
Hi, I'm trying to convert a byte array to string --This works... System.BitConverter.ToString(bytes) "EB-55-79-20-18-B2-76-4D-85-0A-93-6B-97-33-31-B8" --This doesn't, but returns...
5
by: Terry Olsen | last post by:
Looking for info on how to convert a byte array to a string, and string to byte array. Thanks.
14
by: Charles Law | last post by:
I thought this had come up before, but I now cannot find it. I have a byte array, such as Dim a() As Byte = {1, 2, 3, 4} I want to convert this to an Int32 = 01020304 (hex). If I use...
6
by: Mark Denardo | last post by:
My question is similar to one someone posted a few months back, but I don't see any replies. Basically I want to be able to have users upload photos and save them in a database (as byte data)...
18
by: MrVS | last post by:
Hi, I have a C++ CLR class method that takes System::Byte *b as parameter argument. I want the CSharp caller pass a byte * to this function. But in the CSharp prorgram, I only managed to create a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.