[cairo] Embeding JPG in PDF

Pierre pierre.php at gmail.com
Tue Jan 9 06:43:50 PST 2007

Hello Behdad,

On 1/9/07, Behdad Esfahbod <behdad at behdad.org> wrote:

> My personal preference is to add just enough API to cairo-pdf.h that a
> toolkit like pdftk can /integrate/ with cairo, to produce more advanced
> PDF documents.  That's what we do for text: delegate to pangocairo.

This solution looks nicer to me. I like to think that image format
specific functions are out of the scope of cairo.

As far as I can see, cairo already supports XObject image and
dictionnary. It is relatively easy to embed image file using XObject
with a image subtype. The image type, dimensions, resolution, bpp and
the color space can be fetched from the image header.

Maybe cairo can expose an api to deal with XObject, or specifically
XObject/Image? Or provide a single cairo_pdf_add_image[_from_stream].

If there is a need for a cairo_pdf_add_image[_from_stream] function,
it is possible to add the header parsing functions in cairo without a
libjpeg dependency (or png).


More information about the cairo mailing list