- Posts: 14
- Thank you received: 0
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
vZoomSet method chang the scale value I set
10 years 4 months ago #9837
by sekorm
Replied by sekorm on topic vZoomSet method chang the scale value I set
I've tested what you told me then ,
as the code I wrote to test below ( please check the attachment ):
I just want to fill full of the screen width with the pdf file by the its page width when the pdf file is rendered in landscape mode.
Evidently, I should calculate the scale rate using the formula : scaleRate = screenWidth/pageWidth (this result is between minScale and maxScale),
but after I set the result to the method m_view.vSetScale(screenWidth/pageWidth , 0, 0) ,
it scales larger than what I expected, the final pdf view had beyonded the screen width.
Were there any codes I wrote wrong ?
as the code I wrote to test below ( please check the attachment ):
I just want to fill full of the screen width with the pdf file by the its page width when the pdf file is rendered in landscape mode.
Evidently, I should calculate the scale rate using the formula : scaleRate = screenWidth/pageWidth (this result is between minScale and maxScale),
but after I set the result to the method m_view.vSetScale(screenWidth/pageWidth , 0, 0) ,
it scales larger than what I expected, the final pdf view had beyonded the screen width.
Were there any codes I wrote wrong ?
10 years 4 months ago #9839
by sekorm
Replied by sekorm on topic vZoomSet method chang the scale value I set
the code I Wrote:
// to get current page width
final float f1 = m_doc.GetPageWidth(m_pageno);
// the landscape mode screen width(720x1280 screen size)
final float f2 = m_view.vGetPage(m_pageno).ToPDFSize(1280f);
// MaxScale= 2.1639342, MinScale= 0.72131145
Log.d("pdf", "MaxScale= " + m_view.vGetMaxScale() + ", MinScale= " + m_view.vGetMinScale());
// f1= 1190.55, f2= 1774.5455, getScale= 0.72131145
Log.d("pdf", "f1= " + f1 + ", f2= " + f2 + ", getScale= " + m_view.vGetScale());
// f2/f1= 1.49052580
m_view.vSetScale((f2 / f1), 0, 0);
// to get current page width
final float f1 = m_doc.GetPageWidth(m_pageno);
// the landscape mode screen width(720x1280 screen size)
final float f2 = m_view.vGetPage(m_pageno).ToPDFSize(1280f);
// MaxScale= 2.1639342, MinScale= 0.72131145
Log.d("pdf", "MaxScale= " + m_view.vGetMaxScale() + ", MinScale= " + m_view.vGetMinScale());
// f1= 1190.55, f2= 1774.5455, getScale= 0.72131145
Log.d("pdf", "f1= " + f1 + ", f2= " + f2 + ", getScale= " + m_view.vGetScale());
// f2/f1= 1.49052580
m_view.vSetScale((f2 / f1), 0, 0);
10 years 4 months ago #9843
by Davide
Replied by Davide on topic vZoomSet method chang the scale value I set
Hi,
try to change this line:
with this:
try to change this line:
Code:
final float f2 = m_view.vGetPage(m_pageno).ToPDFSize(1280f);
Code:
final float f2 = m_view.vGetPage(m_pageno).GetWidth();
10 years 4 months ago #9849
by sekorm
Replied by sekorm on topic vZoomSet method chang the scale value I set
The issue still there,
I think it is not right to set the param f2 with value pageWidth, it should be set the value with screenWidth.
I think it is not right to set the param f2 with value pageWidth, it should be set the value with screenWidth.
10 years 4 months ago #9850
by sekorm
Replied by sekorm on topic vZoomSet method chang the scale value I set
the method m_view.vGetWinW() is in proper:
final float f2 = m_view.vGetWinW()
but here comes another issue , the method of m_view.vTouchEvent ususlly lead the APP to collapse when I try to zoom in or out.
final float f2 = m_view.vGetWinW()
but here comes another issue , the method of m_view.vTouchEvent ususlly lead the APP to collapse when I try to zoom in or out.
10 years 4 months ago #9851
by sekorm
Replied by sekorm on topic vZoomSet method chang the scale value I set
One more issue:
If I invoked m_view.vSetScale method once, it did do the right thing as this method defined,
when I invoked it for the second time , it crashed the APP and exited.
You can have a try with the PDFReader project....
If I invoked m_view.vSetScale method once, it did do the right thing as this method defined,
when I invoked it for the second time , it crashed the APP and exited.
You can have a try with the PDFReader project....
Time to create page: 0.383 seconds