- Posts: 100
- 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
Does Radaee provide encription
- asliyanage
- Topic Author
- Offline
- Premium Member
-
Less
More
IP: 192.168.0.71
11 years 6 months ago #7353
by asliyanage
Does Radaee provide encription was created by asliyanage
I need to know does radaee library provide encryption facility for pdf ?
IP: 192.168.0.156
11 years 6 months ago #7357
by Davide
Replied by Davide on topic Does Radaee provide encription
Yes,
there are simple codes in PDFTestAct.
there are simple codes in PDFTestAct.
Code:
//byte key[] = new byte[16];
//stream.open("/sdcard/ttt.pdf", key);//pdf file to encrypt.
//stream.ImportFromFile("/sdcard/test.pdf");//import test.pdf and encrypt to ttt.pdf
//stream.ExportToFile("/sdcard/test1.pdf");//decrypt to test1.pdf
//stream.close();
- asliyanage
- Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 100
- Thank you received: 0
IP: 192.168.0.71
11 years 4 months ago #7906
by asliyanage
Replied by asliyanage on topic Does Radaee provide encription
can you please tell me what is stream and what is the need for byte array?
I have a pdf file in sdcard/pdf/abc.pdf .I need to encrypt the abc.pdf file.could you please tell me the way to do this ?
I have a pdf file in sdcard/pdf/abc.pdf .I need to encrypt the abc.pdf file.could you please tell me the way to do this ?
IP: 192.168.0.71
11 years 4 months ago - 11 years 4 months ago #7916
by radaee
Replied by radaee on topic Does Radaee provide encription
2 level encryptin supported.
1. PDF standard encryption, see Doument.EncryptAs()
2. APP level encryption, which Davide memtioned.
//byte key[] = new byte[16];
//stream.open("/sdcard/ttt.pdf", key);//pdf file to encrypt.
//stream.ImportFromFile("/sdcard/test.pdf");//import test.pdf and encrypt to ttt.pdf
//stream.ExportToFile("/sdcard/test1.pdf");//decrypt to test1.pdf
//stream.close();
the key must be 16 bytes long, can be any values to set, which both used to encryption and dcryption.
in sample, key not set any value, so java init as all 0.
1. PDF standard encryption, see Doument.EncryptAs()
2. APP level encryption, which Davide memtioned.
//byte key[] = new byte[16];
//stream.open("/sdcard/ttt.pdf", key);//pdf file to encrypt.
//stream.ImportFromFile("/sdcard/test.pdf");//import test.pdf and encrypt to ttt.pdf
//stream.ExportToFile("/sdcard/test1.pdf");//decrypt to test1.pdf
//stream.close();
the key must be 16 bytes long, can be any values to set, which both used to encryption and dcryption.
in sample, key not set any value, so java init as all 0.
Last edit: 11 years 4 months ago by .
- asliyanage
- Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 100
- Thank you received: 0
IP: 192.168.0.71
11 years 4 months ago #8008
by asliyanage
Replied by asliyanage on topic Does Radaee provide encription
I used below code to open the pdf file.Please tell me the way to encrypt this pdf file.path has the pdf file path.
m_doc.Close();
int ret = m_doc.Open(path, null);
if (ret == 0) {
m_reader.setVisibility(View.VISIBLE);
m_reader.PDFOpen(m_doc, false, this);
m_reader.PDFOpen(m_doc, false, this);
mContentView.removeAllViews();
mContentView.addView(m_layout);
}
m_doc.Close();
int ret = m_doc.Open(path, null);
if (ret == 0) {
m_reader.setVisibility(View.VISIBLE);
m_reader.PDFOpen(m_doc, false, this);
m_reader.PDFOpen(m_doc, false, this);
mContentView.removeAllViews();
mContentView.addView(m_layout);
}
IP: 192.168.0.71
11 years 4 months ago - 11 years 4 months ago #8011
by radaee
Replied by radaee on topic Does Radaee provide encription
first you can use this to encrypt PDF file:
byte file_id[] = new byte[16];
//set any bytes to file_id.
int ret = m_doc.Open("sdcard/pdf1.pdf", null);
m_doc.EncryptAs( "sdcard/pdf2.pdf", "owner password", "user password", -1, 0, file_id );
m_doc.Close();
now it saved to pdf2.pdf, and then open pdf2.pdf
int ret = m_doc.Open("sdcard/pdf2.pdf", "user password");//do not forgot password, that passed to EncryptAs
//to do ...
m_doc.Close();
NOTICE:this need premium license.
byte file_id[] = new byte[16];
//set any bytes to file_id.
int ret = m_doc.Open("sdcard/pdf1.pdf", null);
m_doc.EncryptAs( "sdcard/pdf2.pdf", "owner password", "user password", -1, 0, file_id );
m_doc.Close();
now it saved to pdf2.pdf, and then open pdf2.pdf
int ret = m_doc.Open("sdcard/pdf2.pdf", "user password");//do not forgot password, that passed to EncryptAs
//to do ...
m_doc.Close();
NOTICE:this need premium license.
Last edit: 11 years 4 months ago by .
Time to create page: 0.447 seconds