0

I am creating a PDF using UIGraphicsBeginPDFContextToData( pdfData, self.rect, dictionary);
I set dictionary=[[NSDictionary alloc] initWithObjectsAndKeys:masterPassword,kCGPDFContextOwnerPassword,password, kCGPDFContextUserPassword, kCFBooleanFalse, kCGPDFContextAllowsCopying, kCFBooleanTrue, kCGPDFContextAllowsPrinting, nil];

When i give kCGPDFContextUserPassword with more than five characters, the kCGPDFContextOwnerPassword is not working. Please someone help me with this issue.

You can find a pdf example here.

This pdf contains: kCGPDFContextOwnerPassword as "admin", kCGPDFContextUserPassword as "qwerty".

prabhu
  • 1,158
  • 1
  • 12
  • 27
  • In which scenarios does it work correctly? In which scenarios does it not work correctly? Does it sometimes work and not work for the exact same password, or is it possible you're using characters not allowed by PDF passwords? What have you tried? – Ian MacDonald Nov 03 '14 at 14:45
  • Assume I give the kCGPDFContextUserPassword as "12345" and kCGPDFContextOwnerPassword as "admin". It works perfect in this scenario. When I change kCGPDFContextUserPassword as "qwerty" the "admin" password is not working. I couldn't figure out a test case. – prabhu Nov 03 '14 at 14:50
  • Can you post a non-working PDF file? Also specify the passwords used with the file. – iPDFdev Nov 04 '14 at 10:17
  • @iPDFdev I upload a pdf and edited my question as a found a scenario. – prabhu Nov 04 '14 at 15:16
  • @IanMacDonald I found a scenario and modified the question that explains it. – prabhu Nov 04 '14 at 15:17
  • Are your variables 'masterPassword' and 'password' setup correctly? This 5 characters limit looks like a buffer overflow, the 'password' damages the 'masterPassword'. – iPDFdev Nov 05 '14 at 10:53
  • @iPDFdev I tried with hard coded values. Doesn't work. – prabhu Nov 05 '14 at 11:04

0 Answers0