Solved

Saving Object as System.IO.Stream

Posted on 2012-12-21
3
426 Views
Last Modified: 2012-12-21
Hi,

I am having issues converting my PDF object into a Byte() to print. I have a object called myPDF that has the following method definition:

myPDF.SaveMergedPDFToStream(outPDFStream AS System.IO.Stream)

My print routine has the following definition:

myPrinter.SendBytesToPrinter(Bytes() AS Byte)


I can make it work saving the file to disk and then reading it back in...but that seems pointless.

Thanks,
Brian
0
Comment
Question by:bbrian51
[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
3 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38713575
You can use Read method of stream to convert stream to byte array

http://msdn.microsoft.com/en-us/library/system.io.stream.read.aspx
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 38713579
Why not use a MemoryStream? It inherits from the Stream class. You would need to ensure the Position property is set to zero, then simply call the ToArray method to get the bytes within the stream.
0
 

Author Closing Comment

by:bbrian51
ID: 38713607
Thanks
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

733 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