Print Page | Close Window

Encrypt Function fails when page no excceds 7

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2178
Printed Date: 22 Nov 24 at 10:58PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Encrypt Function fails when page no excceds 7
Posted By: sangeeth
Subject: Encrypt Function fails when page no excceds 7
Date Posted: 03 Mar 12 at 6:31AM
Hi,
 
I am using  QUICK PDF Version 0723 (DELPHI) and in that I can successfully encrypt the file with
function EncodePermissions(1,0,0,0,0,0,0,0) and it successfully works if number of pages
less than or equal to 7.  The function fails and I got a blank page when the number of page
exceeds 7.
 
I even tried the trail version 0813 of Quick PDF and got the same problem.
 
 Could any one please help me.
 
Thanks.
Sangeeth



Replies:
Posted By: Ingo
Date Posted: 03 Mar 12 at 10:17AM
Hi Sangeeth!

Do you believe this by yourself???
Keep in mind that there are a lot of QuickPDF-users out there
and encrypt and decrypt is not a seldom used function.
Often here are users talking about 1000 and more pages.
You're completely on the wrong way with your prob.
The question should be:
Do you have this prob with only one pdf or with each pdf?
What about deleting page 8 and try to encrypt the pdf then?
Perhaps on page 8 there's a special new technic not support by QuickPDF yet?
Think here are few guys helping you out if you're able to upload the problem-pdf anywhere.
Posting your code (the relevant part) could be helpful, too.

Cheers and welcome here,
Ingo



Posted By: sangeeth
Date Posted: 05 Mar 12 at 5:43AM
Hi Ingo,
 
Thank you for the quick response.
 
I will post sample code here please let me know if I am in the wrong way.
 
Var  pdflb : Tquickpdf0723;
EncPerm,unloackresult : integer;
begin
   pdflb          := Tquickpdf0723.Create;
   unloackresult  := pdflb.UnlockKey(//key); //license key orginal
   pdflb.LoadFromFile('D:\testquickpdfissue.pdf');
   EncPerm:=pdflb.EncodePermissions(1,0,0,0,0,0,0,0);
   pdflb.Encrypt('locked_down','',1,EncPerm);
   pdflb.SaveToFile('D:\quickpdfencrypted.pdf');
 
Is there any option to attach the sample file which failed to encrypt so that I can attach for reference.
I tried to encrypt few pdf files from the net and there is some issue for encrypt with some files.
 
Thanks,
Sangeeth
 
 
 
 


Posted By: Ingo
Date Posted: 05 Mar 12 at 11:12AM
Hi!
 
You can't see anything wrong from this code-snippet.
What could be is:
If the loaded files are encrypted your new encryption won't work.
First you have to check if the files are encrypted and if "yes" you
have to decrypt them and then you can create a new encryption.
You understand? ...you can't create a new encryption on a file
where's already an encryption with a main password ;-)
This could be a possible reason for your probs.
 
Cheers, Ingo
 


Posted By: sangeeth
Date Posted: 05 Mar 12 at 11:30AM
Hi Ingo,
 
Thanks for the reply.
 
But the file testquickpdfissue.pdf is created by converting a text file for testing purpose and there
is no encryption applied for it.
 
only thing I noted that in the text file if the file is less than 70KB (Approx) the LoadFromFile works without any issue and also encrypted without any issue.
 
When I added few more lines to the testquickpdfissue.pdf it failed to encrypt the file. If I remove the
extra added lines the encryption works again without any issue.
 
If there is any option here to attach the files you may be able to check.
 
Thanks,
Sangeeth


Posted By: Ingo
Date Posted: 06 Mar 12 at 8:10AM
Hi!
 
You can't upload a testfile 'cause
it's only a user-user-forum here.
There are many free filehoster on the net
doing this service for you for free ;-)
You can use the official support-pages
there's an upload-option, too. There
your prob would be managed by the official
publishers of the library.
 
Cheers, Ingo
 


Posted By: sangeeth
Date Posted: 06 Mar 12 at 8:56AM
Hi Ingo,
 
Thank you for the information.
 
I will try the Technical support.
 
Thanks,
Sangeeth


Posted By: AndrewC
Date Posted: 06 Mar 12 at 11:13AM

QP.LoadFromFile is returning 0 which means the file is most likely corrupted / malformed.

Andrew.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk