相关疑难解决方法(0)

在Android上使用Java渲染PDF文件

我意识到Android没有内置的显示PDF文件的方法.

如何在Android上使用Java渲染PDF文件?

java pdf android android-pdf-api

208
推荐指数
6
解决办法
24万
查看次数

android:使用内置的pdf查看器从我的应用程序打开一个pdf

这是我最初的问题:

我希望能够打开使用内置的PDF查看器应用程序的Android在我的应用程序PDF文件,但我不知道如何启动其他应用程序.我敢肯定,我要打电话开始的活动,我只是不知道如何识别应用IM开放以及如何将文件传递给特定的应用程序.

有人有线索吗?

我刚刚了解到我手机上的pdf查看器实际上是由HTC制作的,Adobe刚刚发布了他们的android pdf查看器(这很棒).因此,新的问题是:我如何验证用户已经安装了Adobe的浏览器,然后我如何打开该应用将文件从我的应用程序?

pdf android workflow-activity

29
推荐指数
3
解决办法
8万
查看次数

从assets文件夹中读取pdf文件

public void DOCS(View btnDocs)
{   
    File fileBrochure = new File("android.resource://com.project.datastructure/assets/abc.pdf");
    if (!fileBrochure.exists())
    {
         CopyAssetsbrochure();
    } 

    /** PDF reader code */
    File file = new File("android.resource://com.project.datastructure/assets/abc.pdf");        

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(file),"application/pdf");
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try 
    {
        getApplicationContext().startActivity(intent);
    } 
    catch (ActivityNotFoundException e) 
    {
         Toast.makeText(Stack_dr.this, "NO Pdf Viewer", Toast.LENGTH_SHORT).show();
    }
}
private void CopyAssetsbrochure() {
    AssetManager assetManager = getAssets();
    String[] files = null;
    try 
    {
        files = assetManager.list("");
    } 
    catch (IOException e){}
    for(int i=0; i<files.length; i++)
    {
        String fStr = files[i];
        if(fStr.equalsIgnoreCase("abc.pdf"))
        { …
Run Code Online (Sandbox Code Playgroud)

java android android-intent

24
推荐指数
3
解决办法
5万
查看次数

在Android应用中打开PDF

我正在开发一个需要在设备中打开pdf文件的应用程序,

我实际上在网上获得了与大多数示例类似的代码.但是,问题是我无法打开文件,控件直接进入"异常"部分.

以下是代码:

public class MyPDFDemo extends Activity 
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)   
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

    Button OpenPDF = (Button) findViewById(R.id.button);
    OpenPDF.setOnClickListener(new View.OnClickListener()
    { 
        public void onClick(View v) 
        {
            File pdfFile = new File("/sdcard/Determine_RGB_Codes_With_Powerpoint [PDF Library].pdf"); 
            if(pdfFile.exists()) 
            {
                Uri path = Uri.fromFile(pdfFile); 
                Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
                pdfIntent.setDataAndType(path, "application/pdf");
                pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

                try
                {
                    startActivity(pdfIntent);
                }
                catch(ActivityNotFoundException e)
                {
                    Toast.makeText(MyPDFDemo.this, "No Application available to view pdf", Toast.LENGTH_LONG).show(); 
                }
            }

        }
    });

} …
Run Code Online (Sandbox Code Playgroud)

pdf android

16
推荐指数
1
解决办法
4万
查看次数

Android-从PDF获取文本

我想从SD卡中的PDF文件中读取文本.如何从存储在SD卡中的PDF文件中获取文本?

我尝试过:

public class MainActivity extends ActionBarActivity implements TextToSpeech.OnInitListener {

    private TextToSpeech tts;
    private String line = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        tts = new TextToSpeech(getApplicationContext(), this);

        final TextView text1 = (TextView) findViewById(R.id.textView1);

        findViewById(R.id.button1).setOnClickListener(new OnClickListener() {

            private String[] arr;

            @Override
            public void onClick(View v) {
                File sdcard = Environment.getExternalStorageDirectory();

                // Get the text file

                File file = new File(sdcard, "test.pdf");

                // ob.pathh
                // Read text from file

                StringBuilder text = new StringBuilder();
                try {
                    BufferedReader br …
Run Code Online (Sandbox Code Playgroud)

pdf android

9
推荐指数
1
解决办法
8715
查看次数

没有GPL许可证的Android PDF Viewer Library

我正在寻找没有GPL许可证的Android版PDF查看器库,有没有人知道是否有任何可用的免费许可证库?

因为我一直在漫游,并发现一些开源库,如MuPDF,Android PDF Viewer,DroidReader正在使用GPL许可证,我不能用于我即将开发的商业应用程序.

不,我也不想使用谷歌文档选项;-)

pdf android

7
推荐指数
2
解决办法
9760
查看次数

如何在Android中打开PDF

如何从服务器打开pdf文件而不将其保存在设备上而不使用任何第三方应用程序.因为我不希望我的用户下载任何应用程序来使用我的apps.And我不想使用Web视图打开pdf文件.

android

6
推荐指数
2
解决办法
3万
查看次数

在应用程序中打开资产文件pdf

我已经搜索过,没有在应用程序中找到show pdf文件的任何解决方案

关键是我必须显示资产或原始文件夹中的pdf而不是来自网络

我已经在webview中尝试了代码

    WebView webview = (WebView) findViewById(R.id.webview);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.setContentDescription("application/pdf");
    webview.loadUrl("file:///android_asset/button11.pdf");
Run Code Online (Sandbox Code Playgroud)

但它不是在开玩笑.

我需要提前帮助

pdf android

5
推荐指数
1
解决办法
1万
查看次数

离线时在 webview 中加载 pdf

如何将 PDF 嵌入 HTML 并在 Web 视图中显示?其实我正在尝试这个但是webview没有加载这个页面。

    String base = Environment.getExternalStorageDirectory().getAbsolutePath().toString();
            String pdfPath = base + "/Principal.pdf";
             Log.e("real path =", ""+pdfPath);
            web.getSettings().setJavaScriptEnabled(true);
            web.getSettings().setAllowFileAccess(true);
            web.getSettings().setBuiltInZoomControls(true);
            web.loadDataWithBaseURL("", 
                    "<embed src='"+pdfPath+"' width='500' height='375'>",
                    "application/pdf",
                    "utf-8",
                    "");
Run Code Online (Sandbox Code Playgroud)

pdf android webview

5
推荐指数
1
解决办法
2879
查看次数

如何渲染带有可点击链接的pdf?

我使用 PdfRenderer 类来渲染 pdf。但是,问题是,在这种方法中,我无法使文档中的超链接可单击。

有没有更好的方法在android应用程序中渲染pdf?

我知道将 webview 与 google docs 一起使用,但我希望该应用程序能够离线工作,因此此解决方案不适合。

pdf android

5
推荐指数
1
解决办法
1232
查看次数