I would like to generate a PDF or RTF document using iTextSharp library that can be copied to the clipboard, using the same code I use to generate the document on a file (FileStream).
This way my application would give the user two options: generate to a file or to the clipboard.
Basically every iTextSharp document is attached to a
System.IO.Stream
.Usually we save the document to a file, using
FileStream
. To use the same code to paste the document in the Clipboard, we use aMemoryStream
instead.I only had problems with Images: It seems that iTextSharp exports images saving the bytes of the image after the
\bin
tag. Some libraries put the binary content encoded as hex characters. When I paste (from memory) in Word, the images won't appear, but if I load from a file, everything is OK. Any suggestions?