Solved

How to convert from byte[] to stream?

Posted on 2007-11-18
2
5,536 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
Comment Utility
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
Comment Utility
The following should work.
byte[] pdfBytes = myPdfConverter.GetPdfBytesFromHtmlString(output);

Stream StreamObject = new MemoryStream(pdfBytes);

pdfMerge.AppendPDFStream(StreamObject);

Open in new window

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

763 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

9 Experts available now in Live!

Get 1:1 Help Now