def add_image_to_pdf(id=0, compress=true)
@compress=compress
bitmap_data = get_bitmap_data_24
img_obj_no= 6 + id*3
bitmap_data=get_bitmap_data_24(id)
if(@compress)
begin
cl = Zlib::Deflate
rescue Exception
raise NameError
end
image_binary = Zlib::Deflate.deflate(bitmap_data,9)
compress_str = "/Filter /FlateDecode "
else
image_binary=bitmap_data
compress_str = ""
end
len = image_binary.length
width=@pages_data[id][:width].to_s
height=@pages_data[id][:height].to_s
pdf_image_str = img_obj_no.to_s+" 0 obj\n<<\n/Subtype /Image /ColorSpace /DeviceRGB /BitsPerComponent 8 /HDPI 72 /VDPI 72 "+ compress_str
pdf_image_str+= "/Width "+width+" /Height "+height+" /Length "
pdf_image_str+= len.to_s+" >>\nstream\n"
pdf_image_str+= image_binary+"endstream\nendobj\n"
return pdf_image_str
end