Android Open Source - RadaeePDF-B4A P D F Crop Act






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.radaee.reader;
//  w w w  .j  a  v  a  2  s  .c o m
import com.radaee.pdf.*;
import com.radaee.util.SnatchView;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.OnChildClickListener;
import android.widget.Toast;

/**
 * test activity for PDFCrop
 * @author Radaee
 */
public class PDFCropAct extends Activity implements OnChildClickListener
{
  private Document m_doc = new Document();
  private PDFCrop m_vPDF = null;
  private SnatchView m_vFiles = null;
    /** Called when the activity is first created. */
  @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        Global.Init( this );
    m_vFiles = new SnatchView(this);
    m_vFiles.setOnChildClickListener(this);
    m_vFiles.start();
    m_vPDF = new PDFCrop(this);
    setContentView(m_vFiles);
    }
    protected void onDestroy()
    {
      if( m_vPDF != null )
        m_vPDF.close();
      Global.RemoveTmp();
      super.onDestroy();
    }
  public boolean onChildClick(ExpandableListView parent, View v,
      int groupPosition, int childPosition, long id)
  {
    String val = m_vFiles.getChildPath(groupPosition, childPosition);
    if( val != null )
    {
      m_doc.Close();
      //to open encrypted document, modify codes below:
      int ret = m_doc.Open(val, "");
      switch( ret )
      {
      case -1://need input password
        finish();
        break;
      case -2://unknown encryption
        finish();
        break;
      case -3://damaged or invalid format
        finish();
        break;
      case -10://access denied or invalid file path
        finish();
        break;
      case 0://succeeded, and continue
        break;
      default://unknown error
        finish();
        break;
      }
            String msg = "file name:" + val;
            msg += "\nversion:";
            msg += m_doc.GetMeta("ver");//PDF-1.X
            msg += "\npage count:";
            msg += String.format("%d", m_doc.GetPageCount());
            msg += "\n";
            msg += "\nTitle:";
            msg += m_doc.GetMeta("Title");
            msg += "\nAuthor:";
            msg += m_doc.GetMeta("Author");
            msg += "\nCreator:";
            msg += m_doc.GetMeta("Producer");
            msg += "\nProducer:";
            msg += m_doc.GetMeta("Creator");
            Toast toast = Toast.makeText(this, msg, Toast.LENGTH_LONG);
            toast.show();
            m_vPDF.open(m_doc);
            setContentView(m_vPDF);
    }
    return false;
  }
}




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