How to set an image as background of an annotation in MuPDF?

257 views Asked by At

I want to set an image as background of an annotation in MuPDF using following code:

fz_context *ctx = doc->ctx;
const fz_matrix *page_ctm = &annot->page->ctm;
image_document *image_doc = (image_document *)fz_open_document(ctx, "/Users/zidane/Downloads/a.jpg");

fz_image *image = image_doc->image;
fz_matrix local_ctm = *page_ctm;

float w = image->w * DPI / image->xres;
float h = image->h * DPI / image->yres;

fz_pre_scale(&local_ctm, w, h);
fz_pre_translate(&local_ctm, 0, -1);
fz_fill_image(dev, image, &local_ctm, 1);

Can someone tell me why it does not work?

0

There are 0 answers