RadaeePDF.com :: Topic: PDFAESStream fails when opening large document (1/1)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: PDFAESStream fails when opening large document

PDFAESStream fails when opening large document 2 years 10 months ago #7110

Hello,
I have a premium licence and I use PDFAESStream for opening the PDF document. I use this code:
PDFAESStream stream = new PDFAESStream();
boolean open = stream.open(pathToFile, "MySecretKey12345".getBytes());
boolean importRes = stream.ImportFromFile(file);
openResult = doc.OpenStream(stream, null);

This code works fine for small documents (for example about 30MB size). The values of variables "open" and "importRes" are "true" and "openResult" is 0. Simply, all work great.

When I use the exactly same code for opening large PDF file (for example 100MB size), the document cannot be opened. The values of variables "open" and "openResult" are "true", but "openResult" is -3.

Can you give me and advice, what is wrong? Thank you very much.

Best regards,
Petr
The administrator has disabled public write access.

PDFAESStream fails when opening large document 2 years 10 months ago #7114

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
not sure, you can try ImportFromFile to encrypt file.
plz, delete exist file, before encrypt PDF file.
example: you want encrypt a.pdf to b.pdf, you'd better delete b.pdf first, then encrypt.
Last Edit: 2 years 10 months ago by .
The administrator has disabled public write access.

PDFAESStream fails when opening large document 2 years 10 months ago #7119

Thank you for your answer.
Unfortunately, I tried it and it does not work. I tried these:
  • delete file and then ecrypt (your advice)
  • rename and delete file and then encrypt
  • encrypt and open file from internal storage of the device
  • encrypt and open file from external storage of the device (I have the permission to write)
  • run application on various devices and emulators
I do not know, what else can I do. Do you have some other advice or idea, how can solve this issue?
Thank you very much.
The administrator has disabled public write access.

PDFAESStream fails when opening large document 2 years 10 months ago #7153

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
i test these codes:
byte key[] = new byte[16];
stream.open("/sdcard/ttt.pdf", key);
stream.ImportFromFile("/sdcard/test.pdf");
stream.ExportToFile("/sdcard/test1.pdf");
stream.close();
stream.open("/sdcard/ttt.pdf", key);
//do open and PDFView.vOpen...
and works fine with an 122M PDF file.
plz update PDFASEStream to last beta versaion?
Last Edit: 2 years 10 months ago by .
The administrator has disabled public write access.

PDFAESStream fails when opening large document 2 years 10 months ago #7173

Hello, thank you for your response. I tried exactly the same code like yours, but for my large PDF it does not work. Also, I am using the last version of PDFAESStream class (2.9.11b).
This is my code:
PDFAESStream stream = new PDFAESStream();
byte[] key = "MySecretKeyABCDE".getBytes();
stream.open("/sdcard/EncryptedCatalog.pdf", key);
stream.ImportFromFile("/sdcard/Catalog.pdf");
stream.ExportToFile("/sdcard/DecryptedCatalog.pdf");
stream.close();
boolean openStream = stream.open("/sdcard/EncryptedCatalog.pdf", key);
openResult = doc.OpenStream(stream, null);
The variable openStream is true, but openResult is -3.
There are two links to my PDFs (unecrypted and encrypted).
www.dropbox.com/s/ibvnfz6gckr79eb/Catalog.pdf?dl=0
www.dropbox.com/s/uk40gi6zl2uzmnj/EncryptedCatalog.pdf?dl=0
Can you try to open this document, please? The key is MySecretKeyABCDE. Thank you a lot.
UPDATE
I also tried to change the native library. I tried to use the native library from version 3.0beta6, but still I have the same problem.
UPDATE 2
I find out that with class PDFAESStreamOld it works. But there is a problem with writing to the document, because this class supports only "read-only" access.
Update 3
I tried to use PDFAESStream in your demo application, which I found in 3.0beta6 - but still I have the same problem.

Update 4
I tried to use some other large PDF document. I used the 125MB document and with this document my code works. Then, I tried some other document again (61MB) and it does not work - the same problem as above. This 61MB document contains a lot of pictures. Do you think that this could be a reason for error?
Last Edit: 2 years 10 months ago by sanyu erisa.
The administrator has disabled public write access.

PDFAESStream fails when opening large document 2 years 10 months ago #7220

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
a new version will come, fixed this issue, need to replace modified PDFAESStream class.
The administrator has disabled public write access.
Powered by Kunena Forum