Skip to content

Commit

Permalink
Merge pull request #496 from alpha0010/patch-3
Browse files Browse the repository at this point in the history
Android: Fix `onLoadComplete()` page dimensions
  • Loading branch information
wonday authored Sep 23, 2020
2 parents f56b265 + d91acf1 commit 571273c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions android/src/main/java/org/wonday/pdf/PdfView.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import com.shockwave.pdfium.PdfDocument;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.shockwave.pdfium.util.SizeF;

public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompleteListener,OnErrorListener,OnTapListener,OnDrawListener,OnPageScrollListener, LinkHandler {
private ThemedReactContext context;
Expand Down Expand Up @@ -107,14 +108,14 @@ public void onPageChanged(int page, int numberOfPages) {

@Override
public void loadComplete(int numberOfPages) {

float width = this.getWidth();
float height = this.getHeight();
SizeF pageSize = getPageSize(0);
float width = pageSize.getWidth();
float height = pageSize.getHeight();

this.zoomTo(this.scale);
WritableMap event = Arguments.createMap();

//create a new jason Object for the TableofContents
//create a new json Object for the TableOfContents
Gson gson = new Gson();
event.putString("message", "loadComplete|"+numberOfPages+"|"+width+"|"+height+"|"+gson.toJson(this.getTableOfContents()));
ReactContext reactContext = (ReactContext)this.getContext();
Expand Down

0 comments on commit 571273c

Please sign in to comment.