diff --git a/Compress_PDF_WF/Compress_PDF_WF.sln b/Compress_PDF_WF/Compress_PDF_WF.sln
index e1bdb58..377b609 100644
--- a/Compress_PDF_WF/Compress_PDF_WF.sln
+++ b/Compress_PDF_WF/Compress_PDF_WF.sln
@@ -1,9 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
-VisualStudioVersion = 17.8.34330.188
+VisualStudioVersion = 17.13.35723.152 d17.13
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Compress_PDF_WF", "Compress_PDF_WF\Compress_PDF_WF.csproj", "{23809827-FED7-4840-A6E6-38C98E5FA317}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Compress_PDF_WF", "Compress_PDF_WF\Compress_PDF_WF.csproj", "{6E605CF4-7023-48A0-A4FA-72FCBF62A5CF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -11,15 +11,15 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {23809827-FED7-4840-A6E6-38C98E5FA317}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {23809827-FED7-4840-A6E6-38C98E5FA317}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {23809827-FED7-4840-A6E6-38C98E5FA317}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {23809827-FED7-4840-A6E6-38C98E5FA317}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6E605CF4-7023-48A0-A4FA-72FCBF62A5CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6E605CF4-7023-48A0-A4FA-72FCBF62A5CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6E605CF4-7023-48A0-A4FA-72FCBF62A5CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6E605CF4-7023-48A0-A4FA-72FCBF62A5CF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {F4E25BA2-C8F0-40F5-A542-842697BD9403}
+ SolutionGuid = {54DE6734-1CF7-4DF5-9132-16DCF0D59EC8}
EndGlobalSection
EndGlobal
diff --git a/Compress_PDF_WF/Compress_PDF_WF/Compress_PDF_WF.csproj.user b/Compress_PDF_WF/Compress_PDF_WF/Compress_PDF_WF.csproj.user
deleted file mode 100644
index 7814ea2..0000000
--- a/Compress_PDF_WF/Compress_PDF_WF/Compress_PDF_WF.csproj.user
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
- Form
-
-
-
diff --git a/Compress_PDF_WF/Compress_PDF_WF/Form1.Designer.cs b/Compress_PDF_WF/Compress_PDF_WF/Form1.Designer.cs
index 9f0ac67..e46310e 100644
--- a/Compress_PDF_WF/Compress_PDF_WF/Form1.Designer.cs
+++ b/Compress_PDF_WF/Compress_PDF_WF/Form1.Designer.cs
@@ -29,325 +29,312 @@ protected override void Dispose(bool disposing)
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
- this.compressPDF = new System.Windows.Forms.Button();
- this.label1 = new System.Windows.Forms.Label();
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.button2 = new System.Windows.Forms.Button();
- this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
- this.compressImage = new System.Windows.Forms.CheckBox();
- this.optimizeFont = new System.Windows.Forms.CheckBox();
- this.compressPageContents = new System.Windows.Forms.CheckBox();
- this.imageQuality = new System.Windows.Forms.ComboBox();
- this.removeMetadata = new System.Windows.Forms.CheckBox();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.incrementalUpdate = new System.Windows.Forms.CheckBox();
- this.removeFormFields = new System.Windows.Forms.CheckBox();
- this.removeAnnotation = new System.Windows.Forms.CheckBox();
- this.label2 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.label4 = new System.Windows.Forms.Label();
- this.ods = new System.Windows.Forms.Label();
- this.cds = new System.Windows.Forms.Label();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
- this.groupBox3.SuspendLayout();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.Size = new System.Drawing.Size(500, 524);
- this.SuspendLayout();
- //
- // compressPDF
- //
- this.compressPDF.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.compressPDF.BackColor = System.Drawing.Color.Transparent;
- this.compressPDF.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(128)))));
- this.compressPDF.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
- this.compressPDF.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
- this.compressPDF.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.compressPDF.Location = new System.Drawing.Point(260, 408);
- this.compressPDF.Name = "compressPDF";
- this.compressPDF.Size = new System.Drawing.Size(117, 24);
- this.compressPDF.TabIndex = 25;
- this.compressPDF.Text = "Compress PDF";
- this.compressPDF.UseVisualStyleBackColor = false;
- this.compressPDF.Click += new System.EventHandler(this.compressPDF_Click);
+ pictureBox1 = new PictureBox();
+ groupBox1 = new GroupBox();
+ browseButton = new Button();
+ textBox1 = new TextBox();
+ groupBox2 = new GroupBox();
+ imageQuality = new ComboBox();
+ label1 = new Label();
+ removeFormFields = new CheckBox();
+ disableIncrementalUpdates = new CheckBox();
+ removeMetadata = new CheckBox();
+ removeAttachments = new CheckBox();
+ removeAnnotations = new CheckBox();
+ optimizeFont = new CheckBox();
+ optimizePageContents = new CheckBox();
+ compressImage = new CheckBox();
+ compressPdf = new Button();
+ groupBox3 = new GroupBox();
+ cds = new Label();
+ ods = new Label();
+ label3 = new Label();
+ label2 = new Label();
+ label4 = new Label();
+ openFileDialog1 = new OpenFileDialog();
+ ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
+ groupBox1.SuspendLayout();
+ groupBox2.SuspendLayout();
+ groupBox3.SuspendLayout();
+ SuspendLayout();
//
- // label1
+ // pictureBox1
//
- this.label1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
- this.label1.Location = new System.Drawing.Point(-3, 92);
- this.label1.Name = "label1";
- this.label1.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
- this.label1.Size = new System.Drawing.Size(382, 55);
- this.label1.TabIndex = 26;
- this.label1.Text = resources.GetString("label1.Text");
+ pictureBox1.Image = (Image)resources.GetObject("pictureBox1.Image");
+ pictureBox1.InitialImage = null;
+ pictureBox1.Location = new Point(0, 0);
+ pictureBox1.Name = "pictureBox1";
+ pictureBox1.Size = new Size(509, 107);
+ pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
+ pictureBox1.TabIndex = 0;
+ pictureBox1.TabStop = false;
//
- // pictureBox1
+ // groupBox1
//
- this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Top;
- this.pictureBox1.Location = new System.Drawing.Point(0, 0);
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(389, 89);
- this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
- this.pictureBox1.TabIndex = 27;
- this.pictureBox1.TabStop = false;
+ groupBox1.Controls.Add(browseButton);
+ groupBox1.Controls.Add(textBox1);
+ groupBox1.Location = new Point(12, 194);
+ groupBox1.Name = "groupBox1";
+ groupBox1.Size = new Size(484, 82);
+ groupBox1.TabIndex = 1;
+ groupBox1.TabStop = false;
+ groupBox1.Text = "Choose a PDF file to compress";
+ //
+ // browseButton
+ //
+ browseButton.Location = new Point(420, 38);
+ browseButton.Name = "browseButton";
+ browseButton.Size = new Size(49, 23);
+ browseButton.TabIndex = 1;
+ browseButton.Text = "...";
+ browseButton.UseVisualStyleBackColor = true;
+ browseButton.Click += browseButton_Click;
//
// textBox1
//
- this.textBox1.Location = new System.Drawing.Point(6, 27);
- this.textBox1.Name = "textBox1";
- this.textBox1.Size = new System.Drawing.Size(318, 21);
- this.textBox1.TabIndex = 31;
+ textBox1.Location = new Point(6, 39);
+ textBox1.Name = "textBox1";
+ textBox1.Size = new Size(408, 23);
+ textBox1.TabIndex = 0;
//
- // groupBox3
+ // groupBox2
//
- this.groupBox3.Controls.Add(this.textBox1);
- this.groupBox3.Controls.Add(this.button2);
- this.groupBox3.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.groupBox3.Location = new System.Drawing.Point(5, 154);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(379, 64);
- this.groupBox3.TabIndex = 32;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "Choose a PDF file to compress";
- //
- // button2
- //
- this.button2.Location = new System.Drawing.Point(331, 27);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(37, 22);
- this.button2.TabIndex = 33;
- this.button2.Text = "...";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
+ groupBox2.Controls.Add(imageQuality);
+ groupBox2.Controls.Add(label1);
+ groupBox2.Controls.Add(removeFormFields);
+ groupBox2.Controls.Add(disableIncrementalUpdates);
+ groupBox2.Controls.Add(removeMetadata);
+ groupBox2.Controls.Add(removeAttachments);
+ groupBox2.Controls.Add(removeAnnotations);
+ groupBox2.Controls.Add(optimizeFont);
+ groupBox2.Controls.Add(optimizePageContents);
+ groupBox2.Controls.Add(compressImage);
+ groupBox2.Location = new Point(12, 295);
+ groupBox2.Name = "groupBox2";
+ groupBox2.Size = new Size(484, 228);
+ groupBox2.TabIndex = 2;
+ groupBox2.TabStop = false;
+ groupBox2.Text = "Compression Options";
//
- // openFileDialog1
+ // imageQuality
//
- this.openFileDialog1.FileName = "openFileDialog1";
+ imageQuality.FormattingEnabled = true;
+ imageQuality.Location = new Point(373, 21);
+ imageQuality.Name = "imageQuality";
+ imageQuality.Size = new Size(98, 23);
+ imageQuality.TabIndex = 9;
//
- // compressImage
+ // label1
//
- this.compressImage.AutoSize = true;
- this.compressImage.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.compressImage.Location = new System.Drawing.Point(6, 29);
- this.compressImage.Name = "compressImage";
- this.compressImage.Size = new System.Drawing.Size(131, 17);
- this.compressImage.TabIndex = 34;
- this.compressImage.Text = "Compress Images";
- this.compressImage.UseVisualStyleBackColor = true;
- this.compressImage.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
+ label1.AutoSize = true;
+ label1.Location = new Point(268, 29);
+ label1.Name = "label1";
+ label1.Size = new Size(81, 15);
+ label1.TabIndex = 8;
+ label1.Text = "Image Quality";
//
- // optimizeFont
+ // removeFormFields
//
- this.optimizeFont.AutoSize = true;
- this.optimizeFont.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.optimizeFont.Location = new System.Drawing.Point(6, 102);
- this.optimizeFont.Name = "optimizeFont";
- this.optimizeFont.Size = new System.Drawing.Size(104, 17);
- this.optimizeFont.TabIndex = 35;
- this.optimizeFont.Text = "Optimize Font";
- this.optimizeFont.UseVisualStyleBackColor = true;
- //
- // compressPageContents
- //
- this.compressPageContents.AutoSize = true;
- this.compressPageContents.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.compressPageContents.Location = new System.Drawing.Point(6, 66);
- this.compressPageContents.Name = "compressPageContents";
- this.compressPageContents.Size = new System.Drawing.Size(163, 17);
- this.compressPageContents.TabIndex = 36;
- this.compressPageContents.Text = "Optimize Page Contents";
- this.compressPageContents.UseVisualStyleBackColor = true;
+ removeFormFields.AutoSize = true;
+ removeFormFields.Location = new Point(268, 153);
+ removeFormFields.Name = "removeFormFields";
+ removeFormFields.Size = new Size(133, 19);
+ removeFormFields.TabIndex = 7;
+ removeFormFields.Text = "Remove Form Fields";
+ removeFormFields.UseVisualStyleBackColor = true;
//
- // imageQuality
+ // disableIncrementalUpdates
//
- this.imageQuality.FormattingEnabled = true;
- this.imageQuality.Location = new System.Drawing.Point(289, 27);
- this.imageQuality.Name = "imageQuality";
- this.imageQuality.Size = new System.Drawing.Size(79, 21);
- this.imageQuality.TabIndex = 37;
+ disableIncrementalUpdates.AutoSize = true;
+ disableIncrementalUpdates.Location = new Point(268, 110);
+ disableIncrementalUpdates.Name = "disableIncrementalUpdates";
+ disableIncrementalUpdates.Size = new Size(176, 19);
+ disableIncrementalUpdates.TabIndex = 6;
+ disableIncrementalUpdates.Text = "Disable Incremental Updates";
+ disableIncrementalUpdates.UseVisualStyleBackColor = true;
//
// removeMetadata
//
- this.removeMetadata.AutoSize = true;
- this.removeMetadata.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.removeMetadata.Location = new System.Drawing.Point(175, 66);
- this.removeMetadata.Name = "removeMetadata";
- this.removeMetadata.Size = new System.Drawing.Size(200, 17);
- this.removeMetadata.TabIndex = 38;
- this.removeMetadata.Text = "Remove Metadata Information";
- this.removeMetadata.UseVisualStyleBackColor = true;
+ removeMetadata.AutoSize = true;
+ removeMetadata.Location = new Point(268, 69);
+ removeMetadata.Name = "removeMetadata";
+ removeMetadata.Size = new Size(188, 19);
+ removeMetadata.TabIndex = 5;
+ removeMetadata.Text = "Remove Metadata Information";
+ removeMetadata.UseVisualStyleBackColor = true;
+ //
+ // removeAttachments
+ //
+ removeAttachments.AutoSize = true;
+ removeAttachments.Location = new Point(13, 198);
+ removeAttachments.Name = "removeAttachments";
+ removeAttachments.Size = new Size(140, 19);
+ removeAttachments.TabIndex = 4;
+ removeAttachments.Text = "Remove Attachments";
+ removeAttachments.UseVisualStyleBackColor = true;
+ //
+ // removeAnnotations
+ //
+ removeAnnotations.AutoSize = true;
+ removeAnnotations.Location = new Point(12, 153);
+ removeAnnotations.Name = "removeAnnotations";
+ removeAnnotations.Size = new Size(137, 19);
+ removeAnnotations.TabIndex = 3;
+ removeAnnotations.Text = "Remove Annotations";
+ removeAnnotations.UseVisualStyleBackColor = true;
//
- // groupBox1
+ // optimizeFont
//
- this.groupBox1.Controls.Add(this.incrementalUpdate);
- this.groupBox1.Controls.Add(this.removeFormFields);
- this.groupBox1.Controls.Add(this.removeAnnotation);
- this.groupBox1.Controls.Add(this.label2);
- this.groupBox1.Controls.Add(this.compressImage);
- this.groupBox1.Controls.Add(this.removeMetadata);
- this.groupBox1.Controls.Add(this.imageQuality);
- this.groupBox1.Controls.Add(this.compressPageContents);
- this.groupBox1.Controls.Add(this.optimizeFont);
- this.groupBox1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.groupBox1.Location = new System.Drawing.Point(5, 229);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(379, 170);
- this.groupBox1.TabIndex = 39;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "Compression Options";
- //
- // incrementalUpdate
- //
- this.incrementalUpdate.AutoSize = true;
- this.incrementalUpdate.Checked = true;
- this.incrementalUpdate.CheckState = System.Windows.Forms.CheckState.Checked;
- this.incrementalUpdate.Location = new System.Drawing.Point(175, 102);
- this.incrementalUpdate.Name = "incrementalUpdate";
- this.incrementalUpdate.Size = new System.Drawing.Size(183, 17);
- this.incrementalUpdate.TabIndex = 43;
- this.incrementalUpdate.Text = "Disable incremental Update";
- this.incrementalUpdate.UseVisualStyleBackColor = true;
+ optimizeFont.AutoSize = true;
+ optimizeFont.Location = new Point(12, 110);
+ optimizeFont.Name = "optimizeFont";
+ optimizeFont.Size = new Size(101, 19);
+ optimizeFont.TabIndex = 2;
+ optimizeFont.Text = "Optimize Font";
+ optimizeFont.UseVisualStyleBackColor = true;
//
- // removeFormFields
+ // optimizePageContents
//
- this.removeFormFields.AutoSize = true;
- this.removeFormFields.Location = new System.Drawing.Point(175, 134);
- this.removeFormFields.Name = "removeFormFields";
- this.removeFormFields.Size = new System.Drawing.Size(142, 17);
- this.removeFormFields.TabIndex = 42;
- this.removeFormFields.Text = "Remove Form Fields";
- this.removeFormFields.UseVisualStyleBackColor = true;
+ optimizePageContents.AutoSize = true;
+ optimizePageContents.Location = new Point(12, 69);
+ optimizePageContents.Name = "optimizePageContents";
+ optimizePageContents.Size = new Size(154, 19);
+ optimizePageContents.TabIndex = 1;
+ optimizePageContents.Text = "Optimize Page Contents";
+ optimizePageContents.UseVisualStyleBackColor = true;
//
- // removeAnnotation
+ // compressImage
//
- this.removeAnnotation.AutoSize = true;
- this.removeAnnotation.Location = new System.Drawing.Point(6, 134);
- this.removeAnnotation.Name = "removeAnnotation";
- this.removeAnnotation.Size = new System.Drawing.Size(144, 17);
- this.removeAnnotation.TabIndex = 41;
- this.removeAnnotation.Text = "Remove Annotations";
- this.removeAnnotation.UseVisualStyleBackColor = true;
+ compressImage.AutoSize = true;
+ compressImage.Location = new Point(13, 30);
+ compressImage.Name = "compressImage";
+ compressImage.Size = new Size(120, 19);
+ compressImage.TabIndex = 0;
+ compressImage.Text = "Compress Images";
+ compressImage.UseVisualStyleBackColor = true;
+ compressImage.CheckedChanged += compressImage_CheckedChanged;
+ //
+ // compressPdf
+ //
+ compressPdf.Location = new Point(359, 553);
+ compressPdf.Name = "compressPdf";
+ compressPdf.Size = new Size(137, 28);
+ compressPdf.TabIndex = 3;
+ compressPdf.Text = "Compress PDF";
+ compressPdf.UseVisualStyleBackColor = true;
+ compressPdf.Click += compressPdf_Click;
//
- // label2
+ // groupBox3
//
- this.label2.AutoSize = true;
- this.label2.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label2.Location = new System.Drawing.Point(172, 30);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(88, 13);
- this.label2.TabIndex = 39;
- this.label2.Text = "Image Quality";
+ groupBox3.Controls.Add(cds);
+ groupBox3.Controls.Add(ods);
+ groupBox3.Controls.Add(label3);
+ groupBox3.Controls.Add(label2);
+ groupBox3.Location = new Point(12, 596);
+ groupBox3.Name = "groupBox3";
+ groupBox3.Size = new Size(484, 94);
+ groupBox3.TabIndex = 4;
+ groupBox3.TabStop = false;
+ groupBox3.Text = "Result";
//
- // label3
+ // cds
//
- this.label3.AutoSize = true;
- this.label3.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label3.Location = new System.Drawing.Point(6, 25);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(150, 13);
- this.label3.TabIndex = 0;
- this.label3.Text = "Original document size : ";
+ cds.AutoSize = true;
+ cds.Location = new Point(234, 65);
+ cds.Name = "cds";
+ cds.Size = new Size(38, 15);
+ cds.TabIndex = 3;
+ cds.Text = "label6";
//
- // label4
+ // ods
//
- this.label4.AutoSize = true;
- this.label4.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label4.Location = new System.Drawing.Point(6, 50);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(174, 13);
- this.label4.TabIndex = 1;
- this.label4.Text = "Compressed document size :";
+ ods.AutoSize = true;
+ ods.Location = new Point(234, 34);
+ ods.Name = "ods";
+ ods.Size = new Size(38, 15);
+ ods.TabIndex = 2;
+ ods.Text = "lable6";
+ ods.UseMnemonic = false;
//
- // ods
+ // label3
//
- this.ods.AutoSize = true;
- this.ods.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.ods.Location = new System.Drawing.Point(205, 25);
- this.ods.Name = "ods";
- this.ods.Size = new System.Drawing.Size(41, 13);
- this.ods.TabIndex = 3;
- this.ods.Text = "label6";
+ label3.AutoSize = true;
+ label3.Location = new Point(13, 65);
+ label3.Name = "label3";
+ label3.Size = new Size(156, 15);
+ label3.TabIndex = 1;
+ label3.Text = "Compressed document size:";
//
- // cds
+ // label2
//
- this.cds.AutoSize = true;
- this.cds.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.cds.Location = new System.Drawing.Point(205, 50);
- this.cds.Name = "cds";
- this.cds.Size = new System.Drawing.Size(41, 13);
- this.cds.TabIndex = 4;
- this.cds.Text = "label6";
+ label2.AutoSize = true;
+ label2.Location = new Point(12, 34);
+ label2.Name = "label2";
+ label2.Size = new Size(135, 15);
+ label2.TabIndex = 0;
+ label2.Text = "Original document size: ";
//
- // groupBox2
+ // label4
+ //
+ label4.Location = new Point(12, 122);
+ label4.Name = "label4";
+ label4.Size = new Size(484, 55);
+ label4.TabIndex = 5;
+ label4.Text = resources.GetString("label4.Text");
+ //
+ // openFileDialog1
//
- this.groupBox2.Controls.Add(this.label3);
- this.groupBox2.Controls.Add(this.cds);
- this.groupBox2.Controls.Add(this.label4);
- this.groupBox2.Controls.Add(this.ods);
- this.groupBox2.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.groupBox2.Location = new System.Drawing.Point(5, 440);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(379, 81);
- this.groupBox2.TabIndex = 40;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "Result";
+ openFileDialog1.FileName = "openFileDialog1";
//
// Form1
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.White;
- this.ClientSize = new System.Drawing.Size(389, 524);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.compressPDF);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.pictureBox1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "Form1";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "Compress Existing PDF";
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
- this.groupBox3.ResumeLayout(false);
- this.groupBox3.PerformLayout();
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.groupBox2.ResumeLayout(false);
- this.groupBox2.PerformLayout();
- this.ResumeLayout(false);
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ BackColor = SystemColors.ControlLightLight;
+ ClientSize = new Size(508, 702);
+ Controls.Add(label4);
+ Controls.Add(groupBox3);
+ Controls.Add(compressPdf);
+ Controls.Add(groupBox2);
+ Controls.Add(groupBox1);
+ Controls.Add(pictureBox1);
+ MaximizeBox = false;
+ Name = "Form1";
+ Text = "Compress Existing PDF";
+ ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
+ groupBox1.ResumeLayout(false);
+ groupBox1.PerformLayout();
+ groupBox2.ResumeLayout(false);
+ groupBox2.PerformLayout();
+ groupBox3.ResumeLayout(false);
+ groupBox3.PerformLayout();
+ ResumeLayout(false);
}
#endregion
- private System.Windows.Forms.Button compressPDF;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.PictureBox pictureBox1;
- private System.Windows.Forms.TextBox textBox1;
- private System.Windows.Forms.GroupBox groupBox3;
- private System.Windows.Forms.OpenFileDialog openFileDialog1;
- private System.Windows.Forms.Button button2;
- private System.Windows.Forms.CheckBox compressImage;
- private System.Windows.Forms.CheckBox optimizeFont;
- private System.Windows.Forms.CheckBox compressPageContents;
- private System.Windows.Forms.ComboBox imageQuality;
- private System.Windows.Forms.CheckBox removeMetadata;
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.Label cds;
- private System.Windows.Forms.Label ods;
- private System.Windows.Forms.GroupBox groupBox2;
- private System.Windows.Forms.CheckBox removeFormFields;
- private System.Windows.Forms.CheckBox removeAnnotation;
- private System.Windows.Forms.CheckBox incrementalUpdate;
+ private PictureBox pictureBox1;
+ private GroupBox groupBox1;
+ private Button browseButton;
+ private TextBox textBox1;
+ private GroupBox groupBox2;
+ private ComboBox imageQuality;
+ private Label label1;
+ private CheckBox removeFormFields;
+ private CheckBox disableIncrementalUpdates;
+ private CheckBox removeMetadata;
+ private CheckBox removeAttachments;
+ private CheckBox removeAnnotations;
+ private CheckBox optimizeFont;
+ private CheckBox optimizePageContents;
+ private CheckBox compressImage;
+ private Button compressPdf;
+ private GroupBox groupBox3;
+ private Label label3;
+ private Label label2;
+ private Label label4;
+ private OpenFileDialog openFileDialog1;
+ private Label cds;
+ private Label ods;
}
}
diff --git a/Compress_PDF_WF/Compress_PDF_WF/Form1.cs b/Compress_PDF_WF/Compress_PDF_WF/Form1.cs
index 1cf9ddf..5569d0e 100644
--- a/Compress_PDF_WF/Compress_PDF_WF/Form1.cs
+++ b/Compress_PDF_WF/Compress_PDF_WF/Form1.cs
@@ -9,22 +9,21 @@ public Form1()
{
InitializeComponent();
this.openFileDialog1.Filter = "PDF files (*.pdf)|*.pdf";
- this.pictureBox1.Image = System.Drawing.Image.FromFile("../../../Data/pdf_header.png");
this.Icon = System.Drawing.Icon.ExtractAssociatedIcon("../../../Data/syncfusion.ico");
- this.MinimizeBox = true;
for (int i = 1; i <= 100; i++)
this.imageQuality.Items.Add(i);
this.imageQuality.SelectedIndex = 49;
this.optimizeFont.Checked = true;
- this.compressPageContents.Checked = true;
+ this.optimizePageContents.Checked = true;
this.removeMetadata.Checked = true;
this.compressImage.Checked = true;
- this.Height = 1500;
+ this.disableIncrementalUpdates.Checked = true;
textBox1.Tag = @"..\..\..\Data\jQuery_Succinctly.pdf";
textBox1.Text = "jQuery_Succinctly.Pdf";
+ this.Height = 631;
}
- private void compressPDF_Click(object sender, EventArgs e)
+ private void compressPdf_Click(object sender, EventArgs e)
{
if (textBox1.Text != null && textBox1.Text != string.Empty)
{
@@ -56,7 +55,7 @@ private void compressPDF_Click(object sender, EventArgs e)
options.OptimizeFont = false;
//Compress the page contents
- if (compressPageContents.Checked)
+ if (optimizePageContents.Checked)
options.OptimizePageContents = true;
else
options.OptimizePageContents = false;
@@ -70,9 +69,8 @@ private void compressPDF_Click(object sender, EventArgs e)
//Set the options to loaded PDF document
ldoc.CompressionOptions = options;
-
//Restructure the document
- if (incrementalUpdate.Checked)
+ if (disableIncrementalUpdates.Checked)
ldoc.FileStructure.IncrementalUpdate = false;
else
ldoc.FileStructure.IncrementalUpdate = true;
@@ -81,16 +79,20 @@ private void compressPDF_Click(object sender, EventArgs e)
RemoveFormFields(ldoc, false);
//Remove annotation and its data.
- if (removeAnnotation.Checked)
+ if (removeAnnotations.Checked)
RemoveAnnotations(ldoc, false);
+ //Remove attachments
+ if (removeAttachments.Checked)
+ RemoveAttachments(ldoc);
+
//Save the document
MemoryStream ms = new MemoryStream();
ldoc.Save(ms);
this.ods.Text = (inputFile.Length / 1024).ToString() + " KB";
this.cds.Text = (ms.Length / 1024).ToString() + " KB ";
- this.Height = 580;
+ this.Height = 741;
if (MessageBox.Show("Do you want to view the PDF file?", "PDF File Created",
MessageBoxButtons.YesNo, MessageBoxIcon.Information)
@@ -98,8 +100,8 @@ private void compressPDF_Click(object sender, EventArgs e)
{
File.WriteAllBytes("Sample.pdf", ms.ToArray());
ms.Dispose();
- //Launching the PDF file using the default Application.[Acrobat Reader]
- //System.Diagnostics.Process.Start("Sample.pdf");
+ //Launching the PDF file using the default Application.[Acrobat Reader]
+ System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo("Sample.pdf") { UseShellExecute = true });
this.Close();
}
else
@@ -126,7 +128,7 @@ public void RemoveFormFields(PdfLoadedDocument ldoc, bool flatten)
{
if (flatten)
{
- ldoc.Form.Flatten = true;
+ ldoc.Form.FlattenFields();
}
else
{
@@ -138,30 +140,36 @@ public void RemoveFormFields(PdfLoadedDocument ldoc, bool flatten)
}
}
}
-
public void RemoveAnnotations(PdfLoadedDocument ldoc, bool flatten)
{
- foreach (PdfPageBase page in ldoc.Pages)
+ if (flatten)
{
- if (flatten)
+ ldoc.FlattenAnnotations();
+ }
+ else
+ {
+ foreach (PdfPageBase page in ldoc.Pages)
{
int count = page.Annotations.Count;
for (int i = count - 1; i >= 0; i--)
{
- page.Annotations[i].Flatten = true;
+ page.Annotations.RemoveAt(i);
}
}
- else
+ }
+ }
+ public void RemoveAttachments(PdfLoadedDocument ldoc)
+ {
+ if (ldoc.Attachments != null)
+ {
+ int count = ldoc.Attachments.Count;
+ for (int i = count - 1; i >= 0; i--)
{
- int count = page.Annotations.Count;
- for (int i = count - 1; i >= 0; i--)
- {
- page.Annotations.RemoveAt(i);
- }
+ ldoc.Attachments.RemoveAt(i);
}
}
}
- private void button2_Click(object sender, EventArgs e)
+ private void browseButton_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
@@ -170,14 +178,14 @@ private void button2_Click(object sender, EventArgs e)
this.ods.Text = this.cds.Text = "";
}
}
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
+
+ private void compressImage_CheckedChanged(object sender, EventArgs e)
{
if (compressImage.Checked)
this.imageQuality.Enabled = true;
else
this.imageQuality.Enabled = false;
}
-
#endregion
}
}
diff --git a/Compress_PDF_WF/Compress_PDF_WF/Form1.resx b/Compress_PDF_WF/Compress_PDF_WF/Form1.resx
index af32865..3f16b89 100644
--- a/Compress_PDF_WF/Compress_PDF_WF/Form1.resx
+++ b/Compress_PDF_WF/Compress_PDF_WF/Form1.resx
@@ -1,7 +1,7 @@