Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF

TOPIC:

vZoomSet method chang the scale value I set 8 years 5 months ago #9837

  • sekorm
  • sekorm's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 14
  • Thank you received: 0
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 ?

Please Log in or Create an account to join the conversation.

vZoomSet method chang the scale value I set 8 years 5 months ago #9839

  • sekorm
  • sekorm's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 14
  • Thank you received: 0
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);

Please Log in or Create an account to join the conversation.

vZoomSet method chang the scale value I set 8 years 5 months ago #9843

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
try to change this line:
final float f2 = m_view.vGetPage(m_pageno).ToPDFSize(1280f);
with this:
final float f2 = m_view.vGetPage(m_pageno).GetWidth();

Please Log in or Create an account to join the conversation.

vZoomSet method chang the scale value I set 8 years 5 months ago #9849

  • sekorm
  • sekorm's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 14
  • Thank you received: 0
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.

Please Log in or Create an account to join the conversation.

vZoomSet method chang the scale value I set 8 years 5 months ago #9850

  • sekorm
  • sekorm's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 14
  • Thank you received: 0
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.

Please Log in or Create an account to join the conversation.

vZoomSet method chang the scale value I set 8 years 5 months ago #9851

  • sekorm
  • sekorm's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 14
  • Thank you received: 0
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....

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum