Ich habe zwei Fragen 1) Annotation nicht funktionieren 2) ich online pdf wollen Dokumentonline lesen PDF-Datei MuPDF mit
Ich baue MuPDF über diesen Link http://mupdf.com/doc/how-to-build-mupdf-for-android
1) Ich bekomme Projekt mupdf lesen/platform/android Ich führe diese App Annotation Standard funktioniert gut, aber ich erstelle dieses Projekt zu Bibliotheksdatei, die sie speichern möchten, aber Annotation nicht speichern.
2) Es wird lokale Datei lesen, aber ich möchte auch Online-Datei lesen. mein Android-Code
pdf = (TextView) findViewById(R.id.pdf);
onPdf = (TextView) findViewById(R.id.onPdf);
pdf.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Uri uri = Uri.parse(path);
Intent intent = new Intent(context, MuPDFActivity.class);
intent.setAction(Intent.ACTION_VIEW);
intent.setData(uri);
startActivity(intent);
}
});
onPdf.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Uri uri = Uri.parse(netPath);
Intent intent = new Intent(context, MuPDFActivity.class);
intent.setAction(Intent.ACTION_VIEW);
intent.setData(uri);
startActivity(intent);
}
});
Modified MuPDFActivity - ich alle Datei zu ändern sind offen openBuffer Methode
private MuPDFCore openBuffer(byte buffer[]) {
System.out.println("Trying to open byte buffer");
try {
String magic = "";
core = new MuPDFCore(this, buffer, magic);
// New file: drop the old outline data
OutlineActivityData.set(null);
} catch (Exception e) {
System.out.println(e);
return null;
}
return core;
}
Mein Mainfest
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".PdfTestActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.artifex.mupdfdemo.MuPDFActivity"
android:label="@string/app_name"
android:theme="@style/AppBaseTheme" >
</activity>
<activity
android:name="com.artifex.mupdfdemo.OutlineActivity"
android:label="@string/outline_title"
android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name="com.artifex.mupdfdemo.PrintDialogActivity"
android:label="@string/print"
android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen" >
</activity>
</application>
Mein stacktrace
12-25 19:02:41.544: E/TAG(22925): /sample.pdf: open failed: ENOENT (No such file or directory)
12-25 19:02:41.544: E/tag(22925): file
12-25 19:02:41.546: I/System.out(22925): Trying to open /sample.pdf
12-25 19:02:41.549: D/dalvikvm(22925): Trying to load lib /mnt/asec/com.example.testnew-1/lib/libmupdf.so 0x41792e10
12-25 19:02:41.576: D/dalvikvm(22925): Added shared lib /mnt/asec/com.example.testnew-1/lib/libmupdf.so 0x41792e10
12-25 19:02:41.576: D/dalvikvm(22925): No JNI_OnLoad found in /mnt/asec/com.example.testnew-1/lib/libmupdf.so 0x41792e10, skipping init
12-25 19:02:41.577: I/libmupdf(22925): Opening document...
12-25 19:02:41.577: E/libmupdf(22925): error: cannot open /sample.pdf: No such file or directory
12-25 19:02:41.577: E/libmupdf(22925): error: cannot load document '/sample.pdf'
12-25 19:02:41.577: E/libmupdf(22925): error: Cannot open document: '/sample.pdf'
12-25 19:02:41.577: E/libmupdf(22925): Failed: Cannot open document: '/sample.pdf'
12-25 19:02:41.580: I/System.out(22925): java.lang.Exception: Cannot open file: /sample.pdf
Haben Sie dieses Problem lösen? –
ja ich löse es. – RDY
Versuchen Sie unter Antwort, die ich für dieses Modell getan habe – RDY