Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
iTextSharp can Merge encrypted Pdf files |
Post Reply ![]() |
Author | |
mjohn ![]() Beginner ![]() Joined: 28 Oct 11 Location: ?? Status: Offline Points: 16 |
![]() ![]() ![]() ![]() ![]() Posted: 31 Oct 11 at 9:39PM |
Hi.
Use iTextSharp for .net can Merge encrypted Pdf files, but use QuickPDF can't Merge encrypted Pdf files? Thanks! |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi John!
Many pdf-files are encrypted - so QuickPDF can do this job, too.
I don't know if it's a problem merging encrypted pdf-files but:
QuickPDF can load a pdf...
then you can check if it's encrypted...
if so you can decrypt it with an easy function call ;-)
Cheers and welcome here,
Ingo
|
|
![]() |
|
mjohn ![]() Beginner ![]() Joined: 28 Oct 11 Location: ?? Status: Offline Points: 16 |
![]() ![]() ![]() ![]() ![]() |
Hi. Can you see https://skydrive.live.com/?cid=4c90f2a935f13d29&sc=documents&uc=1&id=4C90F2A935F13D29%21112# this is what i do use itextsharp.dll to merge 3 encrypted pdf files to a pdf file. when you double click ConsoleApplication1.exe, then it will create a PDFS.pdf that is merge from the 3 encrypted pdf files. but i can't do it use QuickPDF. How can do it use QuickPDF with vb6? Thanks! when use c#, below is the whole code: ////////////////////Code Begin////////////////////// sing System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using iTextSharp.text; using iTextSharp.text.pdf; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { MergePdfDoc(System.AppDomain.CurrentDomain.BaseDirectory + "PDFS"); } static private void MergePdfDoc(string sPath) { try { Document document = new Document(PageSize.A4, 50f, 50f, 50f, 50f); PdfReader reader = null; PdfCopy copy = new PdfCopy(document, new FileStream(sPath + ".pdf", FileMode.Append)); document.Open(); for (int i = 0; i <= Directory.GetFiles(sPath).Length; i++) { if (System.IO.File.Exists(string.Concat(new object[] { sPath, @"\", i, ".pdf" })) ) { reader = new PdfReader(string.Concat(new object[] { sPath, @"\", i, ".pdf" })); document.NewPage(); PdfImportedPage importedPage = copy.GetImportedPage(reader, 1); copy.AddPage(importedPage); } } if ((document != null) && document.IsOpen()) { if (copy.PageNumber == 0) { document.NewPage(); } document = null; if (reader != null) { reader.Close(); } copy.Close(); } } catch (Exception exception) { } } } } //////////////////Code End//////////////////////// whether i use ExtractFilePages or CapturePage or CopyPageRanges I can't merge the 3 encrypted pdf files to a pdf file as itextsharp.dll. Can you help? Thanks! |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi John!
What you have to do is ...
first the create ... then LoadFromFile or similar ... then check if the file is encrypted: If ( QP.EncryptionStatus > 0 ) Then QP.Decrypt; then the merge-syntax ... then the save.
About encryption you can read here:
http://www.quickpdflibrary.com/help/quickpdf/DocumentProperties.php Samples in different development languages (packed as zip) are here:
http://www.quickpdflibrary.com/samples/index.php In the developer-guide starting at page 28 you'll find a good merge-sample:
http://www.quickpdflibrary.com/docs/Quick%20PDF%20Library%207%20Developer%20Guide.pdf It's a pascal-sample but for a developer it shouldn't be a problem to convert it to any other language. Cheers, Ingo Edited by Ingo - 01 Nov 11 at 2:25PM |
|
![]() |
|
mjohn ![]() Beginner ![]() Joined: 28 Oct 11 Location: ?? Status: Offline Points: 16 |
![]() ![]() ![]() ![]() ![]() |
Hi.
Thank you for your reply!
But I can't use QP.Decrypt, because I has no password. If I have password, I know I can! But I has no password. So I want merge 3 encrypted pdf files to 1 pdf file when I has no password! Above c# code, I has no password, I didn't need Decrypt the 3 pdf files, but I can merge them in 1 pdf file too. So when I know when I has no password, I use QuickPDF, how can I merge 3 encrypted pdf files to 1 pdf file as I did in itextsharp. Thanks@ |
|
![]() |
|
mjohn ![]() Beginner ![]() Joined: 28 Oct 11 Location: ?? Status: Offline Points: 16 |
![]() ![]() ![]() ![]() ![]() |
Sorry!
I am wrong!
you are right! I can do it follow your instruction now! Thanks very much! |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi John!
Seems that your password is only the main (and not the user password) password. This doesn't have any effects - if you load such a document it's unprotected temporary and you can do the merge. Cheers, Ingo |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store