- Posts: 40
- Thank you received: 1
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Questions about Android development and PDF
Fit PDF to Screen in Landscape mode
- abhishekjaju
- Topic Author
- Offline
- Senior Member
-
Less
More
IP: 192.168.0.71
11 years 2 months ago #7713
by abhishekjaju
Fit PDF to Screen in Landscape mode was created by abhishekjaju
Hello Sir,
I am makeing application tablet compatible I am opening PDF in Default def_view = 3;
Then PDF view fits to the center But,I want fit the PDF to the tablet screen How can I achieve it.
I am makeing application tablet compatible I am opening PDF in Default def_view = 3;
Then PDF view fits to the center But,I want fit the PDF to the tablet screen How can I achieve it.
IP: 192.168.0.156
11 years 2 months ago #7714
by Davide
Replied by Davide on topic Fit PDF to Screen in Landscape mode
Hi,
check this: www.androidpdf.mobi/forum/Android-develo...screen?start=12#5023
check this: www.androidpdf.mobi/forum/Android-develo...screen?start=12#5023
- abhishekjaju
- Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 1
IP: 192.168.0.71
11 years 2 months ago #7717
by abhishekjaju
Replied by abhishekjaju on topic Fit PDF to Screen in Landscape mode
This is for vertical orientation.
I need to make it landscape or horizontal orientation.
I tried this code with landscape but the result is not the same.
I need to make it landscape or horizontal orientation.
I tried this code with landscape but the result is not the same.
IP: 192.168.0.156
11 years 2 months ago - 11 years 2 months ago #7718
by Davide
Replied by Davide on topic Fit PDF to Screen in Landscape mode
Hi,
try to modify this:
if ((max_w > max_h || ((Activity) context).getResources()
.getConfiguration().orientation == ((Activity) context)
.getResources().getConfiguration().ORIENTATION_LANDSCAPE)
&& (max_w > w || ((Activity) context).getResources()
.getConfiguration().orientation == ((Activity) context)
.getResources().getConfiguration().ORIENTATION_LANDSCAPE))
m_view.vSetScale(0, 0, 0);
else
m_view.vSetScale((m_view.vGetMaxScale() / 2), 0, 0);// fit page
with this:
if ((max_w > max_h || getResources().getConfiguration().orientation == getResources().getConfiguration().ORIENTATION_PORTRAIT)
&& (max_w > w || getResources().getConfiguration().orientation == getResources().getConfiguration().ORIENTATION_PORTRAIT))
m_view.vSetScale(0, 0, 0);
else
m_view.vSetScale((m_view.vGetMaxScale() / 2), 0, 0);// fit page with correct scale
Then You have to find a way to set the correct scale in m_view.vSetScale of the else condition!
try to modify this:
if ((max_w > max_h || ((Activity) context).getResources()
.getConfiguration().orientation == ((Activity) context)
.getResources().getConfiguration().ORIENTATION_LANDSCAPE)
&& (max_w > w || ((Activity) context).getResources()
.getConfiguration().orientation == ((Activity) context)
.getResources().getConfiguration().ORIENTATION_LANDSCAPE))
m_view.vSetScale(0, 0, 0);
else
m_view.vSetScale((m_view.vGetMaxScale() / 2), 0, 0);// fit page
with this:
if ((max_w > max_h || getResources().getConfiguration().orientation == getResources().getConfiguration().ORIENTATION_PORTRAIT)
&& (max_w > w || getResources().getConfiguration().orientation == getResources().getConfiguration().ORIENTATION_PORTRAIT))
m_view.vSetScale(0, 0, 0);
else
m_view.vSetScale((m_view.vGetMaxScale() / 2), 0, 0);// fit page with correct scale
Then You have to find a way to set the correct scale in m_view.vSetScale of the else condition!
Last edit: 11 years 2 months ago by poudel.
- abhishekjaju
- Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 1
IP: 192.168.0.71
11 years 2 months ago #7719
by abhishekjaju
Replied by abhishekjaju on topic Fit PDF to Screen in Landscape mode
Where do I modify this
IP: 192.168.0.156
11 years 2 months ago #7720
by Davide
Replied by Davide on topic Fit PDF to Screen in Landscape mode
In onSizeChanged void of PdfReader class.
Once you have edited the onSizeChanged like here www.androidpdf.mobi/forum/Android-develo...screen?start=12#5023
Once you have edited the onSizeChanged like here www.androidpdf.mobi/forum/Android-develo...screen?start=12#5023
Time to create page: 0.422 seconds