mupdf

Mupdf: how to reset the resolution of pdf view page PROPERLY when the CDialogEx(MFC) OnSize?


my pdf file is rendering in a CDialogEx(it's MFC Class),and what i want is to reset the resolution when the Dialog resized.....

I find a solution via the mupdf offical downloads site:first set the desired resolution with pdfapp_setresolution(...), then call pdfapp_reloadpage(...). This reaches my goal but not perfect, with this method the displaying dialog gets a conspicuous redrawing (first the background color, then recovered back normal)...

anybody have a better optimization? thanks


Solution

  • 1st. resize the pdfapp_t object according to the view_window size via API pdfapp_onresize()

    2nd. adjust the resolution of pdfapp_t object//#attentison# here the resolution needs some transformation on the basis of yr actual requirement, referencing the API pdfapp_autozoom() in pdfapp.c source file.

    3rd. show page via pdfapp_showpage()

    thats all :) maybe helpful to sb.

    PS:lesson is that referencing the official document or example in details first :)