[英]How to use the Radaee Pdf reader sdk
I am developing PDF reader application. 我正在开发PDF阅读器应用程序。 I am using Radaee PDF reader sdk.
我正在使用Radaee PDF阅读器sdk。 I am trying this sdk to open a PDF from the asset in android.
我正在尝试使用这个sdk从android中的资产打开PDF。 I need some help for this.
我需要一些帮助。 I am using some code like:
我使用的代码如下:
m_vFiles = new PDFGridView(this, null);
m_vFiles.PDFSetRootPath("/mnt");
m_vFiles.setOnItemClickListener(this);
setContentView(m_vFiles);
But it is taking the path of sd card and showing all the pdf file. 但它正在采用SD卡的路径并显示所有的pdf文件。
One user has used this sdk. 一位用户使用过这个sdk。 http://chat.stackoverflow.com/users/1503155/lazy-ninja
http://chat.stackoverflow.com/users/1503155/lazy-ninja
To open a pdf from assets using RadaeePDF
, you can do the following into your activity: 要使用
RadaeePDF
从资产打开pdf,您可以在以下活动中执行以下操作:
private PDFReader m_vPDF = null;
private Document doc = new Document();
private PDFAssetStream stream = new PDFAssetStream();
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
Global.Init(this);
m_vPDF = new PDFReader(this);
doc.Close();
stream.open(getAssets(), "test.pdf");
int ret = doc.OpenStream(stream, null);
//int ret = doc.Open("/sdcard/test1.pdf", null);
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;
}
m_vPDF.open(doc);
setContentView( m_vPDF );
}
There is another way to open a pdf from any external path 还有另一种方法可以从任何外部路径打开pdf
m_doc.Close();
int ret = m_doc.Open( book_path[string path of pdf], null );
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;
}
m_doc.SetCache( Global.tmp_path + "/temp.dat" );//set temporary cache for editing
System.out.println(">>>>>>>>path"+m_doc.GetPageCount());
m_reader.PDFOpen(m_doc, false, this);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.