Solved

How to convert from byte[] to stream?

Posted on 2007-11-18
2
5,544 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video teaches users how to migrate an existing Wordpress website to a new domain.

839 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