How to copy binary data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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.
 
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][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]
 
Dennis,

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

Thanks,
Duy

Dennis Myrén said:
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][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 said:
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
 
Back
Top