ExcelTechnology

How to Merge PDF Documents with Adobe Acrobat and C#

I often download several documents from internet when I need to collect materials to write one technical article. However, it is possible that the contents of one document are similar to others. And one of the documents introduces one aspect of the topic which another document shows. Therefore, I want to merge two or more documents into one. If I want to print the documents, I can save many pieces of paper as well.

At present, PDF are widely used so that many documents I download are PDF documents. Actually, if I want to merge PDF, I need to use some tools to help me, for example, Adobe Acrobat.

Use Adobe Acrobat to open PDF file. Confirm the first page of the merged PDF. Click Combine Files. Then, a window pops up. Select Add Open Files option to choose merged files. After that, another window pops up for arranging the order of merged files. And then, set the file size. Also, there are some other settings. We can choose the most suitable settings according to our requirement. Finally, select to merge to a single file or a package and click Create to get the new document.

Besides, I get another method to merge PDF with C#. I want to show this method because I am learning C# right now and I think that this method may be helpful for some programmers.

Note: This method is based on a component: Spire.PDF. Download it before using the following code.



using System;

using Spire.Pdf;

namespace MergeDocuments

{

class Program

{

static void Main(string[] args)

{

//pdf document list

String[] files = new String[]

{

@"Sample3.pdf",

@"Sample2.pdf",

@"Sample1.pdf"

};

//open pdf documents

PdfDocument[] docs = new PdfDocument[files.Length];

for (int i = 0; i < files.Length; i++)

{

docs[i] = new PdfDocument(files[i]);

}

//append document

docs[0].AppendPage(docs[1]);

//import page

for (int i = 0; i < docs[2].Pages.Count; i = i + 2)

{

docs[0].InsertPage(docs[2], i);

}

//Save pdf file.

docs[0].SaveToFile("MergeDocuments.pdf");

//close

foreach (PdfDocument doc in docs)

{

doc.Close();

}

//Launching the Pdf file.

System.Diagnostics.Process.Start("MergeDocuments.pdf");

}

}

}

27.06.2011. u 06:02 | 1 Komentara | Print | # | ^

<< Arhiva >>

Creative Commons License
Ovaj blog je ustupljen pod Creative Commons licencom Imenovanje-Dijeli pod istim uvjetima.

< lipanj, 2011 >
P U S Č P S N
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      

Kolovoz 2011 (2)
Srpanj 2011 (2)
Lipanj 2011 (2)
Svibanj 2011 (2)
Travanj 2011 (3)
Ožujak 2011 (2)
Veljača 2011 (2)
Siječanj 2011 (5)
Prosinac 2010 (5)

Dnevnik.hr
Gol.hr
Zadovoljna.hr
Novaplus.hr
NovaTV.hr
DomaTV.hr
Mojamini.tv

Opis bloga

something about Excel Technology in VB.Net and C#

Linkovi

Dnevnik.hr
Video news portal Nove TV

Blog.hr
Blog servis

Igre.hr
Najbolje igre i igrice

Forum.hr
Monitor.hr