Get all URI annotation at open become in SIGSEV - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about Android development and PDF
  • Page:
  • 1

TOPIC: Get all URI annotation at open become in SIGSEV

Get all URI annotation at open become in SIGSEV 3 years 2 months ago #9533

  • gabmor
  • gabmor's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 17
  • Thank you received: 0
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?
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;
        }
    }

Please Log in or Create an account to join the conversation.

Get all URI annotation at open become in SIGSEV 3 years 2 months ago #9534

  • support
  • support's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 571
  • Karma: 6
  • Thank you received: 46
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.

Please Log in or Create an account to join the conversation.

Get all URI annotation at open become in SIGSEV 3 years 2 months ago #9541

  • gabmor
  • gabmor's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 17
  • Thank you received: 0
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

Please Log in or Create an account to join the conversation.

Last edit: by gabmor.

Get all URI annotation at open become in SIGSEV 3 years 2 months ago #9542

  • support
  • support's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 571
  • Karma: 6
  • Thank you received: 46
let's create a support ticket here www.radaeepdf.com/support/tickets
address it as bug submission and upload your document.
The following user(s) said Thank You: gabmor

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum