Solved

How to convert from byte[] to stream?

Posted on 2007-11-18
2
5,546 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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.

696 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