@@ -265,6 +265,12 @@ public class PDFView extends SurfaceView {
265
265
*/
266
266
private boolean bestQuality = false ;
267
267
268
+ /**
269
+ * True if annotations should be rendered
270
+ * False otherwise
271
+ */
272
+ private boolean annotationRendering = false ;
273
+
268
274
/**
269
275
* Storing already opened pages. Used form optimizing Pdfium calls
270
276
*/
@@ -677,7 +683,7 @@ private int loadPage(final int userPage, final int nbOfPartsLoadable) {
677
683
renderingAsyncTask .addRenderingTask (userPage , documentPage , //
678
684
(int ) (optimalPageWidth * Constants .THUMBNAIL_RATIO ), //
679
685
(int ) (optimalPageHeight * Constants .THUMBNAIL_RATIO ), //
680
- new RectF (0 , 0 , 1 , 1 ), true , 0 , bestQuality );
686
+ new RectF (0 , 0 , 1 , 1 ), true , 0 , bestQuality , annotationRendering );
681
687
}
682
688
683
689
// When we want to render a 256x256 bloc, we also need to provide
@@ -757,7 +763,7 @@ public boolean onLoop(int row, int col) {
757
763
// If not already in cache, register the rendering
758
764
// task for further execution.
759
765
renderingAsyncTask .addRenderingTask (userPage , documentPageFinal , //
760
- renderWidth , renderHeight , pageRelativeBounds , false , nbItemTreated , bestQuality );
766
+ renderWidth , renderHeight , pageRelativeBounds , false , nbItemTreated , bestQuality , annotationRendering );
761
767
}
762
768
763
769
}
@@ -1174,6 +1180,10 @@ public void useBestQuality(boolean bestQuality) {
1174
1180
this .bestQuality = bestQuality ;
1175
1181
}
1176
1182
1183
+ public void enableAnnotationRendering (boolean annotationRendering ) {
1184
+ this .annotationRendering = annotationRendering ;
1185
+ }
1186
+
1177
1187
public PdfDocument .Meta getDocumentMeta () {
1178
1188
if (pdfDocument == null ) {
1179
1189
return null ;
@@ -1254,6 +1264,8 @@ public class Configurator {
1254
1264
1255
1265
private boolean swipeVertical = false ;
1256
1266
1267
+ private boolean annotationRendering = false ;
1268
+
1257
1269
private int maskColor = Color .BLACK ;
1258
1270
1259
1271
private int maskAlpha = Constants .MASK_ALPHA ;
@@ -1280,6 +1292,11 @@ public Configurator enableDoubletap(boolean enableDoubletap) {
1280
1292
return this ;
1281
1293
}
1282
1294
1295
+ public Configurator enableAnnotationRendering (boolean annotationRendering ) {
1296
+ this .annotationRendering = annotationRendering ;
1297
+ return this ;
1298
+ }
1299
+
1283
1300
public Configurator onDraw (OnDrawListener onDrawListener ) {
1284
1301
this .onDrawListener = onDrawListener ;
1285
1302
return this ;
@@ -1335,6 +1352,7 @@ public void load() {
1335
1352
PDFView .this .setDefaultPage (defaultPage );
1336
1353
PDFView .this .setUserWantsMinimap (showMinimap );
1337
1354
PDFView .this .setSwipeVertical (swipeVertical );
1355
+ PDFView .this .enableAnnotationRendering (annotationRendering );
1338
1356
PDFView .this .dragPinchManager .setSwipeVertical (swipeVertical );
1339
1357
PDFView .this .maskPaint = new Paint ();
1340
1358
PDFView .this .maskPaint .setColor (maskColor );
0 commit comments