Windows Phone low end devices support

Q:

How can I configure PDFTron library to use less memory for low-end Windows Phone devices?

A:

There are a few places where you can control the amount of space the PDFViewCtrl can occupy. Note that the OS alone will use up a lot of memory just having content in a scroll viewer (which is what PDFViewCtrl is using under the hood).

pdftron.PDFNet.SetViewerCache tell the whole SDK how much space can be used to cache parsed content from PDF documents for quicker rendering. In PDFViewCtrlDemo, this is set in App.xaml.cs to 0, which means it’s not used at all. On low memory devices, if you want a cache at all, you probably should enable dish caching (setting the second parameter to true.

PDFViewCtrl.SetUpThumbnails controls how PDFNet stores thumbnails. Similar to SetViewerCache, I would recommend enabling disc caching (3rd boolean, using persistent cache) if you use any cache at all, otherwise it will store it all in memory. In the case of the PDFViewCtrlDemo, we are using thumbs and giving it 100MB to store stuff on disk, which should be fine. You can turn off thumbnails completely by using PDFViewCtrl.SetupThumbnails(false, false, false, 0, 0, 0);

The final option is PDFViewCtrl.SetRenderedContentCacheSize. This controls how much content the PDFViewCtrl will pre-render. Do note that this is in terms of MBs worth of image data. With content going inside the PDFViewCtrl, the operating system will cache some stuff in memory. This seems to be what goes wrong with the PDFViewCtrl demo on low memory devices.
Running our demo on the 512MB emulator, I found that passing 12 to PDFViewCtrl.SetRenderedContentCacheSize seems to make it work fine.

Both SetUpThumbnails and SetRenderedContentCacheSize are set in the constructor of MainPageViewModel.