Hi everybody!
I urgently need your help, as I'm sticking to a very big problem (well,
for me):
I need some code for inserting bitmaps into a pdf file.
I'm already able to insert jpgs (which is not very hard once you found
the DCTDecode-Filter).
But now I'm not getting further. I want to use an XObject. But I always
get a graphics-error frm acrobat reader or the picture is absolutely
distorted. I think the problem is getting the right stream. Please
help!
Thanks in advance,
Stephie
|
|
0
|
|
|
|
Reply
|
Stephanie.Mueller (4)
|
10/12/2005 1:32:16 PM |
|
"Stephie" <Stephanie.Mueller@spe-siemens.de> wrote:
>Hi everybody!
>
>I urgently need your help, as I'm sticking to a very big problem (well,
>for me):
>
>I need some code for inserting bitmaps into a pdf file.
>I'm already able to insert jpgs (which is not very hard once you found
>the DCTDecode-Filter).
1. Parse the header to find the type of BMP (24-bit, 8-bit, 4-bit).
Watch out for recent extensions like JPEG-format BMP.
2. Assuming it is 24-bit, you now know you need an RGB color space,
and 8 bits per component. You will also know at what offset the pixel
data starts.
3. Convert the pixel data to the required format. If you study the BMP
specification carefully you will see that
(a) the order of bytes is different from PDF's bitmap format, and
(b) the rules for what to do at the end of a scan line (padding) are
different from PDF.
>
>But now I'm not getting further. I want to use an XObject. But I always
>get a graphics-error frm acrobat reader or the picture is absolutely
>distorted.
Sounds as if you aren't converting the pixel format, but just dumping
the original pixels from the BMP.
----------------------------------------
Aandi Inston quite@dial.pipex.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don't e-mail them.
|
|
0
|
|
|
|
Reply
|
quite
|
10/12/2005 2:12:49 PM
|
|
Stephie wrote:
> I need some code for inserting bitmaps into a pdf file.
Are these PDFs being created on-the fly using a program that you
wrote/maintain, as opposed to an off-the-shelf solution?
Can you read Perl?
I ask because I have Perl scripts that create PDFs on the fly, and
include scripts that read 24 bit BMPs and re-assemble the pixel
information into PDF usable format. I also have a script that converts
the pixel data into PDF usable RLE encoded pixel data. I may have
something you can use to develop an algorithm in whatever language you
are using.
|
|
0
|
|
|
|
Reply
|
Scott
|
10/12/2005 11:06:45 PM
|
|
thanks for your answer, but i do not really know how to parse the
header. i created the bitmap with vb6 savePicture() function. any idea
what colourdepth it creates?
Concerning converting the pixel format, i did that! i really think it
has something to do with the colourdepth.
any ideas welcome!
Stephie
|
|
0
|
|
|
|
Reply
|
Stephie
|
10/13/2005 7:26:04 AM
|
|
"Stephie" <Stephanie.Mueller@spe-siemens.de> wrote:
>thanks for your answer, but i do not really know how to parse the
>header. i created the bitmap with vb6 savePicture() function. any idea
>what colourdepth it creates?
Nope. That's why you have to parse the header.
Do you have the BMP format documentation? You need this in full
detail just as much as you need the PDF format documentation.
If you do, which part are you stuck on?
If not, perhaps we can help you find it.
>
>Concerning converting the pixel format, i did that! i really think it
>has something to do with the colourdepth.
Could be. 8- and 4-bit BMP files need to be processed differently.
Typically they become an Indexed color space in PDF.
----------------------------------------
Aandi Inston quite@dial.pipex.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don't e-mail them.
|
|
0
|
|
|
|
Reply
|
quite
|
10/13/2005 9:46:17 AM
|
|
I don't have that. and i couldn't find it at first go.
Do you have a link for me?
Actually we just tried to insert a bmp with the same function we use
for the jpgs and we got back the best result up to now. Just that the
picture was still distorted to the right...
But this cannot be the right way. Don't you have a little piece of code
(best in vb) I could have a look at, just to get an idea about the
whole thing?
Thanks,
Stephie
|
|
0
|
|
|
|
Reply
|
Stephie
|
10/13/2005 11:07:30 AM
|
|
"Stephie" <Stephanie.Mueller@spe-siemens.de> wrote:
>I don't have that. and i couldn't find it at first go.
>Do you have a link for me?
Start here
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_4v1h.asp
>
>Actually we just tried to insert a bmp with the same function we use
>for the jpgs and we got back the best result up to now. Just that the
>picture was still distorted to the right...
No, that cannot work properly. You are not transforming the pixel
order, for instance. You must take control of every single pixel in
the image, you cannot deal with this at a file level.
As a double check, to make sure your code is correct, you should
verify that the number of uncompressed bytes you write is EXACTLY
correct e.g. for DeviceRGB with BitsPerComponent 8, the number of bits
must be exactly width x height x 3.
Bitmap files are uncompressed, so it is fairly inefficient to insert
the raw pixel data. Better to use Flate compression.
>
>But this cannot be the right way. Don't you have a little piece of code
>(best in vb) I could have a look at, just to get an idea about the
>whole thing?
Sorry, I don't work that way.
----------------------------------------
Aandi Inston quite@dial.pipex.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don't e-mail them.
|
|
0
|
|
|
|
Reply
|
quite
|
10/13/2005 11:32:56 AM
|
|
I'm afraid you aren't helping me at all.
You always tell me to do something but you don't tell me how to do it.
:-[
Du bist echt ein krasser Vogel, immer so tun als ob du alles wei=DFt,
aber blo=DF keine Infos rausr=FCcken...ziemliches Kameradenschwein...aber
was soll ich mich aufregen, bringt ja doch nix.
Also dann,
Stephie
|
|
0
|
|
|
|
Reply
|
Stephie
|
10/13/2005 12:49:12 PM
|
|
"Stephie" <Stephanie.Mueller@spe-siemens.de> wrote:
>I'm afraid you aren't helping me at all.
>You always tell me to do something but you don't tell me how to do it.
>:-[
I have told you exactly what specification to read that has all of the
information that you need to write your program. This is a much
simpler specification than the PDF specification but you do have to
read and understand it all.
If you have any problem understanding this information please post
specific questions.
----------------------------------------
Aandi Inston quite@dial.pipex.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don't e-mail them.
|
|
0
|
|
|
|
Reply
|
quite
|
10/13/2005 1:10:34 PM
|
|
Hi Stephie
Stephie wrote:
[..]
> Du bist echt ein krasser Vogel, immer so tun als ob du alles wei�t,
> aber blo� keine Infos rausr�cken...ziemliches Kameradenschwein...aber
> was soll ich mich aufregen, bringt ja doch nix.
Sei froh, dass Aandi das (hoffentlich) nicht lesen kann -- er ist
Entwickler und "denkt" vielleicht nicht in End-User Kategorien wie du
(und/oder nicht in VB6 ...). Bevor du dich in einer englischsprachigen
Gruppe in deutsch �ber jemanden ausl�sst, begibst du dich besser in ein
deutsches Forum: de.comp.text.pdf
Aber dort wie hier gilt: Viele User verstehen das Usenet nicht als ein
Selbstbedienungsladen oder gratis-Support, sondern als Hilfe zur
Selbsthilfe.
Gruss
Robert
--
/"\ ASCII Ribbon Campaign | MS
\ / | MVP
X Against HTML | for
/ \ in e-mail & news | Word
|
|
0
|
|
|
|
Reply
|
Robert
|
10/13/2005 1:39:24 PM
|
|
|
9 Replies
714 Views
(page loaded in 1.638 seconds)
|