Solved

Saving Object as System.IO.Stream

Posted on 2012-12-21
3
431 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

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