Search code examples
androidtransparentmupdf

Android transparent background for pdf using mupdf


I am using mupdf for rendering pdf in my android app. The issue that I'm facing is that even while reading a pdf with transparent background, it is showing white background. How can I rectify this error ? Any help will be appreciated.


Solution

  • For a pdf to have transparent background with MuPDF go to the C program file("mupdf.c") remove the code that sets the background to white and replace it with fz_clear_pixmap(ctx, pix);

    ie, replace fz_clear_pixmap_with_value(ctx, pix, 0xff); with fz_clear_pixmap(ctx, pix);

    after editing rebuild the ndk, and use it in your android app.