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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - iTextSharp can Merge encrypted Pdf files
  FAQ FAQ  Forum Search   Register Register  Login Login

iTextSharp can Merge encrypted Pdf files

 Post Reply Post Reply
Author
Message
mjohn View Drop Down
Beginner
Beginner


Joined: 28 Oct 11
Location: ??
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote mjohn Quote  Post ReplyReply Direct Link To This Post Topic: iTextSharp can Merge encrypted Pdf files
    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!




Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3529
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 01 Nov 11 at 8:01AM
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 
Back to Top
mjohn View Drop Down
Beginner
Beginner


Joined: 28 Oct 11
Location: ??
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote mjohn Quote  Post ReplyReply Direct Link To This Post Posted: 01 Nov 11 at 2:06PM
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!
 
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3529
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 01 Nov 11 at 2:24PM
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.
 
 
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
Back to Top
mjohn View Drop Down
Beginner
Beginner


Joined: 28 Oct 11
Location: ??
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote mjohn Quote  Post ReplyReply Direct Link To This Post Posted: 01 Nov 11 at 2:34PM
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 encrypted pdf files to 1 pdf file as I did in itextsharp.

Thanks@


Back to Top
mjohn View Drop Down
Beginner
Beginner


Joined: 28 Oct 11
Location: ??
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote mjohn Quote  Post ReplyReply Direct Link To This Post Posted: 01 Nov 11 at 2:49PM
Sorry!
I am wrong!
you are right!
 I can do it follow your instruction now!
Thanks very much!
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3529
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 01 Nov 11 at 6:28PM
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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store