MCPcopy Index your code
hub / github.com/wonday/react-native-pdf / drawPdf

Method drawPdf

android/src/main/java/org/wonday/pdf/PdfView.java:296–369  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

294 }
295
296 public void drawPdf() {
297 showLog(format("drawPdf path:%s %s", this.path, this.page));
298
299 if (this.path != null){
300
301 // set scale
302 this.setMinZoom(this.minScale);
303 this.setMaxZoom(this.maxScale);
304 this.setMidZoom((this.maxScale+this.minScale)/2);
305 Constants.Pinch.MINIMUM_ZOOM = this.minScale;
306 Constants.Pinch.MAXIMUM_ZOOM = this.maxScale;
307
308 Configurator configurator;
309
310 if (this.path.startsWith("content://")) {
311 ContentResolver contentResolver = getContext().getContentResolver();
312 InputStream inputStream = null;
313 Uri uri = Uri.parse(this.path);
314 try {
315 inputStream = contentResolver.openInputStream(uri);
316 } catch (FileNotFoundException e) {
317 throw new RuntimeException(e.getMessage());
318 }
319 configurator = this.fromStream(inputStream);
320 } else {
321 configurator = this.fromUri(getURI(this.path));
322 }
323
324 configurator.defaultPage(this.page-1)
325 .swipeHorizontal(this.horizontal)
326 .onPageChange(this)
327 .onLoad(this)
328 .onError(this)
329 .onDraw(this)
330 .onPageScroll(this)
331 .spacing(this.spacing)
332 .password(this.password)
333 .enableAntialiasing(this.enableAntialiasing)
334 .pageFitPolicy(this.fitPolicy)
335 .pageSnap(this.pageSnap)
336 .autoSpacing(this.autoSpacing)
337 .pageFling(this.pageFling)
338 .enableSwipe(!this.singlePage && this.scrollEnabled)
339 .enableDoubletap(!this.singlePage && this.enableDoubleTapZoom)
340 .enableAnnotationRendering(this.enableAnnotationRendering)
341 .linkHandler(this)
342 ;
343
344 if (enableRTL) {
345 try {
346 int pageCount = getPdfPageCount(new File(this.path));
347 int[] reversedPages = new int[pageCount];
348 for (int i=0; i<pageCount; i++) {
349 reversedPages[i] = pageCount-1 - i;
350 }
351 configurator.pages(reversedPages);
352 if(this.page != 1){
353 this.page = pageCount;

Callers 2

onAttachedToWindowMethod · 0.95

Calls 6

showLogMethod · 0.95
getURIMethod · 0.95
getPdfPageCountMethod · 0.95
setTouchesEnabledMethod · 0.95
onErrorMethod · 0.80
onTapMethod · 0.80

Tested by

no test coverage detected