Solved

How to convert from byte[] to stream?

Posted on 2007-11-18
2
5,540 Views
Last Modified: 2013-12-17
I have this

byte[] pdfBytes = myPdfConverter.GetPdfBytesFromHtmlString(output);

which is a pdf content, and I want to do:

pdfMerge.AppendPDFStream(StreamObject);

How can I convert the pdfBytes into a stream object, so that the pdfMerge could append it.
0
Comment
Question by:jtcy
2 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 250 total points
ID: 20309670
use a MemoryString, something like:

MemoryStream ms = new MemoryStream(pdfBytes);
pdfMerge.AppendPDFStream(ms);
0
 
LVL 16

Assisted Solution

by:McExp
McExp earned 250 total points
ID: 20309671
The following should work.
byte[] pdfBytes = myPdfConverter.GetPdfBytesFromHtmlString(output);

Stream StreamObject = new MemoryStream(pdfBytes);

pdfMerge.AppendPDFStream(StreamObject);

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Loop not working 29 47
How can I build my own IDE using ASP.NET MVC? 2 31
consuming an asmx web service in winforms application 3 24
how to read json value 2 31
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now