PDF-View - Show PDF files in your own app

Discussion in 'Old Libraries Archive' started by DonManfred, Jun 9, 2015.

  1. DonManfred

    DonManfred Expert Licensed User

    This is a wrapper for this github project.

    pdfView
    Version:
    0.85
    • pdfView
      Events:
      • onLayerDrawn (cv As Object, pageWidth As Float, pageHeight As Float, Page As Int)
      • onLoadComplete (Pages As Int)
      • onPageChanged (page As Int, pageCount As Int)
      Fields:
      • ba As BA
      Methods:
      • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
      • BringToFront
      • Initialize (EventName As String, pdffile As String, defaultPage As Int, showMiniMap As Boolean, enableSwipe As Boolean)
      • Invalidate
      • Invalidate2 (arg0 As Rect)
      • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
      • IsInitialized As Boolean
      • RemoveView
      • RequestFocus As Boolean
      • SendToBack
      • SetBackgroundImage (arg0 As Bitmap)
      • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
      • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
      • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
      • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
      • enableSwipe (enableSwipe As Boolean)
        Dis- or Enable SWIPE
      • isZooming As Boolean
      • jumpTo (page As Int)
        Go to the given page.
      • loadPages
        Load all the parts around the center of the screen,
        taking into account X and Y offsets, zoom level, and
        the current page displayed
      • loadpdf (pdffile As String, defaultPage As Int, showMiniMap As Boolean, enableSwipe As Boolean)
      • moveRelativeTo (dx As Float, dy As Float)
        Move relatively to the current position.
        dx: The X difference you want to apply.
        dy: The Y difference you want to apply.
      • moveTo (offsetX As Float, offsetY As Float)
        Move to the given X and Y offsets, but check them ahead of time
        to be sure not to go outside the the big strip.
        offsetX: The big strip X offset to use as the left border of the screen.
        offsetY: The big strip Y offset to use as the right border of the screen.
      • recycle
        Recycle the loaded PDF
      • resetZoom
      • resetZoomWithAnimation
      • toCurrentScale (size As Float) As Float
      • toRealScale (size As Float) As Float
      • zoomCenteredRelativeTo (dzoom As Float, pivot As PointF)
      • zoomCenteredTo (zoom As Float, pivot As PointF)
        Change the zoom level, relatively to a pivot point.
        It will call moveTo() to make sure the given point stays
        in the middle of the screen.
        zoom: The zoom level.
        pivot: The point on the screen that should stays.
      • zoomTo (zoom As Float)
        Change the zoom level
      Properties:
      • Background As Drawable
      • Color As Int [write only]
      • CurrentPage As Int [read only]
        Return the current page which is displayed
      • CurrentXOffset As Float [read only]
      • CurrentYOffset As Float [read only]
      • Enabled As Boolean
      • Height As Int
      • Left As Int
      • OptimalPageWidth As Float [read only]
      • PageCount As Int [read only]
        Return the PageCount
      • Tag As Object
      • Top As Int
      • Visible As Boolean
      • Width As Int
      • Zoom As Float [read only]


    The Library is tested with the following Android Versions/Devices but it should work with android 2.3+ too:
    - 5.1 (Lollipop) - my Galaxy Note 3 (rooted with Custom ROM)
    - 4.4.2 (KitKat) - my Galaxy TabPro 12,1
    - Samsung S3 mini - 4.1: ok
    - HTC desire(flashed up) - 3.2: ok
    - Nexus 6 : ok
    - Nexus 4 : ok
    Lemovo p780 : ok
    Motorola Moto G XT1032 : ok
    WIKO King : ok
    WIKO Cink : nok
    WiKO Slide : ok
    Sony Xperia : nok
    Rock V5 : OK
    Titan T1 : nok

    The Example you get when donating is the sourcecode of the following APK

    Due to the size of the Library and the example i put it on my Dropbox. DOWNLOAD HERE

    - You can download the Example APK here.
    - You can download the Example source here.

    You can see the Example on Appetize.IO too.

    [​IMG]


    The library is not free. You need to donate as low as 11€ to get the library.

    To donate for the Library you need to follow this steps:
    - Click on Donate-Button below
    - Please enter your forum-username in the comment-box in the payflow so that i can know who donated for the library! ;-)
    - Please be patient and give me 24h to process your payment and to send you the link to download the Library files.


    UPDATE 16th May 2016: The Library is now FREE

    [​IMG]
    [​IMG]
     
    Last edited: May 16, 2016
    carycai, hibrid0, GudEvil and 10 others like this.
  2. Ohanian

    Ohanian Active Member Licensed User

    Hi,

    Can you add a browse button to the example apk so i can check a non-English pdf?
    And if you add a custom encryption/decryption method to this lib it would be terrific.
     
  3. DonManfred

    DonManfred Expert Licensed User

    will do
    for what do you need this?
     
  4. Ohanian

    Ohanian Active Member Licensed User

    For selling books or any other pdf document, so the user pays the fee and downloads the encrypted pdf and view then pdf within our app.
     
  5. susu

    susu Well-Known Member Licensed User

    Does your lib support PDF file with password?
     
  6. DonManfred

    DonManfred Expert Licensed User

    No. See the Answer here.
     
  7. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    Hi.
    which library is good?(your library or b4apdfviewer)?
     
  8. DonManfred

    DonManfred Expert Licensed User

    Where can i download the other?
     
  9. Marco Nissen

    Marco Nissen Member Licensed User

    I tried to use the following line:
    Dim c As Canvas = cv

    I get this error:
    java.lang.ClassCastException: android.view.Surface$CompatibleCanvas cannot be cast to anywheresoftware.b4a.objects.drawable.CanvasWrapper

    Is there a possibility to use the canvas to draw a rect on top of the drawing area?
     
  10. DonManfred

    DonManfred Expert Licensed User

    yes, this seems to not work. i´ll remove the given parameter i think...
    I think no. I dont saw any method in the wrapped library with which you can draw your own things on the surface.
     
  11. Marco Nissen

    Marco Nissen Member Licensed User

    ok. do you have any other idea how to overlay a rect on the screen?
     
  12. DonManfred

    DonManfred Expert Licensed User

    you may put a tranparent panel over the view...
    but i dont know what about the touches.. You may need to not "eat" them to let the pdfview handle the touches

    I didn´t try this
     
  13. shashkiranr

    shashkiranr Active Member Licensed User

    Hi @DonManfred ,

    I installed the example apk. the library looks good but there is a lag while rendering the pages. if you zoom in or zoom out also you can see it. Is the problem with the pdf file or is there any way the rendering can be improved.

    Regards,
    SK
     
  14. DonManfred

    DonManfred Expert Licensed User

    Yes. It is a thread running the native .so method. The speed depends on your devicesspeed and the complexity of the pdf...
    I have no chance of make this faster. The vuDroid must be extended... But i dont think that the vuDroid is still maintained as the last download on the website is from 2011....
     
  15. scsjc

    scsjc Active Member Licensed User

    hello, i'm very interesting on your library, but i test on SAMSUNG GT-S6500 2.3.6 GINGERBREAD.BUMD1, and don't work.....
    that can't fix... ??? or don't have a solution for old machines ???
     
  16. DonManfred

    DonManfred Expert Licensed User

    I dont have such old devices. The lib should work from android 2.3 if i can trust the info here.
    Maybe it is another part of the example i wrote which does not work on your device. Sorry, i dont know.
     
  17. scsjc

    scsjc Active Member Licensed User

    ok, and the final cuestion, work with the version b4a 4.30 ???
    if is yes, i try.
    thanks.
     
  18. DonManfred

    DonManfred Expert Licensed User

    b4a 4.3 should be no problem i believe
     
  19. welu1805

    welu1805 Active Member Licensed User

    Hi DonManfred,

    I installed the Example APK on my Tablet Pearl Touchlet X10.quad.v2. It works good.

    Is it possible to have the pages of the pdf vertically and if yes, how can I get the entire height of all pages in pixels"?
     
  20. DonManfred

    DonManfred Expert Licensed User

    hmm... They are showed up vertically... the pdf-rendering-routine holds all pages in a horizontal viewstrip. This behaviour is given by the pdf-engine and i cannot change this.
     
Loading...