Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Nov 01, 2023 8:12 am

Hello

We have an app that uses CompletableFuture.supplyAsync() to read/write a PDF asynchronously.
This used to work but our users reported that our app would never end reading the PDF when using Android 13.

Indeed, Spire.PDF for Android V9.10.1 has the following behaviour:
  • - For Android 8-12: Everything works either synchronously or asynchronously.
  • - For Android 13+: Synchronous works. When doing it asynchronously, some stuff does not work.

Things that I currently know do not work asynchronously in Android 13+ are:
  • -Applying the license key. The PDF produced will have the watermark as if no license was provided.
  • - Using com.spire.pdf.PdfPageBase.getImagesInfo(). This method never returns, no matter if the page has images or not.

With the attached example project this behaviour can be reproduced.
I further noticed, that asynchronous reading in Android 13 works if the document was first read synchronously.
So, in my example, there is the following code:
Code: Select all
boolean readSync = false;
boolean readAsync = true;

if(readSync) {
    readPdf(createdFile);
}

if(readAsync) {
    readPdfAsync(createdFile);
}


This code works on Android 8-12 but not on Android 13.
But if you set readSync to true, then it also works on Android 13!

So, something changed with Android 13 that makes your code no longer work when called asynchronously.
And also, something happens when reading the PDF synchronously the first time, that makes the second (asynchronous) call succeed!

As stated above, I have found two cases where it doesn't work, but there might be more functionality which doesn't work as expected with Android 13+.
So, you should investigate how Spire.PDF behaves with Android 13, especially regarding the CompletableFuture.

RicoScheller
 
Posts: 37
Joined: Tue Jul 02, 2019 10:34 am

Thu Nov 02, 2023 9:31 am

Hi,

Thanks for your feedback.
We will investigate this issue and provide you with feedback as soon as possible.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Fri Nov 03, 2023 2:59 am

Hi,

Thanks for your patience.
I reproduced this issue you mentioned, when readSync is false, the method readPdfAsync(createdFile) will not work. I have logged this issue into our issue tracking system with the ticket number SPIREPDF-6378, our dev team will investigate and fix it. We apologize for any inconvenience caused. When this issue is fixed, I will inform you asap.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.PDF