android


PDFView on landscape


I am trying to open local Pdf file from Assest folder in android studio platform using [barteksc] library. I downloaded the library and managed to open the pdf file. However, when I orient the emulator to landscape mode the pdf width will not fit the screen. I googled the issue and the solution is to use the following piece of code.
Configurator.onRender(new OnRenderListener() {
#Override
public void onInitiallyRendered(int pages, float pageWidth, float pageHeight) {
pdfView.fitToWidth(); // optionally pass page number
}
});
But, I do not know how to implement this code. I wrote the following :
public class Pdf extends AppCompatActivity {
PDFView pdfview;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pdf);
pdfview=(PDFView)findViewById(R.id.pdfView);
pdfview.fromAsset("h.pdf").load();
PDFView.Configurator.onRender(new OnRenderListener() {
#Override
public void onInitiallyRendered(int pages, float pageWidth, float pageHeight) {
pdfview.fitToWidth(); // optionally pass page number
}
});
}
}
And I got this error ...
Non-static method 'onRender(com.github.barteksc.pdfviewer.listener.OnRenderListener)' cannot be referenced from a static context
Plese show me how can I fix this issue. Loads of thanks in advance for any help you may lend.

Related Links

Creating and Moving Shared Preference Method from Activity to Java
How to receive and save image shared from another application
Android Api 24 can't find sources
Android color status bar
Set theme for AppCompatButton programmatically
getting Out of memory on a 18662412-byte allocation error while load 15 image
Firebase Implementation freezes app while downloading data
Expandable GCM push `notification` from server side
How to put button on the bottom of Scrollview
How to fix “Failed to get UI hierarchy” issue while recording espresso test in android studio
Cannot Detect Alt-beacon in android
Initializing value to views in ActionBar Tab framents in android while onCreate of Tab Activity
Android Navigation Drawer Design Library on child activity bug
Firebase Datasnapshot returns null [duplicate]
Cannot use Android Crop image crop library in Android
How to sort SDCard image based on date in android

Categories

HOME
adal
api
paraview
webdriver
rsa
opendj
soa
google-apps
dojo
mips
vxml
3d-reconstruction
crystal-reports-2013
title
lanczos
discrete-mathematics
windows-ce
automatic-ref-counting
dynatrace
heat
standards
nim
simpleitk
asciidoctor-pdf
kendo-mobile
guzzle
pimcore
php-mysqlidb
exploit
custom-post-type
android-sharedpreferences
genexus-sd
constexpr
autodesk-designautomation
mockjax
left-join
sql-server-2000
database-comparison
turfjs
getpixel
carriage-return
installscript
reverse
getlasterror
salesforce-communities
timing
hackintosh
comparison-operators
stringtokenizer
vmware-fusion
apriori
ssrs-2014
http-request
apache-directory
phpdbg
httrack
robomongo
globalize
subnet
spring-data-couchbase
ngmaterial
boo
rxtx
angular2-testing
grails-plugin
autosar
hadoop-2.7.2
webjars
jclouds
createprocess
thread-sleep
ascii-art
linklabel
decimalformat
tfs-workitem
grgit
oracle-spatial
uvc
code-documentation
exceldatareader
primitive-types
crowd
rickshaw
formview
angular-carousel
parallel-testing
vsx
cfcache
syndicationfeed
multitasking
android-usb
gtm-oauth2
unit-of-work
beaker-testing
dopostback
appjs
wiimote
luabind
workflow-services
automationelement
cgbitmapcontextcreate
strsep
undefined-index
pagemethods
spread
httpcookie
blind
image-capture
great-circle

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App