Click here to Skip to main content
11,644,982 members (63,593 online)
Click here to Skip to main content
Articles » Languages » C# » Utilities » Downloads
Add your own
alternative version

GIOS PDF Splitter and Merger

, 28 Nov 2006 LGPL3 187K 3K 110
The first open source PDF splitter and merger tool written in C#.
//Gios PDF SPlitter And Merger - A library for splitting and merging Pdf Documents in C#
//Copyright (C) 2005  Paolo Gios -
//This library is free software; you can redistribute it and/or
//modify it under the terms of the GNU Lesser General Public
//License as published by the Free Software Foundation; either
//version 2.1 of the License, or (at your option) any later version.
//This library is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//Lesser General Public License for more details.
//You should have received a copy of the GNU Lesser General Public
//License along with this library; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
using System;
using System.Text;
using System.Collections;
using System.IO;
using System.Text.RegularExpressions;

namespace Gios.Pdf.SplitMerge
	internal class PdfSplitter
        internal Hashtable sObjects;
        internal ArrayList pageNumbers;
        internal Hashtable  transHash;
        internal PdfFile PdfFile;
		private void OnProgress(int part, int total){}		
		public event ProgressDelegate ProgressEvent;
		internal PdfSplitter()
           this.ProgressEvent=new ProgressDelegate(this.OnProgress);
		internal void Load(PdfFile PdfFile,int[] PageNumbers, int startNumber)
			this.PdfFile = PdfFile;
			this.pageNumbers = new ArrayList();
			this.sObjects = new Hashtable();
			int part=0;
			int total=PageNumbers.Length;
			foreach (int PageNumber in PageNumbers)
				PdfFileObject page = PdfFile.PageList[PageNumber] as PdfFileObject;
				page.PopulateRelatedObjects(PdfFile, this.sObjects);
			this.transHash = this.CalcTransHash(startNumber);
			foreach (PdfFileObject pfo in this.sObjects.Values)
        private Hashtable CalcTransHash(int startNumber)
            Hashtable ht = new Hashtable();
            ArrayList al = new ArrayList();
            foreach (PdfFileObject pfo in this.sObjects.Values)
            al.Sort(new PdfFileObjectNumberComparer());
            int number = startNumber;
            foreach (PdfFileObject pfo in al)
                ht.Add(pfo.number, number);
            return ht;

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


About the Author

Paolo Gios
Web Developer
Italy Italy
Freelance software ASPNET / C# Software Developer

I live in Torino, Italy

my homepage is:

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150731.1 | Last Updated 28 Nov 2006
Article Copyright 2005 by Paolo Gios
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid