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

PDFAESStream fails when opening large document

More
IP: 192.168.0.71 11 years 6 months ago #7110 by petr.sklenicka
Hello,
I have a premium licence and I use PDFAESStream for opening the PDF document. I use this code:
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
More
IP: 192.168.0.71 11 years 6 months ago - 11 years 6 months ago #7114 by radaee
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: 11 years 6 months ago by .
More
IP: 192.168.0.71 11 years 6 months ago #7119 by petr.sklenicka
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.
More
IP: 192.168.0.71 11 years 6 months ago - 11 years 6 months ago #7153 by radaee
i test these codes:
Code:
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: 11 years 6 months ago by .
More
IP: 192.168.0.71 11 years 6 months ago - 11 years 6 months ago #7173 by petr.sklenicka
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:
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: 11 years 6 months ago by sanyu erisa.
More
IP: 192.168.0.71 11 years 5 months ago #7220 by radaee
a new version will come, fixed this issue, need to replace modified PDFAESStream class.
Time to create page: 0.425 seconds
Powered by Kunena Forum