By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,418 Members | 1,439 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,418 IT Pros & Developers. It's quick & easy.

How to copy binary data

P: n/a
Greetings;

I'm a (young) .NET developer and I have this problem: I'm building an
application (with C#) that creates PDF files. To display a JPEG image within
the PDF I need to copy the data from the JPEG file to the PDF (intended as a
text file); I've tryied with the FileStream class, but it won't work, maybe
bacause, somehow, the binary data "changed" during the read/write process.

Is there any method to copy the data without changing it?

Thank you very much in advance
Nov 16 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Alex,

Pdf are always difficult questions in this newsgroup. Did you already try it
ad Adobe.
When you know the basics, than it is mostly easy with C#.

Cor
Nov 16 '05 #2

P: n/a
Hi Alex,

Nothing changes the data in the FileStream unless you write to the stream.
There are methods in Framework 2 that will return all data in a file
without using the FileStream (although internally they may still use it),
like File.GetAllBytes etc, but I suspect the problem is in your code, not
in the FileStream.

--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #3

P: n/a
For this types of questions, my advice to you is try comp.text.pdf.

Knowing how to embed an image XObject into a PDF file requires that you have
significant knowledge on the PDF file format.
JPEG is special, this is the only format which can be directly embedded into
a PDF file, using DCT encoding.
Your XObject should look *something* like:
<</Type/XObject/Subtype/Image/Name/X16
/Width X
/Height X
/ColorSpace/DeviceRGB/Filter/DCTDecode/BitsPerComponent X
/Length X
/Decode[0.0 1.0 0.0 1.0 0.0 1.0]
stream
[BINARY IMAGE STREAM]
endstream
endobj

You will have to declare usage of images in the ResourceDict->ProcSet
attribute,
it should look like this:
/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"AlexCDM" <Al*****@discussions.microsoft.com> wrote in message
news:05**********************************@microsof t.com... Greetings;

I'm a (young) .NET developer and I have this problem: I'm building an
application (with C#) that creates PDF files. To display a JPEG image
within
the PDF I need to copy the data from the JPEG file to the PDF (intended as
a
text file); I've tryied with the FileStream class, but it won't work,
maybe
bacause, somehow, the binary data "changed" during the read/write process.

Is there any method to copy the data without changing it?

Thank you very much in advance

Nov 16 '05 #4

P: n/a
Dennis,

Where can I get the specification of the PDF file format?

Thanks,
Duy

"Dennis Myrén" <de****@oslokb.no> wrote in message
news:u1***************@TK2MSFTNGP14.phx.gbl...
For this types of questions, my advice to you is try comp.text.pdf.

Knowing how to embed an image XObject into a PDF file requires that you
have
significant knowledge on the PDF file format.
JPEG is special, this is the only format which can be directly embedded
into
a PDF file, using DCT encoding.
Your XObject should look *something* like:
<</Type/XObject/Subtype/Image/Name/X16
/Width X
/Height X
/ColorSpace/DeviceRGB/Filter/DCTDecode/BitsPerComponent X
/Length X
/Decode[0.0 1.0 0.0 1.0 0.0 1.0]
stream

[BINARY IMAGE STREAM]
endstream
endobj

You will have to declare usage of images in the ResourceDict->ProcSet
attribute,
it should look like this:
/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"AlexCDM" <Al*****@discussions.microsoft.com> wrote in message
news:05**********************************@microsof t.com...
Greetings;

I'm a (young) .NET developer and I have this problem: I'm building an
application (with C#) that creates PDF files. To display a JPEG image
within
the PDF I need to copy the data from the JPEG file to the PDF (intended
as a
text file); I've tryied with the FileStream class, but it won't work,
maybe
bacause, somehow, the binary data "changed" during the read/write
process.

Is there any method to copy the data without changing it?

Thank you very much in advance


Nov 16 '05 #5

P: n/a
Thank you all for the answers, I'll work on it.

(Dinh Duy Tran, I've found the pdf reference here

http://partners.adobe.com/public/dev...reference.html

)
Nov 16 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.