- Posts: 17
- Thank you received: 0
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Questions about Android development and PDF
Get all URI annotation at open become in SIGSEV
10 years 7 months ago #9533
by gabmor
Get all URI annotation at open become in SIGSEV was created by gabmor
Hi I'm trying to get all annotation that have URI to download the files in there, but I get fatal SIGSEV error sometimes, this is what I'm doing after open the document in onCreate.
Can someone help me and tell whats wrong?
Can someone help me and tell whats wrong?
Code:
class CheckURLInDocument extends AsyncTask<Void,Void,String>{
private ArrayList<FileDownload>urlDownload;
private Context context;
public CheckURLInDocument(Context context){
this.context=context;
}
@Override
protected String doInBackground(Void... params) {
try{
urlDownload=new ArrayList<FileDownload>();
Book book = Session.currentBook;
String path = Session.basePath;
int total = m_doc.GetPageCount();
attachments = new ArrayList<Attachment> ();
for (int i = 0; i < total; i++) {
Page page = m_doc.GetPage (i);
page.ObjsStart();
int annots = page.GetAnnotCount();
for (int j = 0; j < annots; j++) {
Page.Annotation annotation = page.GetAnnot(j);
if (annotation.GetURI() != null && annotation.GetURI() != "") {
if (annotation.GetURI().contains(".mp3")) {
File file = new File(path, annotation.GetURI());
if (!file.exists()) {
urlDownload.add(
new FileDownload(file,
URLEncoder.encode(book.getDesc(), "utf-8") + "/AUDIOS/" + annotation.GetURI(),
"Audio: " + annotation.GetURI()));
}
}
if (annotation.GetURI().contains(".mp4")) {
String[] names = annotation.GetURI().split("\\|");
Attachment a = new Attachment();
a.setPage(i);
a.setTitle(names[1]);
a.setName(names[0]);
attachments.add(a);
File file = new File(path, names[0]);
if (!file.exists()) {
urlDownload.add(new FileDownload(
file,
URLEncoder.encode(book.getDesclibro(), "utf-8") + "/VIDEOS/" + names[0],
"Video: " + names[1]));
}
}
}
annotation=null;
}
if(page!=null)
page.Close();
page=null;
}
}catch(Exception ex) {
ex.printStackTrace();
}
String res=downloadFiles();
return res;
}
@Override
protected void onPostExecute(String aVoid) {
super.onPostExecute(aVoid);
mAdapterAttachments=new AdapterAttachment(getApplicationContext(),attachments);
mListAttachments.setAdapter(mAdapterAttachments);
Toast.makeText(context,aVoid,Toast.LENGTH_SHORT);
}
public String downloadFiles(){
String url="http://.../../..";
String url2="http://.../../..";
String shortURL="http://....";
String shortURL2="http://....";
String res="";
String mURL=null;
if(Util.isConnectedToServer(shortURL2)){
mURL=url2;
}else{
if(Util.isConnectedToServer(shortURL)) {
mURL = url;
}
}
if(mURL!=null){
String servicestring = Context.DOWNLOAD_SERVICE;
downloadmanager = (DownloadManager) context.getSystemService(servicestring);
for(int i=0;i<urlDownload.size();i++){
FileDownload myFile=urlDownload.get(i);
String filename=myFile.getUrl();
File finalPath=myFile.getFinalPath();
Uri uri = Uri
.parse(mURL + filename.replaceAll("\\+", "%20"));
DownloadManager.Request request = new DownloadManager.Request(uri);
request.setVisibleInDownloadsUi(true);
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
request.setTitle(myFile.getName());
request.setDescription("Downloading Resource "+filename);
request.setDestinationUri(Uri.fromFile(finalPath));
downloadmanager.enqueue(request);
}
urlDownload=null;
res="Downloading Resources";
}else{
res="No Connection to Server";
}
return res;
}
}
10 years 7 months ago #9534
by support
Replied by support on topic Get all URI annotation at open become in SIGSEV
The issue could be tight to a badly encoded pdf file or a bug in the library parsing one of your pdf file.
Is the error always reproducible with the same pdf files?
Is it random?
If the first, may you send us one of your file, please?
If you prefer, you could open a bug submission ticket in the support area and attach it in the message.
In the bug submission text you should note the full url to this forum thread.
Is the error always reproducible with the same pdf files?
Is it random?
If the first, may you send us one of your file, please?
If you prefer, you could open a bug submission ticket in the support area and attach it in the message.
In the bug submission text you should note the full url to this forum thread.
10 years 7 months ago - 10 years 7 months ago #9541
by gabmor
Replied by gabmor on topic Get all URI annotation at open become in SIGSEV
Thanks for response yes its reproducible with the same pdf files, when I don't run this asynctask works excellent so it must be part of this async task, I'm attaching one of my pdf files to test if it's an encode problem
Sorry I can't upload the file it says that it's too big my smaller pdf it's 3.7mb
Sorry I can't upload the file it says that it's too big my smaller pdf it's 3.7mb
Last edit: 10 years 7 months ago by gabmor.
10 years 7 months ago #9542
by support
Replied by support on topic Get all URI annotation at open become in SIGSEV
let's create a support ticket here
www.radaeepdf.com/support/tickets
address it as bug submission and upload your document.
address it as bug submission and upload your document.
Time to create page: 0.469 seconds