开发者

Read the pdf content?

开发者 https://www.devze.com 2023-03-21 19:58 出处:网络
able to open the pdf files . but dont know how to save the content of the pdf file in a array or something then i can show the pdf as i want. can anybody suggest me how to save the pdf content...is th

able to open the pdf files . but dont know how to save the content of the pdf file in a array or something then i can show the pdf as i want. can anybody suggest me how to save the pdf content...is there any libraries to use?

following snippet shows how to open a pdf

            File file = new File("/sdcard/example1.pdf");

            if (file.exists()) {
                Uri path = Uri.fromFile(file);
                Log.e("path of the file",path.toString());
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setDataAndType(path, "application/pdf");
                intent.setFlag开发者_C百科s(Intent.FLAG_ACTIVITY_CLEAR_TOP);

                try {
                    startActivity(intent);
                } 
                catch (ActivityNotFoundException e) {
                    Toast.makeText(getApplicationContext(), 
                        "No Application Available to View PDF", 
                        Toast.LENGTH_SHORT).show();
                }
            }

Thanks


You should use iText library..

iText is a Java library originally created by Bruno Lowagie which allows to create PDF, read PDF and manipulate them

here is the link. http://www.vogella.de/articles/JavaPDF/article.html


Take a look at Mono for Android. It will enable you to develop for Android using C# and .NET and will let you install and access to the iTextSharp library

The iTextSharp is a very extensive and well documented library for creating and manipulating adobe pdf documents.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号