From 1b6872509280edd15be7a60d70ed88582ae8ff1e Mon Sep 17 00:00:00 2001 From: PURPORC Date: Tue, 3 Sep 2013 19:50:10 +1000 Subject: [PATCH 1/4] Add capability of binding files with password prompt. --- src/PDFBinder/Binder.cs | 72 +++++++++++--- src/PDFBinder/MainForm.cs | 64 ++++++++++--- src/PDFBinder/PDFBinder.csproj | 9 ++ src/PDFBinder/PasswordEntry.Designer.cs | 95 +++++++++++++++++++ src/PDFBinder/PasswordEntry.cs | 45 +++++++++ src/PDFBinder/PasswordEntry.resx | 120 ++++++++++++++++++++++++ 6 files changed, 381 insertions(+), 24 deletions(-) create mode 100644 src/PDFBinder/PasswordEntry.Designer.cs create mode 100644 src/PDFBinder/PasswordEntry.cs create mode 100644 src/PDFBinder/PasswordEntry.resx diff --git a/src/PDFBinder/Binder.cs b/src/PDFBinder/Binder.cs index 9c62706..5e7114b 100644 --- a/src/PDFBinder/Binder.cs +++ b/src/PDFBinder/Binder.cs @@ -55,31 +55,79 @@ public void AddFile(string fileName) reader.Close(); } + public void AddFile(string fileName, byte[] password) + { + try + { + var reader = new PdfReader(fileName, password); + for (var i = 1; i <= reader.NumberOfPages; i++) + { + var size = reader.GetPageSizeWithRotation(i); + _document.SetPageSize(size); + _document.NewPage(); + + var page = _pdfCopy.GetImportedPage(reader, i); + _pdfCopy.AddPage(page); + } + + reader.Close(); + } + catch (BadPasswordException bpe) + { + AddFile(fileName); + return; + } + } + public void Dispose() { _document.Close(); } - public static SourceTestResult TestSourceFile(string fileName) + public static SourceTestResult TestSourceFile(string fileName, byte[] password) { - try + bool tryAgain = false; + while (true) { - PdfReader reader = new PdfReader(fileName); - bool ok = !reader.IsEncrypted() || - (reader.Permissions & PdfWriter.AllowAssembly) == PdfWriter.AllowAssembly; - reader.Close(); + try + { + PdfReader reader; + if (!tryAgain) + { + reader = new PdfReader(fileName); + } + else + { + reader = new PdfReader(fileName, password); + } - return ok ? SourceTestResult.Ok : SourceTestResult.Protected; - } - catch - { - return SourceTestResult.Unreadable; + bool ok = !reader.IsEncrypted() || reader.IsOpenedWithFullPermissions || + (reader.Permissions & PdfWriter.AllowAssembly) == PdfWriter.AllowAssembly; + reader.Close(); + + return ok ? SourceTestResult.Ok : SourceTestResult.Protected; + } + catch (iTextSharp.text.pdf.BadPasswordException bpe) + { + if (tryAgain) + { + return SourceTestResult.PasswordRequired; + } + else + { + tryAgain = true; + } + } + catch (Exception) + { + return SourceTestResult.Unreadable ; + } } } public enum SourceTestResult { - Ok, Unreadable, Protected + Ok, Unreadable, Protected, PasswordRequired } } } diff --git a/src/PDFBinder/MainForm.cs b/src/PDFBinder/MainForm.cs index a5753e5..e5ad2b6 100644 --- a/src/PDFBinder/MainForm.cs +++ b/src/PDFBinder/MainForm.cs @@ -15,20 +15,54 @@ public MainForm() InitializeComponent(); UpdateUI(); } + + public static byte[] StrToByteArray(string str) + { + System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); + return encoding.GetBytes(str); + } + + private Dictionary passwords = new Dictionary(); + + private byte[] currentPassword = null; public void AddInputFile(string file) { - switch (Combiner.TestSourceFile(file)) - { - case Combiner.SourceTestResult.Unreadable: - MessageBox.Show(string.Format("File could not be opened as a PDF document:\n\n{0}", file), "Illegal file type", MessageBoxButtons.OK, MessageBoxIcon.Error); - break; - case Combiner.SourceTestResult.Protected: - MessageBox.Show(string.Format("PDF document does not allow copying:\n\n{0}", file), "Permission denied", MessageBoxButtons.OK, MessageBoxIcon.Hand); - break; - case Combiner.SourceTestResult.Ok: - inputListBox.Items.Add(file); - break; + Boolean tryAgain = true; + Boolean newPassword = false; + while (tryAgain || newPassword) { + newPassword = false; + switch (Combiner.TestSourceFile(file, currentPassword)) + { + case Combiner.SourceTestResult.Unreadable: + MessageBox.Show(string.Format("File could not be opened as a PDF document:\n\n{0}", file), "Illegal file type", MessageBoxButtons.OK, MessageBoxIcon.Error); + break; + case Combiner.SourceTestResult.Protected: + MessageBox.Show(string.Format("PDF document does not allow copying:\n\n{0}", file), "Permission denied", MessageBoxButtons.OK, MessageBoxIcon.Hand); + break; + case Combiner.SourceTestResult.Ok: + inputListBox.Items.Add(file); + passwords[file] = currentPassword; + break; + case Combiner.SourceTestResult.PasswordRequired: + if (tryAgain) + { + PasswordEntry pe = new PasswordEntry(); + pe.Prompt = "Password required for file: \n" + file; + DialogResult dr = pe.ShowDialog(this); + + if (dr == System.Windows.Forms.DialogResult.OK) { + currentPassword = StrToByteArray(pe.Password); + newPassword = true; + } + } + else + { + MessageBox.Show(string.Format("Password supplied didn't open PDF document:\n\n{0}", file), "Bad password", MessageBoxButtons.OK, MessageBoxIcon.Hand); + } + break; + } + tryAgain = false; } } @@ -86,7 +120,13 @@ private void combineButton_Click(object sender, EventArgs e) for (int i = 0; i < inputListBox.Items.Count; i++) { - combiner.AddFile((string)inputListBox.Items[i]); + byte[] pw ; + bool found_pw = passwords.TryGetValue((string)inputListBox.Items[i], out pw); + if (found_pw) { + combiner.AddFile((string)inputListBox.Items[i], pw); + } else { + combiner.AddFile((string)inputListBox.Items[i]); + } progressBar.Value = (int)(((i + 1) / (double)inputListBox.Items.Count) * 100); } diff --git a/src/PDFBinder/PDFBinder.csproj b/src/PDFBinder/PDFBinder.csproj index 9ef3b1b..d924880 100644 --- a/src/PDFBinder/PDFBinder.csproj +++ b/src/PDFBinder/PDFBinder.csproj @@ -59,12 +59,21 @@ MainForm.cs + + Form + + + PasswordEntry.cs + MainForm.cs Designer + + PasswordEntry.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/src/PDFBinder/PasswordEntry.Designer.cs b/src/PDFBinder/PasswordEntry.Designer.cs new file mode 100644 index 0000000..5417ffe --- /dev/null +++ b/src/PDFBinder/PasswordEntry.Designer.cs @@ -0,0 +1,95 @@ +namespace PDFBinder +{ + partial class PasswordEntry + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.textBoxPassword = new System.Windows.Forms.TextBox(); + this.buttonOK = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(22, 29); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(51, 20); + this.label1.TabIndex = 0; + this.label1.Text = "label1"; + // + // textBoxPassword + // + this.textBoxPassword.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.textBoxPassword.Location = new System.Drawing.Point(91, 182); + this.textBoxPassword.Name = "textBoxPassword"; + this.textBoxPassword.Size = new System.Drawing.Size(209, 26); + this.textBoxPassword.TabIndex = 1; + this.textBoxPassword.UseSystemPasswordChar = true; + // + // buttonOK + // + this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.buttonOK.Location = new System.Drawing.Point(144, 232); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(94, 29); + this.buttonOK.TabIndex = 2; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // PasswordEntry + // + this.AcceptButton = this.buttonOK; + this.ClientSize = new System.Drawing.Size(398, 273); + this.ControlBox = false; + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.textBoxPassword); + this.Controls.Add(this.label1); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "PasswordEntry"; + this.ShowIcon = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "PDF Password Required"; + this.TopMost = true; + this.Load += new System.EventHandler(this.PasswordEntry_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBoxPassword; + private System.Windows.Forms.Button buttonOK; + + + } +} \ No newline at end of file diff --git a/src/PDFBinder/PasswordEntry.cs b/src/PDFBinder/PasswordEntry.cs new file mode 100644 index 0000000..a0a0d3a --- /dev/null +++ b/src/PDFBinder/PasswordEntry.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace PDFBinder +{ + public partial class PasswordEntry : Form + { + + String description; + String dialogInvoker; + + public PasswordEntry() + { + InitializeComponent(); + + } + + public String Prompt + { + set { label1.Text = value; } + } + + public string Password + { + get { return textBoxPassword.Text; } + set { textBoxPassword.Text = value; } + } + + private void PasswordEntry_Load(object sender, EventArgs e) + { + + } + + private void buttonOK_Click(object sender, EventArgs e) + { + this.Close(); + } + + } +} diff --git a/src/PDFBinder/PasswordEntry.resx b/src/PDFBinder/PasswordEntry.resx new file mode 100644 index 0000000..7080a7d --- /dev/null +++ b/src/PDFBinder/PasswordEntry.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file From c1a1fd7de898f085e5cf17ead12266d06fe0585e Mon Sep 17 00:00:00 2001 From: PURPORC Date: Fri, 6 Sep 2013 23:47:13 +1000 Subject: [PATCH 2/4] Add capability to select pages for each file to bind. --- src/PDFBinder/Binder.cs | 153 ++++++++++++++++++++++++-- src/PDFBinder/MainForm.Designer.cs | 107 ++++++++++++------ src/PDFBinder/MainForm.cs | 169 ++++++++++++++++++++++++----- src/PDFBinder/MainForm.resx | 112 +++++++++++-------- src/PDFBinder/PDFBinder.csproj | 10 ++ src/PDFBinder/PdfItem.Designer.cs | 86 +++++++++++++++ src/PDFBinder/PdfItem.cs | 101 +++++++++++++++++ src/PDFBinder/PdfItem.resx | 123 +++++++++++++++++++++ 8 files changed, 743 insertions(+), 118 deletions(-) create mode 100644 src/PDFBinder/PdfItem.Designer.cs create mode 100644 src/PDFBinder/PdfItem.cs create mode 100644 src/PDFBinder/PdfItem.resx diff --git a/src/PDFBinder/Binder.cs b/src/PDFBinder/Binder.cs index 5e7114b..5512c68 100644 --- a/src/PDFBinder/Binder.cs +++ b/src/PDFBinder/Binder.cs @@ -19,11 +19,116 @@ using System; using System.IO; +using System.Collections; +using System.Collections.Generic; using iTextSharp.text; using iTextSharp.text.pdf; namespace PDFBinder { + + + public class PageNumberGeneratorGenerator : IEnumerable + { + public String pagesIntent; + public PageNumberGeneratorGenerator(String pagesIntent) + { + this.pagesIntent = pagesIntent; + } + public IEnumerator GetEnumerator() { + return new PageNumberGenerator(this.pagesIntent); + } + IEnumerator IEnumerable.GetEnumerator() + { + return new PageNumberGenerator(this.pagesIntent); + } + } + + public class PageNumberGenerator : IEnumerator + { + public class PageRange + { + public int begin; + public int end; + } + public bool selectAll = true; + public List ranges = new List(); + private List.Enumerator placeKeeper; + private int lastPageGenerated = 0; + public PageNumberGenerator(String pagesIntent) + { + List output = new List(); + string[] regions = pagesIntent.Split(','); + + foreach (string r in regions) + { + if (r.Length == 0) + { + continue; + } + string[] endpointsStrings = r.Split('-'); + if (endpointsStrings.Length > 2) { + throw new ArgumentException(); + } + PageRange pr = new PageRange(); + bool ok = int.TryParse(endpointsStrings[0], out pr.begin); + if (endpointsStrings.Length == 2 ) { + ok &= int.TryParse(endpointsStrings[1], out pr.end); + } + if (!ok) { + throw new ArgumentException("Region couldn't be parsed " + r); + } + ranges.Add(pr); + selectAll = false; + } + placeKeeper = ranges.GetEnumerator(); + } + public void Reset() + { + placeKeeper = ranges.GetEnumerator(); + } + + void IDisposable.Dispose() + { + ranges = null; + placeKeeper.Dispose(); + } + public int Current + { + get { return lastPageGenerated; } + } + + object IEnumerator.Current + { + get { return Current; } + } + + public bool MoveNext() + { + if (selectAll) + { + lastPageGenerated += 1; + return true; + } + int nextPage = lastPageGenerated + 1; + if (placeKeeper.Current == null || nextPage > placeKeeper.Current.end) + { + if (placeKeeper.MoveNext()) + { + nextPage = placeKeeper.Current.begin; + } + else + { + return false; + } + + } + lastPageGenerated = nextPage; + return true; + } + } + + class Combiner : IDisposable { private readonly Document _document; @@ -55,21 +160,13 @@ public void AddFile(string fileName) reader.Close(); } - public void AddFile(string fileName, byte[] password) + public void AddFile(string fileName, byte[] password, String pages) { try { var reader = new PdfReader(fileName, password); - for (var i = 1; i <= reader.NumberOfPages; i++) - { - var size = reader.GetPageSizeWithRotation(i); - _document.SetPageSize(size); - _document.NewPage(); - - var page = _pdfCopy.GetImportedPage(reader, i); - _pdfCopy.AddPage(page); - } - + PageNumberGeneratorGenerator png = new PageNumberGeneratorGenerator(pages); + AddPages(reader, png); reader.Close(); } catch (BadPasswordException bpe) @@ -79,6 +176,40 @@ public void AddFile(string fileName, byte[] password) } } + private void AddPage(PdfReader reader, int p) + { + var size = reader.GetPageSizeWithRotation(p); + _document.SetPageSize(size); + _document.NewPage(); + var page = _pdfCopy.GetImportedPage(reader, p); + if (page != null) + { + _pdfCopy.AddPage(page); + } + else + { + throw new PdfException("Null page returned: " + p ); + } + } + + private void AddPages(PdfReader reader, PageNumberGeneratorGenerator png) + { + try + { + foreach (int p in png) + { + if (p > reader.NumberOfPages) + { + return; + } + AddPage(reader, p); + } + } catch (Exception pdfe) { + System.Diagnostics.Debug.Write(pdfe); + } + } + + public void Dispose() { _document.Close(); diff --git a/src/PDFBinder/MainForm.Designer.cs b/src/PDFBinder/MainForm.Designer.cs index 52251ad..7d088f7 100644 --- a/src/PDFBinder/MainForm.Designer.cs +++ b/src/PDFBinder/MainForm.Designer.cs @@ -28,11 +28,12 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); - this.inputListBox = new System.Windows.Forms.ListBox(); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.addFileButton = new System.Windows.Forms.ToolStripButton(); this.removeButton = new System.Windows.Forms.ToolStripButton(); + this.RemoveAllButton = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.moveUpButton = new System.Windows.Forms.ToolStripButton(); this.moveDownButton = new System.Windows.Forms.ToolStripButton(); @@ -42,29 +43,19 @@ private void InitializeComponent() this.addFileDialog = new System.Windows.Forms.OpenFileDialog(); this.progressBar = new System.Windows.Forms.ProgressBar(); this.helpLabel = new System.Windows.Forms.Label(); + this.FileListPanel = new System.Windows.Forms.FlowLayoutPanel(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.toolStrip1.SuspendLayout(); this.SuspendLayout(); // - // inputListBox - // - this.inputListBox.AllowDrop = true; - this.inputListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.inputListBox.FormattingEnabled = true; - this.inputListBox.Location = new System.Drawing.Point(4, 30); - this.inputListBox.Name = "inputListBox"; - this.inputListBox.Size = new System.Drawing.Size(422, 147); - this.inputListBox.TabIndex = 0; - this.inputListBox.SelectedIndexChanged += new System.EventHandler(this.inputListBox_SelectedIndexChanged); - this.inputListBox.DragDrop += new System.Windows.Forms.DragEventHandler(this.inputListBox_DragDrop); - this.inputListBox.DragEnter += new System.Windows.Forms.DragEventHandler(this.inputListBox_DragEnter); - // // toolStrip1 // this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addFileButton, this.removeButton, + this.RemoveAllButton, this.toolStripSeparator1, this.moveUpButton, this.moveDownButton, @@ -81,21 +72,31 @@ private void InitializeComponent() this.addFileButton.Image = ((System.Drawing.Image)(resources.GetObject("addFileButton.Image"))); this.addFileButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.addFileButton.Name = "addFileButton"; - this.addFileButton.Size = new System.Drawing.Size(75, 22); + this.addFileButton.Size = new System.Drawing.Size(77, 22); this.addFileButton.Text = "Add file..."; this.addFileButton.Click += new System.EventHandler(this.addFileButton_Click); // // removeButton // - this.removeButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.removeButton.Enabled = false; this.removeButton.Image = ((System.Drawing.Image)(resources.GetObject("removeButton.Image"))); this.removeButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.removeButton.Name = "removeButton"; - this.removeButton.Size = new System.Drawing.Size(23, 22); + this.removeButton.Size = new System.Drawing.Size(116, 22); this.removeButton.Text = "Remove selected"; this.removeButton.Click += new System.EventHandler(this.removeButton_Click); // + // RemoveAllButton + // + this.RemoveAllButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.RemoveAllButton.Enabled = false; + this.RemoveAllButton.Image = ((System.Drawing.Image)(resources.GetObject("RemoveAllButton.Image"))); + this.RemoveAllButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.RemoveAllButton.Name = "RemoveAllButton"; + this.RemoveAllButton.Size = new System.Drawing.Size(55, 22); + this.RemoveAllButton.Text = "Clear All"; + this.RemoveAllButton.Click += new System.EventHandler(this.ClearAllButton_Click); + // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; @@ -134,7 +135,7 @@ private void InitializeComponent() this.completeButton.Image = ((System.Drawing.Image)(resources.GetObject("completeButton.Image"))); this.completeButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.completeButton.Name = "completeButton"; - this.completeButton.Size = new System.Drawing.Size(51, 22); + this.completeButton.Size = new System.Drawing.Size(54, 22); this.completeButton.Text = "Bind!"; this.completeButton.Click += new System.EventHandler(this.combineButton_Click); // @@ -151,38 +152,76 @@ private void InitializeComponent() // // progressBar // - this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.progressBar.Location = new System.Drawing.Point(4, 183); + this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.progressBar.Location = new System.Drawing.Point(0, 196); + this.progressBar.MaximumSize = new System.Drawing.Size(0, 16); this.progressBar.Name = "progressBar"; - this.progressBar.Size = new System.Drawing.Size(422, 16); + this.progressBar.Size = new System.Drawing.Size(429, 16); this.progressBar.TabIndex = 2; this.progressBar.Visible = false; // // helpLabel // - this.helpLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.helpLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.helpLabel.AutoSize = true; - this.helpLabel.Location = new System.Drawing.Point(4, 183); + this.helpLabel.Location = new System.Drawing.Point(4, 196); this.helpLabel.Name = "helpLabel"; this.helpLabel.Size = new System.Drawing.Size(0, 13); this.helpLabel.TabIndex = 3; // + // FileListPanel + // + this.FileListPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.FileListPanel.AutoScroll = true; + this.FileListPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.FileListPanel.Location = new System.Drawing.Point(0, 42); + this.FileListPanel.MinimumSize = new System.Drawing.Size(423, 150); + this.FileListPanel.Name = "FileListPanel"; + this.FileListPanel.Size = new System.Drawing.Size(429, 151); + this.FileListPanel.TabIndex = 4; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(15, 27); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(52, 13); + this.label1.TabIndex = 5; + this.label1.Text = "File name"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(345, 27); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(37, 13); + this.label2.TabIndex = 5; + this.label2.Text = "Pages"; + // // MainForm // + this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(429, 202); + this.ClientSize = new System.Drawing.Size(429, 215); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); this.Controls.Add(this.progressBar); + this.Controls.Add(this.FileListPanel); this.Controls.Add(this.helpLabel); this.Controls.Add(this.toolStrip1); - this.Controls.Add(this.inputListBox); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MinimumSize = new System.Drawing.Size(437, 229); + this.MinimumSize = new System.Drawing.Size(445, 240); this.Name = "MainForm"; this.Text = "PDFBinder"; - this.TopMost = true; + this.Load += new System.EventHandler(this.MainForm_Load); + this.DragDrop += new System.Windows.Forms.DragEventHandler(this.inputListBox_DragDrop); + this.DragEnter += new System.Windows.Forms.DragEventHandler(this.inputListBox_DragEnter); + this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MainForm_KeyDown); this.toolStrip1.ResumeLayout(false); this.toolStrip1.PerformLayout(); this.ResumeLayout(false); @@ -192,7 +231,6 @@ private void InitializeComponent() #endregion - private System.Windows.Forms.ListBox inputListBox; private System.Windows.Forms.ToolStrip toolStrip1; private System.Windows.Forms.ToolStripButton addFileButton; private System.Windows.Forms.ToolStripButton moveUpButton; @@ -205,6 +243,11 @@ private void InitializeComponent() private System.Windows.Forms.OpenFileDialog addFileDialog; private System.Windows.Forms.ProgressBar progressBar; private System.Windows.Forms.Label helpLabel; + private System.Windows.Forms.ToolStripButton RemoveAllButton; + private System.Windows.Forms.FlowLayoutPanel FileListPanel; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ToolTip toolTip1; } } diff --git a/src/PDFBinder/MainForm.cs b/src/PDFBinder/MainForm.cs index e5ad2b6..6c0ff29 100644 --- a/src/PDFBinder/MainForm.cs +++ b/src/PDFBinder/MainForm.cs @@ -10,6 +10,35 @@ namespace PDFBinder { public partial class MainForm : Form { + + public List selectedItems = new List(); + public Control selectionPendingItem = null; + public Boolean selectionMode = true; + + + public void ResetItemSelection() + { + selectionPendingItem = null; + selectionMode = true; + } + public bool SelectRangeEnd(Control endOfSelectionItem) + { + if (null != selectionPendingItem) { + int start = Math.Min(FileListPanel.Controls.IndexOf(selectionPendingItem), FileListPanel.Controls.IndexOf(endOfSelectionItem)); + int end = Math.Max(FileListPanel.Controls.IndexOf(selectionPendingItem), FileListPanel.Controls.IndexOf(endOfSelectionItem)); + + for (int i = start; i <= end ; i++) { + ((PdfItem)FileListPanel.Controls[i]).Selected = selectionMode; + } + + return true; + } + else + { + return false; + } + } + public MainForm() { InitializeComponent(); @@ -41,7 +70,15 @@ public void AddInputFile(string file) MessageBox.Show(string.Format("PDF document does not allow copying:\n\n{0}", file), "Permission denied", MessageBoxButtons.OK, MessageBoxIcon.Hand); break; case Combiner.SourceTestResult.Ok: - inputListBox.Items.Add(file); + // inputListBox.Items.Add(file); + + PdfItem pi = new PdfItem(); + pi.BinderParentForm = this; + pi.FileName = file; + pi.PageDescriptor = ""; + pi.Selected = false; + FileListPanel.Controls.Add(pi); + passwords[file] = currentPassword; break; case Combiner.SourceTestResult.PasswordRequired: @@ -68,29 +105,60 @@ public void AddInputFile(string file) public void UpdateUI() { - if (inputListBox.Items.Count < 2) + if (FileListPanel.Controls.Count < 1) { completeButton.Enabled = false; helpLabel.Text = "Drop PDF-documents in the box above, or choose \"add document\" from the toolbar"; + RemoveAllButton.Enabled = false; } else { completeButton.Enabled = true; helpLabel.Text = "Click the \"bind!\" button when you are done adding documents"; + RemoveAllButton.Enabled = true; } - if (inputListBox.SelectedIndex < 0) + if (selectedItems.Count < 1) { removeButton.Enabled = moveUpButton.Enabled = moveDownButton.Enabled = false; } else { removeButton.Enabled = true; - moveUpButton.Enabled = (inputListBox.SelectedIndex > 0); - moveDownButton.Enabled = (inputListBox.SelectedIndex < inputListBox.Items.Count - 1); + moveUpButton.Enabled = GetLowestSelectedIndex() > 0; + moveDownButton.Enabled = GetHighestSelectedIndex() < FileListPanel.Controls.Count - 1; } } + private int GetHighestSelectedIndex() + { + int max = -1; + + foreach (PdfItem pi in selectedItems) + { + int thisIndex = FileListPanel.Controls.IndexOf(pi); + if (thisIndex > max) + { + max = thisIndex; + } + } + return max; + } + private int GetLowestSelectedIndex() + { + int min = FileListPanel.Controls.Count - 1; + + foreach (PdfItem pi in selectedItems) + { + int thisIndex = FileListPanel.Controls.IndexOf(pi); + if (thisIndex < min) + { + min = thisIndex; + } + } + return min; + } + private void inputListBox_DragEnter(object sender, DragEventArgs e) { e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop, false) ? DragDropEffects.All : DragDropEffects.None; @@ -118,19 +186,20 @@ private void combineButton_Click(object sender, EventArgs e) progressBar.Visible = true; this.Enabled = false; - for (int i = 0; i < inputListBox.Items.Count; i++) + int i = 0; + foreach (PdfItem pi in FileListPanel.Controls) { byte[] pw ; - bool found_pw = passwords.TryGetValue((string)inputListBox.Items[i], out pw); + bool found_pw = passwords.TryGetValue(pi.FileName, out pw); if (found_pw) { - combiner.AddFile((string)inputListBox.Items[i], pw); + combiner.AddFile(pi.FileName, pw, pi.PageDescriptor ); } else { - combiner.AddFile((string)inputListBox.Items[i]); - } - progressBar.Value = (int)(((i + 1) / (double)inputListBox.Items.Count) * 100); + combiner.AddFile(pi.FileName, new byte[0], pi.PageDescriptor); + } + i += 1; + progressBar.Value = (int)(((i) / (double)FileListPanel.Controls.Count) * 100); } - this.Enabled = true; progressBar.Visible = false; } @@ -147,35 +216,81 @@ private void addFileButton_Click(object sender, EventArgs e) { AddInputFile(file); } - UpdateUI(); } } - private void inputListBox_SelectedIndexChanged(object sender, EventArgs e) + private void removeButton_Click(object sender, EventArgs e) { - UpdateUI(); + RemoveSelected(); } - private void removeButton_Click(object sender, EventArgs e) + private void moveItemButton_Click(object sender, EventArgs e) { - inputListBox.Items.Remove(inputListBox.SelectedItem); + foreach (PdfItem pi in selectedItems) + { + int index = FileListPanel.Controls.IndexOf(pi); + if (sender == moveUpButton) + index--; + if (sender == moveDownButton) + index++; + FileListPanel.Controls.SetChildIndex(pi, index); + } + ResetItemSelection(); + UpdateUI(); } - private void moveItemButton_Click(object sender, EventArgs e) + public void RemoveSelected() { + + int indexOfTopSelected = GetLowestSelectedIndex(); + if (FileListPanel.HasChildren) + { + RemoveItems(selectedItems.ToArray()); + } + selectedItems.Clear(); + + if (FileListPanel.Controls.Count > indexOfTopSelected) + { + ((PdfItem)FileListPanel.Controls[indexOfTopSelected]).Selected = true; + } + + ResetItemSelection(); + UpdateUI(); + } + + void RemoveItems(Control[] removeList) { - object dataItem = inputListBox.SelectedItem; - int index = inputListBox.SelectedIndex; + foreach (Control pi in removeList) + { + FileListPanel.Controls.Remove(pi); + } + } - if (sender == moveUpButton) - index--; - if (sender == moveDownButton) - index++; + private void ClearAllButton_Click(object sender, EventArgs e) + { + if (FileListPanel.HasChildren) + { + Control[] removeList = new Control[FileListPanel.Controls.Count]; + FileListPanel.Controls.CopyTo(removeList,0); + RemoveItems(removeList); + } + selectedItems.Clear(); + ResetItemSelection(); + UpdateUI(); + } - inputListBox.Items.Remove(dataItem); - inputListBox.Items.Insert(index, dataItem); + private void MainForm_Load(object sender, EventArgs e) + { + toolTip1.SetToolTip(label2, "Pages can be left blank for all, or a list of pages. e.g. \"8,16-22,45\""); + } - inputListBox.SelectedIndex = index; + private void MainForm_KeyDown(object sender, KeyEventArgs e) + { + if (!(e.KeyData == Keys.Delete)) + { + return; + } + RemoveSelected(); } } } \ No newline at end of file diff --git a/src/PDFBinder/MainForm.resx b/src/PDFBinder/MainForm.resx index cb1fc7a..ea7a179 100644 --- a/src/PDFBinder/MainForm.resx +++ b/src/PDFBinder/MainForm.resx @@ -124,74 +124,87 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAnVJREFUOE+tk+9L - U1EYx/1btIhgBYpGRoI/iBKMxEulTpvk1HTNTVvkdHfT3Jy7y4m/5oaZBW3lthjpppvTkYqZOLV0kXod - SrRRBEFt7O23e4PdUZgvogcOnDefz3Oe7zknJeV/FzUnS+v2SslOl5hun6yLyl8Ko7IXVXSzXUCKn91I - O7If5WsitJ6myNP1QaxGFhH8uoH1LyvwhJxQecWot1yL1IyVEIdKWFjtFsd8e04c/NjD3KcpWOgRPN4x - wrlvwdLnV6AW5BCMFMcqzEW/S7Q+aaraLQ1P79qw930bo9v9GFjrhiGghjGox1CQgmGzE9MHTpBeEQjT - pXCJsSCVO4nWI1EOL2vw4dsm03EIg1sUdG9USJRmTQ7FogjKZQnc+w5cf3QBRX25Sk7ABjYVcjBHteLB - age6VhSQzzVyggYHH/dmq3BnpgLmd3r0L7XjouE8zQmUE7Vx/8cpDL/XM3ArB/65kXrKoJyvhy04ivzu - rDgnaHVWxydD46A2SHQE7h4pIP11sAcfIkeTnhTIHALaFKBg3NK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bz6PokX3yaU4JMFJ5zvbfB+ + dqDXb0Xbna3L+4dEY1XBRZqXw/ff9cP+tg+33/RgeO4CRl9fxtT8LZyd7cCeIVGuKjjzYB+efnXC/+Ue + vJ8cmP44RpKrkOZH0eM/Cv2gWNo5IAyagI7q11rBSakVx1w6dI43oeNuI87NWDD5YRjdPitM9u2ot4gu + DqtlonMmh1z1MhnH6nHeewRm+y78XPwhU4Zvr1bNhIngo6lIyw2R2z1Yi21GcYK+OUwZIX4DgSZQlgH5 + fMYAAAAASUVORK5CYII= @@ -200,6 +213,9 @@ 348, 17 + + 474, 17 + AAABAAQAEBAAAAEACABoBQAARgAAABgYAAABAAgAyAYAAK4FAAAgIAAAAQAgAKgQAAB2DAAAMDAAAAEA diff --git a/src/PDFBinder/PDFBinder.csproj b/src/PDFBinder/PDFBinder.csproj index d924880..0d2efa7 100644 --- a/src/PDFBinder/PDFBinder.csproj +++ b/src/PDFBinder/PDFBinder.csproj @@ -65,6 +65,12 @@ PasswordEntry.cs + + UserControl + + + PdfItem.cs + @@ -74,6 +80,9 @@ PasswordEntry.cs + + PdfItem.cs + ResXFileCodeGenerator Resources.Designer.cs @@ -85,6 +94,7 @@ True + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/src/PDFBinder/PdfItem.Designer.cs b/src/PDFBinder/PdfItem.Designer.cs new file mode 100644 index 0000000..39e0479 --- /dev/null +++ b/src/PDFBinder/PdfItem.Designer.cs @@ -0,0 +1,86 @@ +namespace PDFBinder +{ + partial class PdfItem + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.FileNameLabel = new System.Windows.Forms.Label(); + this.PageSelection_textBox = new System.Windows.Forms.TextBox(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.SuspendLayout(); + // + // FileNameLabel + // + this.FileNameLabel.AutoEllipsis = true; + this.FileNameLabel.AutoSize = true; + this.FileNameLabel.Location = new System.Drawing.Point(3, 6); + this.FileNameLabel.MaximumSize = new System.Drawing.Size(315, 13); + this.FileNameLabel.Name = "FileNameLabel"; + this.FileNameLabel.Size = new System.Drawing.Size(35, 13); + this.FileNameLabel.TabIndex = 0; + this.FileNameLabel.Text = "label1"; + this.FileNameLabel.Click += new System.EventHandler(this.PdfItem_Click); + // + // PageSelection_textBox + // + this.PageSelection_textBox.Location = new System.Drawing.Point(320, 3); + this.PageSelection_textBox.Name = "PageSelection_textBox"; + this.PageSelection_textBox.Size = new System.Drawing.Size(75, 20); + this.PageSelection_textBox.TabIndex = 1; + this.PageSelection_textBox.TextChanged += new System.EventHandler(this.PageSelection_textBox_TextChanged); + // + // toolTip1 + // + this.toolTip1.AutomaticDelay = 100; + this.toolTip1.AutoPopDelay = 5000; + this.toolTip1.InitialDelay = 100; + this.toolTip1.ReshowDelay = 20; + // + // PdfItem + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.PageSelection_textBox); + this.Controls.Add(this.FileNameLabel); + this.Margin = new System.Windows.Forms.Padding(1); + this.MinimumSize = new System.Drawing.Size(400, 26); + this.Name = "PdfItem"; + this.Size = new System.Drawing.Size(400, 26); + this.Click += new System.EventHandler(this.PdfItem_Click); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label FileNameLabel; + private System.Windows.Forms.TextBox PageSelection_textBox; + private System.Windows.Forms.ToolTip toolTip1; + } +} diff --git a/src/PDFBinder/PdfItem.cs b/src/PDFBinder/PdfItem.cs new file mode 100644 index 0000000..5fa14b6 --- /dev/null +++ b/src/PDFBinder/PdfItem.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Text; +using System.Windows.Forms; + +namespace PDFBinder +{ + public partial class PdfItem : UserControl + { + public PdfItem() + { + InitializeComponent(); + + BinderParentForm = (MainForm)ParentForm; + } + + private MainForm binderParentForm; + public MainForm BinderParentForm + { + get { return binderParentForm; } + set { binderParentForm = value; } + } + + private String fileName; + public String FileName { + get { return fileName;} + set { fileName = value; this.FileNameLabel.Text = fileName; this.toolTip1.SetToolTip(this.FileNameLabel, fileName) ; } + } + + private String pageDescriptor; + public String PageDescriptor { + get { return pageDescriptor;} + set { pageDescriptor = value; this.PageSelection_textBox.Text = pageDescriptor; } + } + + private bool selected; + public bool Selected + { + get { return selected; } + set + { + this.selected = value; + if (this.selected) + { + this.BackColor = SystemColors.Highlight; + BinderParentForm.selectedItems.Add(this); + } + else + { + this.BackColor = SystemColors.Control; + if (BinderParentForm.selectedItems.Contains(this)) + { + BinderParentForm.selectedItems.Remove(this); + } + } + } + } + + private void PdfItem_Click(object sender, EventArgs e) + { + bool handled = false; + if ((ModifierKeys & Keys.Control) == Keys.Control) // keydown + { + this.Selected = !this.Selected; + handled = true; + // not handling control+shift, getting carried away. + } + else if ((ModifierKeys & Keys.Shift) == Keys.Shift) + { + // the other end of a selection, perhaps. + handled = BinderParentForm.SelectRangeEnd(this); + } + + if (!handled) + { + // no keyboard modifier, just select + List tmpSelected = new List(); + tmpSelected.AddRange(BinderParentForm.selectedItems); + foreach (PdfItem pi in tmpSelected) + { + pi.Selected = false; + } + this.Selected = true; + + BinderParentForm.selectionMode = true; + binderParentForm.selectionPendingItem = this; + } + BinderParentForm.UpdateUI(); + } + + private void PageSelection_textBox_TextChanged(object sender, EventArgs e) + { + PageDescriptor = PageSelection_textBox.Text; + } + + + } +} diff --git a/src/PDFBinder/PdfItem.resx b/src/PDFBinder/PdfItem.resx new file mode 100644 index 0000000..850792f --- /dev/null +++ b/src/PDFBinder/PdfItem.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file From 7a32f26a414e17595cc62c66817b1e13cf083d73 Mon Sep 17 00:00:00 2001 From: PURPORC Date: Tue, 10 Mar 2015 15:56:11 +1100 Subject: [PATCH 3/4] Page selection can be open ended, eg. "55-" Can open text file manifests of PDFs to bind. Interface improvements Bump version to 1.3 --- CHANGELOG.txt | 7 ++ src/PDFBInderSetup/PDFBinderSetup.vdproj | 62 ++++------ src/PDFBinder.sln | 9 +- src/PDFBinder/Binder.cs | 61 ++++++++-- src/PDFBinder/MainForm.Designer.cs | 58 ++++----- src/PDFBinder/MainForm.cs | 148 ++++++++++++++++++----- src/PDFBinder/MainForm.resx | 76 ++++++------ src/PDFBinder/PDFBinder.csproj | 57 ++++++++- src/PDFBinder/PdfItem.Designer.cs | 21 ++-- src/PDFBinder/PdfItem.cs | 6 +- src/PDFBinder/Properties/AssemblyInfo.cs | 2 +- 11 files changed, 348 insertions(+), 159 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 2c073bc..52e5f13 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,12 @@ PDFBinder changelog =================== +Version 1.3 +----------- + * Ability to accept password to open PDF. (Requires owner password) + * Select which pages of each file should appear in the output + * Files can be added by adding a txt file manifest. + - password and page number selections can be added to each line with the filename delimited by a "|" + - eg. "D:\work\project1\file1.pdf|Passw0rd|2-8,13,1,1,25-" Version 1.2 ----------- diff --git a/src/PDFBInderSetup/PDFBinderSetup.vdproj b/src/PDFBInderSetup/PDFBinderSetup.vdproj index d24da57..4db15f6 100644 --- a/src/PDFBInderSetup/PDFBinderSetup.vdproj +++ b/src/PDFBInderSetup/PDFBinderSetup.vdproj @@ -21,14 +21,14 @@ } "Entry" { - "MsmKey" = "8:_334B958DF4E2498E9F250950853E2FBC" - "OwnerKey" = "8:_UNDEFINED" + "MsmKey" = "8:_2DE6EF1ABB79F2AA4737A51FF7D76E09" + "OwnerKey" = "8:_25297E5AFFCA4729843496065CE8331B" "MsmSig" = "8:_UNDEFINED" } "Entry" { - "MsmKey" = "8:_7A7D4121338B9A976525C35D744FC34C" - "OwnerKey" = "8:_25297E5AFFCA4729843496065CE8331B" + "MsmKey" = "8:_334B958DF4E2498E9F250950853E2FBC" + "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" @@ -58,7 +58,7 @@ "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_7A7D4121338B9A976525C35D744FC34C" + "OwnerKey" = "8:_2DE6EF1ABB79F2AA4737A51FF7D76E09" "MsmSig" = "8:_UNDEFINED" } } @@ -125,16 +125,6 @@ "ComponentsUrl" = "8:" "Items" { - "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Net.Framework.3.5.SP1" - { - "Name" = "8:.NET Framework 3.5 SP1" - "ProductCode" = "8:Microsoft.Net.Framework.3.5.SP1" - } - "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Windows.Installer.3.1" - { - "Name" = "8:Windows Installer 3.1" - "ProductCode" = "8:Microsoft.Windows.Installer.3.1" - } } } } @@ -200,7 +190,7 @@ { "Name" = "8:.NET Framework" "Message" = "8:[VSDNETMSG]" - "FrameworkVersion" = "8:2.0.50727" + "FrameworkVersion" = "8:ANY" "AllowLaterVersions" = "11:FALSE" "InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=76617" } @@ -208,10 +198,21 @@ } "File" { - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_334B958DF4E2498E9F250950853E2FBC" + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_2DE6EF1ABB79F2AA4737A51FF7D76E09" { - "SourcePath" = "8:setup-banner.jpg" - "TargetName" = "8:setup-banner.jpg" + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:itextsharp, Version=4.1.6.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca" + "ScatterAssemblies" + { + "_2DE6EF1ABB79F2AA4737A51FF7D76E09" + { + "Name" = "8:iTextSharp.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:iTextSharp.dll" + "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_A9D432D1BD184FBBBA449A695853B61D" "Condition" = "8:" @@ -225,24 +226,13 @@ "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" + "IsDependency" = "11:TRUE" "IsolateTo" = "8:" } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_7A7D4121338B9A976525C35D744FC34C" + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_334B958DF4E2498E9F250950853E2FBC" { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:itextsharp, Version=4.1.2.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca" - "ScatterAssemblies" - { - "_7A7D4121338B9A976525C35D744FC34C" - { - "Name" = "8:itextsharp.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:itextsharp.dll" - "TargetName" = "8:" + "SourcePath" = "8:setup-banner.jpg" + "TargetName" = "8:setup-banner.jpg" "Tag" = "8:" "Folder" = "8:_A9D432D1BD184FBBBA449A695853B61D" "Condition" = "8:" @@ -256,7 +246,7 @@ "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" - "IsDependency" = "11:TRUE" + "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_830F5153980D43C59906B09D0D07B2F9" @@ -387,7 +377,7 @@ "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:PDFBinder" "ProductCode" = "8:{8BA03AC2-579F-41CD-A250-740137D86F7A}" - "PackageCode" = "8:{C2BDFFB1-1BF4-4BE1-9DDC-D22E8E551D7E}" + "PackageCode" = "8:{70345C84-5946-4D5B-AF91-053F70F1A334}" "UpgradeCode" = "8:{9B78857D-281F-4FA4-918F-AE20C1B6C342}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" diff --git a/src/PDFBinder.sln b/src/PDFBinder.sln index 1c4204d..dd81ed5 100644 --- a/src/PDFBinder.sln +++ b/src/PDFBinder.sln @@ -1,6 +1,8 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDFBinder", "PDFBinder\PDFBinder.csproj", "{C4013FBF-4357-4580-9E6F-8EF23D5B04E4}" EndProject Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "PDFBinderSetup", "PDFBinderSetup\PDFBinderSetup.vdproj", "{D3AE3A9A-5943-4C92-8241-1EA35FBF7F63}" @@ -13,9 +15,10 @@ Global GlobalSection(ProjectConfigurationPlatforms) = postSolution {C4013FBF-4357-4580-9E6F-8EF23D5B04E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C4013FBF-4357-4580-9E6F-8EF23D5B04E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C4013FBF-4357-4580-9E6F-8EF23D5B04E4}.Debug|Any CPU.Deploy.0 = Debug|Any CPU {C4013FBF-4357-4580-9E6F-8EF23D5B04E4}.Release|Any CPU.ActiveCfg = Release|Any CPU {C4013FBF-4357-4580-9E6F-8EF23D5B04E4}.Release|Any CPU.Build.0 = Release|Any CPU - {D3AE3A9A-5943-4C92-8241-1EA35FBF7F63}.Debug|Any CPU.ActiveCfg = Debug + {D3AE3A9A-5943-4C92-8241-1EA35FBF7F63}.Debug|Any CPU.ActiveCfg = Release {D3AE3A9A-5943-4C92-8241-1EA35FBF7F63}.Release|Any CPU.ActiveCfg = Release EndGlobalSection GlobalSection(SolutionProperties) = preSolution diff --git a/src/PDFBinder/Binder.cs b/src/PDFBinder/Binder.cs index 5512c68..eca90b3 100644 --- a/src/PDFBinder/Binder.cs +++ b/src/PDFBinder/Binder.cs @@ -36,11 +36,18 @@ public PageNumberGeneratorGenerator(String pagesIntent) this.pagesIntent = pagesIntent; } public IEnumerator GetEnumerator() { - return new PageNumberGenerator(this.pagesIntent); + return new PageNumberGenerator(this.pagesIntent, LastPage); } IEnumerator IEnumerable.GetEnumerator() { - return new PageNumberGenerator(this.pagesIntent); + return new PageNumberGenerator(this.pagesIntent, LastPage); + } + + private int lastPage = 0; + public int LastPage + { + get { return lastPage; } + set { lastPage = value; } } } @@ -51,15 +58,22 @@ public class PageRange public int begin; public int end; } + private int lastPage = 0; + public int LastPage + { + get { return lastPage; } + set { lastPage = value; } + } + public bool selectAll = true; public List ranges = new List(); private List.Enumerator placeKeeper; private int lastPageGenerated = 0; - public PageNumberGenerator(String pagesIntent) + public PageNumberGenerator(String pagesIntent, int lastPage) { List output = new List(); string[] regions = pagesIntent.Split(','); - + LastPage = lastPage; foreach (string r in regions) { if (r.Length == 0) @@ -73,7 +87,11 @@ public PageNumberGenerator(String pagesIntent) PageRange pr = new PageRange(); bool ok = int.TryParse(endpointsStrings[0], out pr.begin); if (endpointsStrings.Length == 2 ) { - ok &= int.TryParse(endpointsStrings[1], out pr.end); + if (endpointsStrings[1] == "") { + pr.end = 0; + } else { + ok &= int.TryParse(endpointsStrings[1], out pr.end); + } } if (!ok) { throw new ArgumentException("Region couldn't be parsed " + r); @@ -108,10 +126,27 @@ public bool MoveNext() if (selectAll) { lastPageGenerated += 1; - return true; + return (lastPageGenerated <= LastPage); } int nextPage = lastPageGenerated + 1; - if (placeKeeper.Current == null || nextPage > placeKeeper.Current.end) + bool bMoveForwardToNextRange = false; + if (placeKeeper.Current == null) + { + bMoveForwardToNextRange = true; + + } + else if (placeKeeper.Current.end == 0) // support open-ended selection "5-". + { + if (nextPage > LastPage) + { + bMoveForwardToNextRange = true; + } + } else if (nextPage > placeKeeper.Current.end) + { + bMoveForwardToNextRange = true; + } + + if (bMoveForwardToNextRange) { if (placeKeeper.MoveNext()) { @@ -121,8 +156,8 @@ public bool MoveNext() { return false; } - } + lastPageGenerated = nextPage; return true; } @@ -194,27 +229,27 @@ private void AddPage(PdfReader reader, int p) private void AddPages(PdfReader reader, PageNumberGeneratorGenerator png) { + png.LastPage = reader.NumberOfPages; + try { foreach (int p in png) { - if (p > reader.NumberOfPages) - { - return; - } AddPage(reader, p); } } catch (Exception pdfe) { System.Diagnostics.Debug.Write(pdfe); + throw new PdfException(pdfe.Message); } } public void Dispose() - { + { _document.Close(); } + public static SourceTestResult TestSourceFile(string fileName, byte[] password) { bool tryAgain = false; diff --git a/src/PDFBinder/MainForm.Designer.cs b/src/PDFBinder/MainForm.Designer.cs index 7d088f7..232d408 100644 --- a/src/PDFBinder/MainForm.Designer.cs +++ b/src/PDFBinder/MainForm.Designer.cs @@ -44,8 +44,8 @@ private void InitializeComponent() this.progressBar = new System.Windows.Forms.ProgressBar(); this.helpLabel = new System.Windows.Forms.Label(); this.FileListPanel = new System.Windows.Forms.FlowLayoutPanel(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); + this.labelTitleFileName = new System.Windows.Forms.Label(); + this.labelTitlePages = new System.Windows.Forms.Label(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.toolStrip1.SuspendLayout(); this.SuspendLayout(); @@ -147,17 +147,19 @@ private void InitializeComponent() // addFileDialog // this.addFileDialog.DefaultExt = "pdf"; - this.addFileDialog.Filter = "PDF documents|*.pdf"; + this.addFileDialog.Filter = "All supported types|*.pdf;*.txt|PDF documents|*.pdf|Plain text list of PDFs|*.txt" + + ""; this.addFileDialog.Multiselect = true; + this.addFileDialog.FileOk += new System.ComponentModel.CancelEventHandler(this.addFileDialog_FileOk); // // progressBar // this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.progressBar.Location = new System.Drawing.Point(0, 196); + this.progressBar.Location = new System.Drawing.Point(0, 203); this.progressBar.MaximumSize = new System.Drawing.Size(0, 16); this.progressBar.Name = "progressBar"; - this.progressBar.Size = new System.Drawing.Size(429, 16); + this.progressBar.Size = new System.Drawing.Size(0, 16); this.progressBar.TabIndex = 2; this.progressBar.Visible = false; // @@ -166,7 +168,7 @@ private void InitializeComponent() this.helpLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.helpLabel.AutoSize = true; - this.helpLabel.Location = new System.Drawing.Point(4, 196); + this.helpLabel.Location = new System.Drawing.Point(4, 203); this.helpLabel.Name = "helpLabel"; this.helpLabel.Size = new System.Drawing.Size(0, 13); this.helpLabel.TabIndex = 3; @@ -181,41 +183,43 @@ private void InitializeComponent() this.FileListPanel.Location = new System.Drawing.Point(0, 42); this.FileListPanel.MinimumSize = new System.Drawing.Size(423, 150); this.FileListPanel.Name = "FileListPanel"; - this.FileListPanel.Size = new System.Drawing.Size(429, 151); + this.FileListPanel.Size = new System.Drawing.Size(429, 158); this.FileListPanel.TabIndex = 4; // - // label1 + // labelTitleFileName // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(15, 27); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(52, 13); - this.label1.TabIndex = 5; - this.label1.Text = "File name"; + this.labelTitleFileName.AutoSize = true; + this.labelTitleFileName.Location = new System.Drawing.Point(15, 27); + this.labelTitleFileName.Name = "labelTitleFileName"; + this.labelTitleFileName.Size = new System.Drawing.Size(52, 13); + this.labelTitleFileName.TabIndex = 5; + this.labelTitleFileName.Text = "File name"; + this.labelTitleFileName.Visible = false; // - // label2 + // labelTitlePages // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(345, 27); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(37, 13); - this.label2.TabIndex = 5; - this.label2.Text = "Pages"; + this.labelTitlePages.AutoSize = true; + this.labelTitlePages.Location = new System.Drawing.Point(345, 27); + this.labelTitlePages.Name = "labelTitlePages"; + this.labelTitlePages.Size = new System.Drawing.Size(37, 13); + this.labelTitlePages.TabIndex = 5; + this.labelTitlePages.Text = "Pages"; + this.labelTitlePages.Visible = false; // // MainForm // this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(429, 215); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); + this.ClientSize = new System.Drawing.Size(429, 222); + this.Controls.Add(this.labelTitlePages); + this.Controls.Add(this.labelTitleFileName); this.Controls.Add(this.progressBar); this.Controls.Add(this.FileListPanel); this.Controls.Add(this.helpLabel); this.Controls.Add(this.toolStrip1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MinimumSize = new System.Drawing.Size(445, 240); + this.MinimumSize = new System.Drawing.Size(445, 260); this.Name = "MainForm"; this.Text = "PDFBinder"; this.Load += new System.EventHandler(this.MainForm_Load); @@ -245,8 +249,8 @@ private void InitializeComponent() private System.Windows.Forms.Label helpLabel; private System.Windows.Forms.ToolStripButton RemoveAllButton; private System.Windows.Forms.FlowLayoutPanel FileListPanel; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label labelTitleFileName; + private System.Windows.Forms.Label labelTitlePages; private System.Windows.Forms.ToolTip toolTip1; } } diff --git a/src/PDFBinder/MainForm.cs b/src/PDFBinder/MainForm.cs index 6c0ff29..3209a8b 100644 --- a/src/PDFBinder/MainForm.cs +++ b/src/PDFBinder/MainForm.cs @@ -5,6 +5,7 @@ using System.Drawing; using System.Text; using System.Windows.Forms; +using iTextSharp.text.pdf; namespace PDFBinder { @@ -57,28 +58,68 @@ public static byte[] StrToByteArray(string str) public void AddInputFile(string file) { + // to open a text file with a list of pdfs (or further text files, i guess) to be added + if (file.EndsWith(".txt")) + { + string[] pdf_files = System.IO.File.ReadAllLines(file); + foreach (string item in pdf_files) + { + AddInputFile(item); + } + // txt file itself is not to be bound in to the output pdf. + return; + } + + // support password in txt manifest files delimited by pipe character "|" + // support page selection in txt manifest files + string filename = null; + string password = null; + string pageSelections = ""; + string[] item_info = file.Split('|'); + if (item_info.Length > 0) + { + filename = item_info[0]; + if (item_info.Length > 1) + { + password = item_info[1]; + } + pageSelections = ""; + if (item_info.Length > 2) + { + pageSelections = item_info[2]; + } + } + + if (! System.IO.File.Exists(filename)) + { + MessageBox.Show(string.Format("File not found:\n\n{0}", filename), "File not found", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + Boolean tryAgain = true; Boolean newPassword = false; while (tryAgain || newPassword) { newPassword = false; - switch (Combiner.TestSourceFile(file, currentPassword)) + switch (Combiner.TestSourceFile(filename, currentPassword)) { case Combiner.SourceTestResult.Unreadable: - MessageBox.Show(string.Format("File could not be opened as a PDF document:\n\n{0}", file), "Illegal file type", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(string.Format("File could not be opened as a PDF document:\n\n{0}", filename), "Illegal file type", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case Combiner.SourceTestResult.Protected: - MessageBox.Show(string.Format("PDF document does not allow copying:\n\n{0}", file), "Permission denied", MessageBoxButtons.OK, MessageBoxIcon.Hand); + MessageBox.Show(string.Format("PDF document does not allow copying:\n\n{0}", filename), "Permission denied", MessageBoxButtons.OK, MessageBoxIcon.Hand); break; case Combiner.SourceTestResult.Ok: // inputListBox.Items.Add(file); PdfItem pi = new PdfItem(); pi.BinderParentForm = this; - pi.FileName = file; - pi.PageDescriptor = ""; + pi.FileName = filename; + pi.PageDescriptor = pageSelections; pi.Selected = false; FileListPanel.Controls.Add(pi); - + if (password != null) { + currentPassword = StrToByteArray(password); + } passwords[file] = currentPassword; break; case Combiner.SourceTestResult.PasswordRequired: @@ -105,19 +146,23 @@ public void AddInputFile(string file) public void UpdateUI() { - if (FileListPanel.Controls.Count < 1) + bool isPopulated = (FileListPanel.Controls.Count > 0); + + if (!isPopulated) { - completeButton.Enabled = false; - helpLabel.Text = "Drop PDF-documents in the box above, or choose \"add document\" from the toolbar"; - RemoveAllButton.Enabled = false; + helpLabel.Text = "Drop PDF-documents in the box above, or choose \"Add file...\" from the toolbar"; } else { - completeButton.Enabled = true; helpLabel.Text = "Click the \"bind!\" button when you are done adding documents"; - RemoveAllButton.Enabled = true; } + completeButton.Enabled = isPopulated; + RemoveAllButton.Enabled = isPopulated; + labelTitleFileName.Visible = isPopulated; + labelTitlePages.Visible = isPopulated; + + if (selectedItems.Count < 1) { removeButton.Enabled = moveUpButton.Enabled = moveDownButton.Enabled = false; @@ -177,34 +222,74 @@ private void inputListBox_DragDrop(object sender, DragEventArgs e) UpdateUI(); } - private void combineButton_Click(object sender, EventArgs e) + private void combineFiles(string saveFileName, out int countFilesBound, out string diagnostic) { - if (saveFileDialog.ShowDialog() == DialogResult.OK) + diagnostic = ""; + using (var combiner = new Combiner(saveFileName)) { - using (var combiner = new Combiner(saveFileDialog.FileName)) - { - progressBar.Visible = true; - this.Enabled = false; + progressBar.Visible = true; + this.Enabled = false; - int i = 0; - foreach (PdfItem pi in FileListPanel.Controls) + int i = 0; + foreach (PdfItem pi in FileListPanel.Controls) + { + try { - byte[] pw ; + byte[] pw; bool found_pw = passwords.TryGetValue(pi.FileName, out pw); - if (found_pw) { - combiner.AddFile(pi.FileName, pw, pi.PageDescriptor ); - } else { + if (found_pw && pw != null) + { + combiner.AddFile(pi.FileName, pw, pi.PageDescriptor); + } + else + { combiner.AddFile(pi.FileName, new byte[0], pi.PageDescriptor); } - i += 1; - progressBar.Value = (int)(((i) / (double)FileListPanel.Controls.Count) * 100); + + } + catch (PdfException pdfe) + { + diagnostic += pi.FileName + ": " + pdfe.Message + "\n"; + } + i += 1; + progressBar.Value = (int)(((i) / (double)FileListPanel.Controls.Count) * 100); + } + + countFilesBound = i; + + + return; + } + + } + + private void combineButton_Click(object sender, EventArgs e) + { + string diagnostic = null; + int successfullyBoundFilesCount = 0; + + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + try + { + combineFiles(saveFileDialog.FileName, out successfullyBoundFilesCount, out diagnostic); + } + catch (System.IO.IOException ioe) + { + // this happens if empty document is created + MessageBox.Show("Error closing bound document. " + ioe.Message); + } - this.Enabled = true; - progressBar.Visible = false; + this.Enabled = true; + progressBar.Visible = false; + if (diagnostic != "") + { + MessageBox.Show("There were some problems binding the files:\n\n" + diagnostic); } System.Diagnostics.Process.Start(saveFileDialog.FileName); + } } @@ -281,7 +366,7 @@ private void ClearAllButton_Click(object sender, EventArgs e) private void MainForm_Load(object sender, EventArgs e) { - toolTip1.SetToolTip(label2, "Pages can be left blank for all, or a list of pages. e.g. \"8,16-22,45\""); + toolTip1.SetToolTip(labelTitlePages, "Pages can be left blank for all, or a list of pages. e.g. \"8,16-22,45\""); } private void MainForm_KeyDown(object sender, KeyEventArgs e) @@ -292,5 +377,10 @@ private void MainForm_KeyDown(object sender, KeyEventArgs e) } RemoveSelected(); } + + private void addFileDialog_FileOk(object sender, CancelEventArgs e) + { + + } } } \ No newline at end of file diff --git a/src/PDFBinder/MainForm.resx b/src/PDFBinder/MainForm.resx index ea7a179..fb453c5 100644 --- a/src/PDFBinder/MainForm.resx +++ b/src/PDFBinder/MainForm.resx @@ -124,34 +124,34 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR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42xawBSLRVzxtWNk7jS6 + pvYim89sLOj3H8S1R+3ofdiG7mkDbr48hWcLLtieH4fVuQMNurrD/xX0+Q7g1fdJvPg2oQSfLDjhfG+D + 97MDvX4r2u5sXd4/JBqrCi7SvBy+/64f9rd9uP2mB8NzFzD6+jKm5m/h7GwH9gyJclXBmQf78PSrE/4v + 9+D95MD0xzGSXIU0P4oe/1HoB8XSzgFh0AS0Tb/WCk5KrTjm0qFzvAkddxtxbsaCyQ/D6PZZYbJvR71F + dHFYLRMJZKLqYTKO1eO89wjM9l34ufhDpgyfXq2aCRPBW1ORlhsit3uwFtuM4gQ9c5gyQvwGM/tQbJ4d + 7UEAAAAASUVORK5CYII= diff --git a/src/PDFBinder/PDFBinder.csproj b/src/PDFBinder/PDFBinder.csproj index 0d2efa7..deaf878 100644 --- a/src/PDFBinder/PDFBinder.csproj +++ b/src/PDFBinder/PDFBinder.csproj @@ -14,11 +14,28 @@ 512 - application.res + E:\work\dotnet\pdfbinder\src\PDFBinder\application.res 3.5 + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + true + 2 + 1.0.0.%2a + false + true + true true @@ -37,6 +54,29 @@ prompt 4 + + 40038AB39C635999A9FB4B8B0830C363811B7D0E + + + PDFBinder_TemporaryKey.pfx + + + false + + + false + + + Custom + + + + PDFBinder.Program + + + false + + False @@ -111,6 +151,21 @@ + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + false + + + + +