Android Open Source - RadaeePDF-B4A R S P D F View






From Project

Back to project page RadaeePDF-B4A.

License

The source code is released under:

Apache License

If you think the Android project RadaeePDF-B4A listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.rootsoft.rspdfviewer.pdf;
/*from   w  ww  . j  av a 2  s .  co  m*/
import android.graphics.Canvas;
import android.view.MotionEvent;
import anywheresoftware.b4a.AbsObjectWrapper;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.objects.drawable.CanvasWrapper;

import com.radaee.pdf.Document;
import com.radaee.view.PDFVPage;
import com.radaee.view.PDFView;
import com.radaee.view.PDFView.PDFPos;
import com.radaee.view.PDFView.PDFViewListener;

@ShortName("PDFView")
public class RSPDFView extends AbsObjectWrapper<PDFView> {

  // Attributes
  private BA ba;
  private String eventName;

  // Constructors

  /**
   * Initializes the PDFView class.
   */
  public void Initialize(final BA ba, String EventName) {
    this.ba = ba;
    this.eventName = EventName.toLowerCase(BA.cul);
    setObject(new PDFView(BA.applicationContext));
  }

  // Methods

  public void Resize(int width, int height) {
    getObject().vResize(width, height);
  }

  public void ComputeScroll() {
    getObject().vComputeScroll();
  }

  public void Draw(CanvasWrapper canvas) {
    getObject().vDraw(canvas.canvas);
  }

  public void Open(Document doc, int page_gap, int back_color) {
    getObject().vOpen(doc, page_gap, back_color, pdfViewListener);
  }

  public void Close() {
    getObject().vClose();
  }

  public boolean TouchEvent(MotionEvent motionEvent) {
    return getObject().vTouchEvent(motionEvent);
  }

  public void GotoPage(int pageno) {
    getObject().vGotoPage(pageno);
  }

  public void Render(PDFVPage page) {
    getObject().vRender(page);
  }

  public void FindStart(String key, boolean match_case, boolean whole_word) {
    getObject().vFindStart(key, match_case, whole_word);
  }

  public int Find(int dir) {
    return getObject().vFind(dir);
  }

  public void FindEnd() {
    getObject().vFindEnd();
  }

  public void CenterPage(int pageno) {
    getObject().vCenterPage(pageno);
  }

  public void ClearSel() {
    getObject().vClearSel();
  }

  // Getters & Setters

  public int getX() {
    return getObject().vGetX();
  }

  public int getY() {
    return getObject().vGetY();
  }

  public int getWinW() {
    return getObject().vGetWinW();
  }

  public int getWinH() {
    return getObject().vGetWinH();
  }

  public void setBackColor(int color) {
    getObject().vSetBackColor(color);
  }

  public void setPageGap(int gap) {
    getObject().vSetPageGap(gap);
  }

  public PDFVPage getPage(int pageno) {
    return getObject().vGetPage(pageno);
  }

  public PDFPos getPos(int vx, int vy) {
    return getObject().vGetPos(vx, vy);
  }

  public void setPos(PDFPos pos, int vx, int vy) {
    getObject().vSetPos(pos, vx, vy);
  }

  public void setScale(float scale, float fx, float fy) {
    getObject().vSetScale(scale, fx, fy);
  }

  public float getScale() {
    return getObject().vGetScale();
  }

  public float getMinScale() {
    return getObject().vGetMinScale();
  }

  public float getMaxScale() {
    return getObject().vGetMaxScale();
  }

  public void setLock(int lock) {
    getObject().vSetLock(lock);
  }

  public int getLock() {
    return getObject().vGetLock();
  }

  public void setSelected(float x1, float y1, float x2, float y2) {
    getObject().vSetSel(x1, y1, x2, y2);
  }

  public String getSelected() {
    return getObject().vGetSel();
  }

  public void setSelectedStatus(boolean set) {
    getObject().vSetSelStatus(set);
  }

  public boolean setSelectedMarkup(int type) {
    return getObject().vSetSelMarkup(type);
  }

  // Callbacks
  PDFViewListener pdfViewListener = new PDFViewListener() {

    @Override
    public boolean OnPDFDoubleTapped(float x, float y) {
      boolean yesno = false;
      if (ba.subExists(eventName + "_pdfdoubletapped") == true) {
        (yesno) = (Boolean) ba.raiseEvent(this, eventName
            + "_pdfdoubletapped", new Object[] { x, y });
      }
      return yesno;
    }

    @Override
    public void OnPDFFound(boolean found) {
      if (ba.subExists(eventName + "_pdffound") == true) {
        ba.raiseEvent(this, eventName + "_pdffound",
            new Object[] { found });
      }

    }

    @Override
    public void OnPDFInvalidate(boolean post) {
      if (ba.subExists(eventName + "_pdfinvalidate") == true) {
        ba.raiseEvent(this, eventName + "_pdfinvalidate",
            new Object[] { post });
      }

    }

    @Override
    public void OnPDFLongPressed(float x, float y) {
      if (ba.subExists(eventName + "_pdflongpressed") == true) {
        ba.raiseEvent(this, eventName + "_pdflongpressed",
            new Object[] { x, y });
      }

    }

    @Override
    public void OnPDFPageDisplayed(Canvas canvas, PDFVPage page) {
      if (ba.subExists(eventName + "_pdfpagedisplayed") == true) {
        ba.raiseEvent(this, eventName + "_pdfpagedisplayed",
            new Object[] { canvas, page });
      }

    }

    @Override
    public void OnPDFPosChanged(PDFPos pos) {
      if (ba.subExists(eventName + "_pdfposchanged") == true) {
        ba.raiseEvent(this, eventName + "_pdfposchanged",
            new Object[] { pos });
      }

    }

    @Override
    public void OnPDFSelectEnd() {
      if (ba.subExists(eventName + "_pdfselectend") == true) {
        ba.raiseEvent(this, eventName + "_pdfselectend");
      }

    }

    @Override
    public void OnPDFSelecting(Canvas canvas, int[] arg1, int[] arg2) {
      if (ba.subExists(eventName + "_pdfselecting") == true) {
        ba.raiseEvent(this, eventName + "_pdfselecting", new Object[] {
            canvas, arg1, arg2 });
      }
    }

    @Override
    public void OnPDFShowPressed(float x, float y) {
      if (ba.subExists(eventName + "_pdfshowpressed") == true) {
        ba.raiseEvent(this, eventName + "_pdfshowpressed",
            new Object[] { x, y });
      }

    }

    @Override
    public boolean OnPDFSingleTapped(float x, float y) {
      boolean yesno = false;
      if (ba.subExists(eventName + "_pdfsingletapped") == true) {
        (yesno) = (Boolean) ba.raiseEvent(this, eventName
            + "_pdfsingletapped", new Object[] { x, y });
      }
      return yesno;
    }

  };
  
  @ShortName("PDFPos")
  public class RSPDFPos extends AbsObjectWrapper<PDFPos> {
    
    public int getPageNo() {
      return getObject().pageno;
    }
    
    public float getX() {
      return getObject().x;
    }
    
    public float getY() {
      return getObject().y;
    }
    
    
  }
  
  

}




Java Source Code List

com.example.pdfhttpdemo.MainActivity.java
com.example.pdfhttpdemo.ReaderController.java
com.radaee.pdf.BMDatabase.java
com.radaee.pdf.BMDatabase.java
com.radaee.pdf.BMDatabase.java
com.radaee.pdf.Document.java
com.radaee.pdf.Document.java
com.radaee.pdf.Document.java
com.radaee.pdf.Global.java
com.radaee.pdf.Global.java
com.radaee.pdf.Global.java
com.radaee.pdf.HWriting.java
com.radaee.pdf.HWriting.java
com.radaee.pdf.HWriting.java
com.radaee.pdf.Ink.java
com.radaee.pdf.Ink.java
com.radaee.pdf.Ink.java
com.radaee.pdf.Matrix.java
com.radaee.pdf.Matrix.java
com.radaee.pdf.Matrix.java
com.radaee.pdf.PDFHttpStream.java
com.radaee.pdf.PageContent.java
com.radaee.pdf.PageContent.java
com.radaee.pdf.PageContent.java
com.radaee.pdf.Page.java
com.radaee.pdf.Page.java
com.radaee.pdf.Page.java
com.radaee.pdf.Path.java
com.radaee.pdf.Path.java
com.radaee.pdf.Path.java
com.radaee.reader.PDFCropAct.java
com.radaee.reader.PDFCrop.java
com.radaee.reader.PDFEncAct.java
com.radaee.reader.PDFInkAct.java
com.radaee.reader.PDFInk.java
com.radaee.reader.PDFReaderAct.java
com.radaee.reader.PDFReaderOldAct.java
com.radaee.reader.PDFReaderOld.java
com.radaee.reader.PDFReader.java
com.radaee.reader.PDFSimpleAct.java
com.radaee.reader.PDFSimple.java
com.radaee.reader.PDFTestAct.java
com.radaee.reader.ReaderActivity.java
com.radaee.reader.ReaderController.java
com.radaee.reader.ReaderController.java
com.radaee.util.ComboListAdt.java
com.radaee.util.ComboList.java
com.radaee.util.PDFAESEnc.java
com.radaee.util.PDFAESEnc.java
com.radaee.util.PDFAESStream.java
com.radaee.util.PDFAESStream.java
com.radaee.util.PDFAssetStream.java
com.radaee.util.PDFAssetStream.java
com.radaee.util.PDFFileStream.java
com.radaee.util.PDFFileStream.java
com.radaee.util.PDFGridAdt.java
com.radaee.util.PDFGridItem.java
com.radaee.util.PDFGridThread.java
com.radaee.util.PDFGridView.java
com.radaee.util.PDFHttpStream.java
com.radaee.util.PDFHttpStream.java
com.radaee.util.PDFMemStream.java
com.radaee.util.PDFMemStream.java
com.radaee.util.PDFThumbView.java
com.radaee.util.SnatchAdt.java
com.radaee.util.SnatchView.java
com.rootsoft.pdfviewer.main.java
com.rootsoft.pdfviewer.readercontroller.java
com.rootsoft.rspdfviewer.pdf.RSPDFAnnotation.java
com.rootsoft.rspdfviewer.pdf.RSPDFBMDatabase.java
com.rootsoft.rspdfviewer.pdf.RSPDFDocument.java
com.rootsoft.rspdfviewer.pdf.RSPDFGlobal.java
com.rootsoft.rspdfviewer.pdf.RSPDFHWriting.java
com.rootsoft.rspdfviewer.pdf.RSPDFInk.java
com.rootsoft.rspdfviewer.pdf.RSPDFMatrix.java
com.rootsoft.rspdfviewer.pdf.RSPDFPageContent.java
com.rootsoft.rspdfviewer.pdf.RSPDFPage.java
com.rootsoft.rspdfviewer.pdf.RSPDFPath.java
com.rootsoft.rspdfviewer.pdf.RSPDFTemplate.java
com.rootsoft.rspdfviewer.pdf.RSPDFVPage.java
com.rootsoft.rspdfviewer.pdf.RSPDFViewCurl.java
com.rootsoft.rspdfviewer.pdf.RSPDFViewDual.java
com.rootsoft.rspdfviewer.pdf.RSPDFViewHorz.java
com.rootsoft.rspdfviewer.pdf.RSPDFViewThumb.java
com.rootsoft.rspdfviewer.pdf.RSPDFViewVert.java
com.rootsoft.rspdfviewer.pdf.RSPDFView.java
com.rootsoft.rspdfviewer.pdf.RSReaderView.java