Mupdf没有显示pdf

时间:2019-02-22 08:46:54

标签: android android-ndk mupdf

使用最新的mupdf-source-1.14版本时,没有MuPDFCore或PDFViewer用于在android中显示pdf文件。按照新的源代码,我可以看到编译库并看到pdf页数等。但是我看不到任何显示pdf的视图。

有人集成了最新的mupdf库吗? 示例代码:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    LinearLayout linear = findViewById(R.id.linearMain);
    try {
        String[] filelistInSubfolder = getAssets().list("");
        System.out.println("Asset path "+filelistInSubfolder[0]);
        File file = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);

        for (int i=0;i<file.list().length;i++){
            System.out.println("jjjj "+file.list()[i]);
        }
        String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString()+"/sample (1).pdf";
        Log.e("PATH",path);
       // Context.init();
        //Document doc1= Document.openDocument(path);

        //doc.loadPage(1);
        //PDFDocument pp = new PDFDocument();
       // pp.path=path;
        //pp.loadPage(1);
        //PDFDocument.openNativeWithPath(path);

        Document doc = PDFDocument.openNativeWithPath(path);
        Page page = doc.loadPage(7);
        System.out.println("pagessss--->"+doc.countPages());
        System.out.println("pagessss--->"+doc.isPDF());
        }}

谢谢。

0 个答案:

没有答案