Horizontal scrolling for pdf viewer

1,119 views
Skip to first unread message

Maninder Singh

unread,
Apr 6, 2014, 1:41:33 PM4/6/14
to pdfne...@googlegroups.com
Question 1))
I am working on android pdf viewer using online url. How to add horizontal view feature to the pdf viewer? Default view action is vertical.

Question 2))
How to get downloaded PDF url? I dont want user to download the same pdf again. I think, I used that url as a cache url.

mPDFViewCtrl.openURL(fileUrl, null, null, null);

mPDFViewCtrl.setDocumentDownloadListener(new PDFViewCtrl.DocumentDownloadListener() {

@Override
public void onDownloadEvent(int type, int page_num, int page_downloaded, int page_count, java.lang.String message) {
// TODO Auto-generated method stub
if(type == PDFViewCtrl.DOWNLOAD_FINISHED){
//or to hide it
setProgressBarIndeterminateVisibility(false);
}else if(type == PDFViewCtrl.DOWNLOAD_FAILED){
//or to hide it
setProgressBarIndeterminateVisibility(false);
Toast.makeText(PdfViewActivity.this, message, Toast.LENGTH_SHORT).show();
}
}
});

Anderson Konzen

unread,
Apr 7, 2014, 8:08:25 PM4/7/14
to pdfne...@googlegroups.com
Hi,

Question 1:
You can use PDFViewCtrl.setPagePresentationMode(PDFViewCtrl.PAGE_PRESENTATION_SINGLE) to change the presentation mode to single mode (see http://www.pdftron.com/pdfnet/mobile/docs/Android/pdftron/PDF/PDFViewCtrl.html#setPagePresentationMode(int)). This mode let's you change pages by scrolling horizontally. If you want a "continuous" horizontal scrolling (just like single mode), currently this is not supported.

Question 2:
You can cache the downloaded document to a local file. You can pass a file path through the second parameter of openURL, for example, openURL(url, "/mnt/sdcard/download/file.pdf", "", null), and use the listener to see if the file was downloaded without errors. Next time you call openURL, you need to pass the same file you used before so PDFViewCtrl will check if they have the same size, etc, and use the cache instead. For every different URL you need to use a different cache file, or it will re-download the document.
Reply all
Reply to author
Forward
0 new messages