Compare commits
6 Commits
baa7b9ff58
...
5d8f97e1b8
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5d8f97e1b8 | ||
![]() |
626197a22b | ||
![]() |
65a0be77d2 | ||
![]() |
edf0f51cfe | ||
![]() |
ef6c017950 | ||
![]() |
2993807605 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,3 +4,4 @@ PDFWorkflowManager/PDFWorkflowManager/bin
|
|||||||
PDFWorkflowManager/Setup/Debug
|
PDFWorkflowManager/Setup/Debug
|
||||||
PDFWorkflowManager/Setup/Release
|
PDFWorkflowManager/Setup/Release
|
||||||
/PDFWorkflowManager/.vs
|
/PDFWorkflowManager/.vs
|
||||||
|
/PDFWorkflowManager/_.vs
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"Version": 1,
|
|
||||||
"WorkspaceRootPath": "D:\\Gitea\\RCEU_PDFWorkflowManager\\PDFWorkflowManager\\",
|
|
||||||
"Documents": [],
|
|
||||||
"DocumentGroupContainers": [
|
|
||||||
{
|
|
||||||
"Orientation": 0,
|
|
||||||
"VerticalTabListWidth": 256,
|
|
||||||
"DocumentGroups": [
|
|
||||||
{
|
|
||||||
"DockedWidth": 200,
|
|
||||||
"SelectedChildIndex": -1,
|
|
||||||
"Children": [
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{56df62a4-05a3-4e5b-aa1a-99371ccfb997}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
File diff suppressed because one or more lines are too long
55
PDFWorkflowManager/PDFWorkflowManager/ImageService.cs
Normal file
55
PDFWorkflowManager/PDFWorkflowManager/ImageService.cs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
using ImageMagick;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
|
||||||
|
namespace PDFWorkflowManager
|
||||||
|
{
|
||||||
|
public static class ImageService
|
||||||
|
{
|
||||||
|
public static void ConvertToJpeg(string sourceFileName, string destinationFileName, int compressionLevel, int dpi = 300)
|
||||||
|
{
|
||||||
|
using (Image sourceImage = Image.FromFile(sourceFileName))
|
||||||
|
{
|
||||||
|
float scaleFactor = dpi / sourceImage.HorizontalResolution;
|
||||||
|
int newWidth = (int)(sourceImage.Width * scaleFactor);
|
||||||
|
int newHeight = (int)(sourceImage.Height * scaleFactor);
|
||||||
|
|
||||||
|
using (var newImage = new Bitmap(newWidth, newHeight))
|
||||||
|
{
|
||||||
|
newImage.SetResolution(dpi, dpi);
|
||||||
|
using (Graphics graphics = Graphics.FromImage(newImage))
|
||||||
|
{
|
||||||
|
graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
|
||||||
|
graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
|
||||||
|
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||||||
|
graphics.DrawImage(sourceImage, 0, 0, newWidth, newHeight);
|
||||||
|
}
|
||||||
|
EncoderParameters encoderParameters = new EncoderParameters(1);
|
||||||
|
encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, compressionLevel);
|
||||||
|
ImageCodecInfo jpegCodec = GetEncoderInfo(ImageFormat.Jpeg);
|
||||||
|
newImage.Save(destinationFileName, jpegCodec, encoderParameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImageCodecInfo GetEncoderInfo(ImageFormat format)
|
||||||
|
{
|
||||||
|
foreach (ImageCodecInfo codec in ImageCodecInfo.GetImageDecoders())
|
||||||
|
{
|
||||||
|
if (codec.FormatID == format.Guid)
|
||||||
|
return codec;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CreateThumbnail(string fileName, string outputPath)
|
||||||
|
{
|
||||||
|
using (var image = new MagickImage(fileName))
|
||||||
|
{
|
||||||
|
var size = new MagickGeometry(240, 340) { IgnoreAspectRatio = false };
|
||||||
|
image.Resize(size);
|
||||||
|
image.Write(outputPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
PDFWorkflowManager/PDFWorkflowManager/LanguageService.cs
Normal file
39
PDFWorkflowManager/PDFWorkflowManager/LanguageService.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace PDFWorkflowManager
|
||||||
|
{
|
||||||
|
public static class LanguageService
|
||||||
|
{
|
||||||
|
public static readonly Dictionary<string, string> LanguageCodes = new Dictionary<string, string>
|
||||||
|
{
|
||||||
|
{"Afrikaans","af"}, {"Amharic","am"}, {"Arabic","ar"}, {"Assamese","as"}, {"Azerbaijani","az"},
|
||||||
|
{"Belarusian","be"}, {"Bengali","bn"}, {"Bokmal","nb"}, {"Bulgarian","bg"}, {"Catalan","ca"},
|
||||||
|
{"Chinese(Simplified)","zh-CN"}, {"Chinese(Traditional)","zh-TW"}, {"Croatian","hr"}, {"Czech","cs"},
|
||||||
|
{"Danish","da"}, {"Dutch","nl"}, {"English","en"}, {"Estonian","et"}, {"Finnish","fi"},
|
||||||
|
{"French","fr"}, {"German","de"}, {"Greek","el"}, {"Gujarati","gu"}, {"Hebrew","he"},
|
||||||
|
{"Hindi","hi"}, {"Hungarian","hu"}, {"Icelandic","is"}, {"Indonesian","id"}, {"Italian","it"},
|
||||||
|
{"Japanese","ja"}, {"Kannada","kn"}, {"Korean","ko"}, {"Latvian","lv"}, {"Lithuanian","lt"},
|
||||||
|
{"Malayalam","ml"}, {"Marathi","mr"}, {"Nepali","ne"}, {"Norwegian","no"}, {"Oriya","or"},
|
||||||
|
{"Polish","pl"}, {"Portuguese","pt"}, {"Punjabi","pa"}, {"Romanian","ro"}, {"Russian","ru"},
|
||||||
|
{"Slovak","sk"}, {"Slovenian","sl"}, {"Spanish","es"}, {"Swahili","sw"}, {"Swedish","sv"},
|
||||||
|
{"Tamil","ta"}, {"Telugu","te"}, {"Thai","th"}, {"Tibetan","bo"}, {"Turkish","tr"},
|
||||||
|
{"Ukrainian","uk"}, {"Urdu","ur"}, {"Vietnamese","vi"}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static readonly Dictionary<string, string> TrainLanguage = new Dictionary<string, string>
|
||||||
|
{
|
||||||
|
{"Afrikaans","afr"}, {"Amharic","amh"}, {"Arabic","ara"}, {"Assamese","asm"}, {"Azerbaijani","aze"},
|
||||||
|
{"Belarusian","bel"}, {"Bengali","ben"}, {"Bokmal","nb"}, {"Bulgarian","bul"}, {"Catalan","ca"},
|
||||||
|
{"Chinese(Simplified)","chi_sim"}, {"Chinese(Traditional)","chi_tra"}, {"Croatian","chr"}, {"Czech","ces"},
|
||||||
|
{"Danish","dan"}, {"Dutch","nld"}, {"English","eng"}, {"Estonian","est"}, {"Finnish","fin"},
|
||||||
|
{"French","fra"}, {"German","deu"}, {"Greek","ell"}, {"Gujarati","guj"}, {"Hebrew","heb"},
|
||||||
|
{"Hindi","hin"}, {"Hungarian","hun"}, {"Icelandic","isl"}, {"Indonesian","ind"}, {"Italian","ita"},
|
||||||
|
{"Japanese","jpn"}, {"Kannada","kan"}, {"Korean","kor"}, {"Latvian","lav"}, {"Lithuanian","lit"},
|
||||||
|
{"Malayalam","mal"}, {"Marathi","mar"}, {"Nepali","nep"}, {"Norwegian","nor"}, {"Oriya","ori"},
|
||||||
|
{"Polish","pol"}, {"Portuguese","por"}, {"Punjabi","pan"}, {"Romanian","ron"}, {"Russian","rus"},
|
||||||
|
{"Slovak","slk"}, {"Slovenian","slv"}, {"Spanish","spa"}, {"Swahili","swa"}, {"Swedish","swe"},
|
||||||
|
{"Tamil","tam"}, {"Telugu","tel"}, {"Thai","tha"}, {"Tibetan","bod"}, {"Turkish","tur"},
|
||||||
|
{"Ukrainian","ukr"}, {"Urdu","urd"}, {"Vietnamese","vie"}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@@ -1,11 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace PDFWorkflowManager
|
namespace PDFWorkflowManager
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
|
namespace PDFWorkflowManager
|
||||||
namespace PDFWorkflowManager
|
|
||||||
{
|
{
|
||||||
partial class MainForm
|
partial class MainForm
|
||||||
{
|
{
|
||||||
@@ -32,6 +31,10 @@ namespace PDFWorkflowManager
|
|||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
|
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.quitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.quitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
@@ -95,6 +98,7 @@ namespace PDFWorkflowManager
|
|||||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||||
this.pictureBox2 = new System.Windows.Forms.PictureBox();
|
this.pictureBox2 = new System.Windows.Forms.PictureBox();
|
||||||
this.groupExport = new System.Windows.Forms.GroupBox();
|
this.groupExport = new System.Windows.Forms.GroupBox();
|
||||||
|
this.chkMagazines = new System.Windows.Forms.CheckBox();
|
||||||
this.panelBanner = new System.Windows.Forms.Panel();
|
this.panelBanner = new System.Windows.Forms.Panel();
|
||||||
this.btnMakePDF = new System.Windows.Forms.Button();
|
this.btnMakePDF = new System.Windows.Forms.Button();
|
||||||
this.cmbBanner = new System.Windows.Forms.ComboBox();
|
this.cmbBanner = new System.Windows.Forms.ComboBox();
|
||||||
@@ -119,7 +123,7 @@ namespace PDFWorkflowManager
|
|||||||
this.btnDisposePics = new System.Windows.Forms.Button();
|
this.btnDisposePics = new System.Windows.Forms.Button();
|
||||||
this.btnDeleteTemp = new System.Windows.Forms.Button();
|
this.btnDeleteTemp = new System.Windows.Forms.Button();
|
||||||
this.btnDeleteCacheWork = new System.Windows.Forms.Button();
|
this.btnDeleteCacheWork = new System.Windows.Forms.Button();
|
||||||
this.chkMagazines = new System.Windows.Forms.CheckBox();
|
this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
this.groupBox2.SuspendLayout();
|
this.groupBox2.SuspendLayout();
|
||||||
@@ -156,15 +160,44 @@ namespace PDFWorkflowManager
|
|||||||
// fileToolStripMenuItem
|
// fileToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.newToolStripMenuItem,
|
||||||
|
this.toolStripSeparator1,
|
||||||
|
this.loadToolStripMenuItem,
|
||||||
|
this.saveToolStripMenuItem,
|
||||||
|
this.toolStripSeparator2,
|
||||||
this.quitToolStripMenuItem});
|
this.quitToolStripMenuItem});
|
||||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||||
this.fileToolStripMenuItem.Text = "&File";
|
this.fileToolStripMenuItem.Text = "&File";
|
||||||
//
|
//
|
||||||
|
// loadToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.loadToolStripMenuItem.Name = "loadToolStripMenuItem";
|
||||||
|
this.loadToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.loadToolStripMenuItem.Text = "&Load...";
|
||||||
|
this.loadToolStripMenuItem.Click += new System.EventHandler(this.loadToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// toolStripSeparator1
|
||||||
|
//
|
||||||
|
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||||
|
this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
|
||||||
|
//
|
||||||
|
// saveToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||||
|
this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.saveToolStripMenuItem.Text = "&Save...";
|
||||||
|
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// toolStripSeparator2
|
||||||
|
//
|
||||||
|
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||||
|
this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
|
||||||
|
//
|
||||||
// quitToolStripMenuItem
|
// quitToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.quitToolStripMenuItem.Name = "quitToolStripMenuItem";
|
this.quitToolStripMenuItem.Name = "quitToolStripMenuItem";
|
||||||
this.quitToolStripMenuItem.Size = new System.Drawing.Size(97, 22);
|
this.quitToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.quitToolStripMenuItem.Text = "&Quit";
|
this.quitToolStripMenuItem.Text = "&Quit";
|
||||||
this.quitToolStripMenuItem.Click += new System.EventHandler(this.quitToolStripMenuItem_Click);
|
this.quitToolStripMenuItem.Click += new System.EventHandler(this.quitToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
@@ -779,6 +812,16 @@ namespace PDFWorkflowManager
|
|||||||
this.groupExport.TabStop = false;
|
this.groupExport.TabStop = false;
|
||||||
this.groupExport.Text = "Exporting";
|
this.groupExport.Text = "Exporting";
|
||||||
//
|
//
|
||||||
|
// chkMagazines
|
||||||
|
//
|
||||||
|
this.chkMagazines.AutoSize = true;
|
||||||
|
this.chkMagazines.Location = new System.Drawing.Point(7, 22);
|
||||||
|
this.chkMagazines.Name = "chkMagazines";
|
||||||
|
this.chkMagazines.Size = new System.Drawing.Size(72, 17);
|
||||||
|
this.chkMagazines.TabIndex = 56;
|
||||||
|
this.chkMagazines.Text = "Magazine";
|
||||||
|
this.chkMagazines.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// panelBanner
|
// panelBanner
|
||||||
//
|
//
|
||||||
this.panelBanner.Controls.Add(this.btnMakePDF);
|
this.panelBanner.Controls.Add(this.btnMakePDF);
|
||||||
@@ -944,6 +987,7 @@ namespace PDFWorkflowManager
|
|||||||
this.txtProjectDir.Name = "txtProjectDir";
|
this.txtProjectDir.Name = "txtProjectDir";
|
||||||
this.txtProjectDir.Size = new System.Drawing.Size(280, 20);
|
this.txtProjectDir.Size = new System.Drawing.Size(280, 20);
|
||||||
this.txtProjectDir.TabIndex = 50;
|
this.txtProjectDir.TabIndex = 50;
|
||||||
|
this.txtProjectDir.Leave += new System.EventHandler(this.txtProjectDir_Leave);
|
||||||
//
|
//
|
||||||
// watcherOut
|
// watcherOut
|
||||||
//
|
//
|
||||||
@@ -1030,15 +1074,12 @@ namespace PDFWorkflowManager
|
|||||||
this.btnDeleteCacheWork.UseVisualStyleBackColor = true;
|
this.btnDeleteCacheWork.UseVisualStyleBackColor = true;
|
||||||
this.btnDeleteCacheWork.Click += new System.EventHandler(this.btnDeleteCacheWork_Click);
|
this.btnDeleteCacheWork.Click += new System.EventHandler(this.btnDeleteCacheWork_Click);
|
||||||
//
|
//
|
||||||
// chkMagazines
|
// newToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.chkMagazines.AutoSize = true;
|
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
|
||||||
this.chkMagazines.Location = new System.Drawing.Point(7, 22);
|
this.newToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.chkMagazines.Name = "chkMagazines";
|
this.newToolStripMenuItem.Text = "&New";
|
||||||
this.chkMagazines.Size = new System.Drawing.Size(72, 17);
|
this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click);
|
||||||
this.chkMagazines.TabIndex = 56;
|
|
||||||
this.chkMagazines.Text = "Magazine";
|
|
||||||
this.chkMagazines.UseVisualStyleBackColor = true;
|
|
||||||
//
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
@@ -1187,6 +1228,11 @@ namespace PDFWorkflowManager
|
|||||||
private System.Windows.Forms.Button btnDeleteTemp;
|
private System.Windows.Forms.Button btnDeleteTemp;
|
||||||
private System.Windows.Forms.Button btnDeleteCacheWork;
|
private System.Windows.Forms.Button btnDeleteCacheWork;
|
||||||
private System.Windows.Forms.CheckBox chkMagazines;
|
private System.Windows.Forms.CheckBox chkMagazines;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,6 +7,7 @@ using System.Drawing;
|
|||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -267,12 +268,28 @@ namespace PDFWorkflowManager
|
|||||||
{
|
{
|
||||||
pictureBox1.Image.Dispose();
|
pictureBox1.Image.Dispose();
|
||||||
pictureBox1.Image = null;
|
pictureBox1.Image = null;
|
||||||
|
pictureBox1.Invalidate();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pictureBox1.Image = null;
|
||||||
|
pictureBox1.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
if (pictureBox2.Image != null)
|
if (pictureBox2.Image != null)
|
||||||
{
|
{
|
||||||
pictureBox2.Image.Dispose();
|
pictureBox2.Image.Dispose();
|
||||||
pictureBox2.Image = null;
|
pictureBox2.Image = null;
|
||||||
|
pictureBox2.Invalidate();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pictureBox2.Image = null;
|
||||||
|
pictureBox2.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
GC.Collect();
|
||||||
|
GC.WaitForPendingFinalizers();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{ }
|
{ }
|
||||||
@@ -280,6 +297,15 @@ namespace PDFWorkflowManager
|
|||||||
checkSimplex.Enabled = true;
|
checkSimplex.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_input_dir();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Check input dir for origs dir and files
|
||||||
|
private void check_input_dir()
|
||||||
|
{
|
||||||
|
|
||||||
|
Cursor.Current = Cursors.WaitCursor;
|
||||||
|
|
||||||
if (!Directory.Exists(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.OrigsDir)))
|
if (!Directory.Exists(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.OrigsDir)))
|
||||||
{
|
{
|
||||||
@@ -294,22 +320,21 @@ namespace PDFWorkflowManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Directory.Exists(Path.Combine(txtProjectDir.Text, origsDir)) && !Directory.Exists(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.WorkDir)))
|
if (Directory.Exists(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.OrigsDir)) && !Directory.Exists(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.WorkDir)))
|
||||||
{
|
{
|
||||||
|
// Replace the selected code block with this version
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] strOrigFiles = Directory.GetFiles(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.OrigsDir), "*.tif*");
|
string[] strOrigFiles = Directory.GetFiles(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.OrigsDir), "*.tif*");
|
||||||
if (File.Exists(strOrigFiles[0]))
|
if (File.Exists(strOrigFiles[0]))
|
||||||
{
|
{
|
||||||
byte[] imageBytes = File.ReadAllBytes(strOrigFiles[0]);
|
using (var memoryStream = new MemoryStream(File.ReadAllBytes(strOrigFiles[0])))
|
||||||
|
using (var bitmap = new Bitmap(memoryStream))
|
||||||
using (MemoryStream memoryStream = new MemoryStream(imageBytes))
|
|
||||||
{
|
|
||||||
using (Bitmap bitmap = new Bitmap(memoryStream))
|
|
||||||
{
|
{
|
||||||
|
// Create a copy of the bitmap to ensure the file is released
|
||||||
pictureBox1.Image = new Bitmap(bitmap);
|
pictureBox1.Image = new Bitmap(bitmap);
|
||||||
}
|
}
|
||||||
}
|
// At this point, the file is fully released
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@@ -322,43 +347,49 @@ namespace PDFWorkflowManager
|
|||||||
btnCopyPathWorkDir.Enabled = true;
|
btnCopyPathWorkDir.Enabled = true;
|
||||||
btnConvertToPDF.Enabled = true;
|
btnConvertToPDF.Enabled = true;
|
||||||
|
|
||||||
|
// Replace the selected code block with this version
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] strWorkFiles = Directory.GetFiles(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.WorkDir), "*.tif");
|
string[] strWorkFiles = Directory.GetFiles(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.WorkDir), "*.tif");
|
||||||
byte[] imageBytes = File.ReadAllBytes(strWorkFiles[0]);
|
if (strWorkFiles.Length > 0)
|
||||||
|
|
||||||
using (MemoryStream memoryStream = new MemoryStream(imageBytes))
|
|
||||||
{
|
{
|
||||||
using (Bitmap bitmap = new Bitmap(memoryStream))
|
using (var memoryStream = new MemoryStream(File.ReadAllBytes(strWorkFiles[0])))
|
||||||
|
using (var bitmap = new Bitmap(memoryStream))
|
||||||
{
|
{
|
||||||
pictureBox1.Image = new Bitmap(bitmap);
|
pictureBox1.Image = new Bitmap(bitmap);
|
||||||
}
|
}
|
||||||
|
// Release file handle so tempCopyPath is writeable
|
||||||
|
GC.Collect();
|
||||||
|
GC.WaitForPendingFinalizers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Directory.Exists(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.WorkOutDir)))
|
if (Directory.Exists(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.WorkOutDir)))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] strOutFiles = Directory.GetFiles(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.WorkOutDir), "*.tif");
|
string[] strOutFiles = Directory.GetFiles(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.WorkOutDir), "*.tif");
|
||||||
byte[] imageBytes = File.ReadAllBytes(strOutFiles[0]);
|
if (strOutFiles.Length > 0)
|
||||||
|
|
||||||
using (MemoryStream memoryStream = new MemoryStream(imageBytes))
|
|
||||||
{
|
{
|
||||||
using (Bitmap bitmap = new Bitmap(memoryStream))
|
string tempCopyPath = Path.Combine(tempDir, "preview_out.tif");
|
||||||
|
File.Copy(strOutFiles[0], tempCopyPath, true);
|
||||||
|
|
||||||
|
using (var memoryStream = new MemoryStream(File.ReadAllBytes(tempCopyPath)))
|
||||||
|
using (var bitmap = new Bitmap(memoryStream))
|
||||||
{
|
{
|
||||||
pictureBox2.Image = new Bitmap(bitmap);
|
pictureBox2.Image = new Bitmap(bitmap);
|
||||||
}
|
}
|
||||||
|
// Release file handle so tempCopyPath is writeable
|
||||||
|
GC.Collect();
|
||||||
|
GC.WaitForPendingFinalizers();
|
||||||
|
File.Delete(tempCopyPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -410,6 +441,8 @@ namespace PDFWorkflowManager
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cursor.Current = Cursors.Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1072,6 +1105,8 @@ namespace PDFWorkflowManager
|
|||||||
|
|
||||||
fileName += title;
|
fileName += title;
|
||||||
var selectedItem = (dynamic)cmbLanguage.SelectedItem;
|
var selectedItem = (dynamic)cmbLanguage.SelectedItem;
|
||||||
|
if (selectedItem != null)
|
||||||
|
{
|
||||||
var selectedValue = selectedItem.Value;
|
var selectedValue = selectedItem.Value;
|
||||||
|
|
||||||
if (selectedValue != "eng")
|
if (selectedValue != "eng")
|
||||||
@@ -1082,6 +1117,11 @@ namespace PDFWorkflowManager
|
|||||||
{
|
{
|
||||||
fileName += $"_[{cmbResolution.SelectedItem}dpi][ocr]";
|
fileName += $"_[{cmbResolution.SelectedItem}dpi][ocr]";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cmbLanguage.SelectedIndex = cmbLanguage.FindStringExact("English");
|
||||||
|
}
|
||||||
|
|
||||||
txtFileName.Text = fileName;
|
txtFileName.Text = fileName;
|
||||||
}
|
}
|
||||||
@@ -1166,6 +1206,8 @@ namespace PDFWorkflowManager
|
|||||||
bannerPage = "";
|
bannerPage = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void radioSortNormal_CheckedChanged(object sender, EventArgs e)
|
private void radioSortNormal_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//sortNormal = true;
|
//sortNormal = true;
|
||||||
@@ -1294,13 +1336,22 @@ namespace PDFWorkflowManager
|
|||||||
|
|
||||||
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
|
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
MessageBox.Show("PDF Workflow Manager v0.9.3 \r\n\r\nCopyright (c) 2023-2024 https://retro-commodore.eu", "Version", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
var assembly = Assembly.GetExecutingAssembly();
|
||||||
}
|
var version = assembly.GetName().Version.ToString();
|
||||||
|
|
||||||
private void button1_Click(object sender, EventArgs e)
|
var copyrightAttr = assembly
|
||||||
{
|
.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)
|
||||||
//GalleryForm sf = new GalleryForm(workOutDir);
|
.OfType<AssemblyCopyrightAttribute>()
|
||||||
//sf.ShowDialog();
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
var copyright = copyrightAttr?.Copyright ?? "Copyright info not found";
|
||||||
|
|
||||||
|
MessageBox.Show(
|
||||||
|
$"PDF Workflow Manager v{version}\r\n\r\n{copyright}",
|
||||||
|
"Version",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Information
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1352,5 +1403,188 @@ namespace PDFWorkflowManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void txtProjectDir_Leave(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Use OrigsDir from settings instead of txtOrigsDir
|
||||||
|
if (Directory.Exists(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.OrigsDir)))
|
||||||
|
{
|
||||||
|
check_input_dir();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using (OpenFileDialog openFileDialog = new OpenFileDialog())
|
||||||
|
{
|
||||||
|
openFileDialog.Filter = "PDF Project Files (*.pdfproj)|*.pdfproj|All Files (*.*)|*.*";
|
||||||
|
openFileDialog.Title = "Open PDF Project File";
|
||||||
|
openFileDialog.Multiselect = false;
|
||||||
|
|
||||||
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
string selectedFile = openFileDialog.FileName;
|
||||||
|
var lines = File.ReadAllLines(selectedFile);
|
||||||
|
var dict = new Dictionary<string, string>();
|
||||||
|
foreach (var line in lines)
|
||||||
|
{
|
||||||
|
var parts = line.Split(new[] { '=' }, 2);
|
||||||
|
if (parts.Length == 2)
|
||||||
|
dict[parts[0]] = parts[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
txtFileName.Text = dict.ContainsKey("FileName") ? dict["FileName"] : "";
|
||||||
|
txtTitle.Text = dict.ContainsKey("Title") ? dict["Title"] : "";
|
||||||
|
cmbLanguage.SelectedIndex = cmbLanguage.FindStringExact(dict.ContainsKey("Language") ? dict["Language"] : "");
|
||||||
|
txtLanguages.Text = dict.ContainsKey("Languages") ? dict["Languages"] : "";
|
||||||
|
txtType.Text = dict.ContainsKey("Type") ? dict["Type"] : "";
|
||||||
|
txtPublisher.Text = dict.ContainsKey("Publisher") ? dict["Publisher"] : "";
|
||||||
|
txtAuthor.Text = dict.ContainsKey("Author") ? dict["Author"] : "";
|
||||||
|
txtISBN.Text = dict.ContainsKey("ISBN") ? dict["ISBN"] : "";
|
||||||
|
txtDate.Text = dict.ContainsKey("Date") ? dict["Date"] : "";
|
||||||
|
txtPageCount.Text = dict.ContainsKey("PageCount") ? dict["PageCount"] : "";
|
||||||
|
cmbResolution.SelectedIndex = cmbResolution.FindStringExact(dict.ContainsKey("Resolution") ? dict["Resolution"] : "");
|
||||||
|
checkPhotocopy.Checked = dict.ContainsKey("Photocopy") ? dict["Photocopy"] == "True" : false;
|
||||||
|
checkReplace.Checked = dict.ContainsKey("Replace") ? dict["Replace"] == "True" : false;
|
||||||
|
txtPartnumber.Text = dict.ContainsKey("Partnumber") ? dict["Partnumber"] : "";
|
||||||
|
if (int.TryParse(dict.ContainsKey("Quality") ? dict["Quality"] : "4", out int quality))
|
||||||
|
trackBar1.Value = Math.Max(trackBar1.Minimum, Math.Min(trackBar1.Maximum, quality));
|
||||||
|
txtContributor.Text = dict.ContainsKey("Contributor") ? dict["Contributor"] : "";
|
||||||
|
txtContributorURL.Text = dict.ContainsKey("ContributorURL") ? dict["ContributorURL"] : "";
|
||||||
|
txtPostProcessor.Text = dict.ContainsKey("PostProcessor") ? dict["PostProcessor"] : "";
|
||||||
|
txtTimeSpent.Text = dict.ContainsKey("TimeSpent") ? dict["TimeSpent"] : "";
|
||||||
|
txtPDFAuthor.Text = dict.ContainsKey("PDFMetaAuthor") ? dict["PDFMetaAuthor"] : "";
|
||||||
|
txtPDFKeywords.Text = dict.ContainsKey("PDFKeywords") ? dict["PDFKeywords"] : "";
|
||||||
|
cmbBanner.SelectedIndex = cmbBanner.FindStringExact(dict.ContainsKey("Banner") ? dict["Banner"] : "");
|
||||||
|
chkMagazines.Checked = dict.ContainsKey("Magazine") ? dict["Magazine"] == "True" : false;
|
||||||
|
checkSimplex.Checked = dict.ContainsKey("Simplex") ? dict["Simplex"] == "True" : false;
|
||||||
|
txtProjectDir.Text = dict.ContainsKey("ProjectDir") ? dict["ProjectDir"] : "";
|
||||||
|
|
||||||
|
MessageBox.Show("Loaded file: " + selectedFile, "File Loaded", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using (SaveFileDialog saveFileDialog = new SaveFileDialog())
|
||||||
|
{
|
||||||
|
saveFileDialog.Filter = "PDF Project Files (*.pdfproj)|*.pdfproj|All Files (*.*)|*.*";
|
||||||
|
saveFileDialog.Title = "Save PDF Project File";
|
||||||
|
saveFileDialog.DefaultExt = "pdfproj";
|
||||||
|
saveFileDialog.AddExtension = true;
|
||||||
|
|
||||||
|
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
string selectedFile = saveFileDialog.FileName;
|
||||||
|
|
||||||
|
// Collect all form data
|
||||||
|
var lines = new List<string>
|
||||||
|
{
|
||||||
|
"FileName=" + txtFileName.Text,
|
||||||
|
"Title=" + txtTitle.Text,
|
||||||
|
"Language=" + cmbLanguage.Text,
|
||||||
|
"Languages=" + txtLanguages.Text,
|
||||||
|
"Type=" + txtType.Text,
|
||||||
|
"Publisher=" + txtPublisher.Text,
|
||||||
|
"Author=" + txtAuthor.Text,
|
||||||
|
"ISBN=" + txtISBN.Text,
|
||||||
|
"Date=" + txtDate.Text,
|
||||||
|
"PageCount=" + txtPageCount.Text,
|
||||||
|
"Resolution=" + cmbResolution.Text,
|
||||||
|
"Photocopy=" + checkPhotocopy.Checked,
|
||||||
|
"Replace=" + checkReplace.Checked,
|
||||||
|
"Partnumber=" + txtPartnumber.Text,
|
||||||
|
"Quality=" + trackBar1.Value,
|
||||||
|
"Contributor=" + txtContributor.Text,
|
||||||
|
"ContributorURL=" + txtContributorURL.Text,
|
||||||
|
"PostProcessor=" + txtPostProcessor.Text,
|
||||||
|
"TimeSpent=" + txtTimeSpent.Text,
|
||||||
|
"PDFMetaAuthor=" + txtPDFAuthor.Text,
|
||||||
|
"PDFKeywords=" + txtPDFKeywords.Text,
|
||||||
|
"Banner=" + cmbBanner.Text,
|
||||||
|
"Magazine=" + chkMagazines.Checked,
|
||||||
|
"Simplex=" + checkSimplex.Checked,
|
||||||
|
"ProjectDir=" + txtProjectDir.Text
|
||||||
|
};
|
||||||
|
|
||||||
|
File.WriteAllLines(selectedFile, lines);
|
||||||
|
MessageBox.Show("Saved file: " + selectedFile, "File Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void newToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Reset all input fields to default values
|
||||||
|
txtFileName.Text = "";
|
||||||
|
txtTitle.Text = "";
|
||||||
|
cmbLanguage.SelectedIndex = cmbLanguage.FindStringExact("English");
|
||||||
|
txtLanguages.Text = "";
|
||||||
|
txtType.Text = "";
|
||||||
|
txtPublisher.Text = "";
|
||||||
|
txtAuthor.Text = "";
|
||||||
|
txtISBN.Text = "";
|
||||||
|
txtDate.Text = "";
|
||||||
|
txtPageCount.Text = "";
|
||||||
|
cmbResolution.SelectedIndex = cmbResolution.FindStringExact("600");
|
||||||
|
checkPhotocopy.Checked = false;
|
||||||
|
checkReplace.Checked = false;
|
||||||
|
txtPartnumber.Text = "";
|
||||||
|
trackBar1.Value = 4;
|
||||||
|
txtContributor.Text = "";
|
||||||
|
txtContributorURL.Text = "";
|
||||||
|
txtPostProcessor.Text = strPostProcessor;
|
||||||
|
txtTimeSpent.Text = "";
|
||||||
|
txtPDFAuthor.Text = Properties.Settings.Default.PDFMetaAuthor;
|
||||||
|
txtPDFKeywords.Text = "";
|
||||||
|
cmbBanner.SelectedIndex = Properties.Settings.Default.Banner;
|
||||||
|
chkMagazines.Checked = false;
|
||||||
|
checkSimplex.Checked = false;
|
||||||
|
txtProjectDir.Text = "";
|
||||||
|
|
||||||
|
// Clear up pictures
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (pictureBox1.Image != null)
|
||||||
|
{
|
||||||
|
pictureBox1.Image.Dispose();
|
||||||
|
pictureBox1.Image = null;
|
||||||
|
}
|
||||||
|
if (pictureBox2.Image != null)
|
||||||
|
{
|
||||||
|
pictureBox2.Image.Dispose();
|
||||||
|
pictureBox2.Image = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{ }
|
||||||
|
|
||||||
|
// Optionally reset status bar and progress bar
|
||||||
|
toolStripStatusLabel1.Text = "";
|
||||||
|
toolStripProgressBar1.Value = 0;
|
||||||
|
}
|
||||||
|
private void HandleWorkOutDirFileEvent()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string[] strOutFiles = Directory.GetFiles(workOutDir, "*.tif");
|
||||||
|
if (strOutFiles.Length > 0)
|
||||||
|
{
|
||||||
|
using (var memoryStream = new MemoryStream(File.ReadAllBytes(strOutFiles[0])))
|
||||||
|
using (var bitmap = new Bitmap(memoryStream))
|
||||||
|
{
|
||||||
|
pictureBox2.Image = new Bitmap(bitmap);
|
||||||
|
}
|
||||||
|
// Release file handle so file is writeable
|
||||||
|
GC.Collect();
|
||||||
|
GC.WaitForPendingFinalizers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Optionally log or handle error
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
34
PDFWorkflowManager/PDFWorkflowManager/MetadataService.cs
Normal file
34
PDFWorkflowManager/PDFWorkflowManager/MetadataService.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
|
namespace PDFWorkflowManager
|
||||||
|
{
|
||||||
|
public static class MetadataService
|
||||||
|
{
|
||||||
|
public static void WriteMetadata(string filePath, string contents)
|
||||||
|
{
|
||||||
|
File.WriteAllText(filePath, contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetMD5(string file)
|
||||||
|
{
|
||||||
|
using (var md5 = MD5.Create())
|
||||||
|
using (var stream = File.OpenRead(file))
|
||||||
|
{
|
||||||
|
var hash = md5.ComputeHash(stream);
|
||||||
|
return BitConverter.ToString(hash).Replace("-", "").ToLower();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetSHA1(string file)
|
||||||
|
{
|
||||||
|
using (var sha1 = SHA1.Create())
|
||||||
|
using (var stream = File.OpenRead(file))
|
||||||
|
{
|
||||||
|
var hash = sha1.ComputeHash(stream);
|
||||||
|
return BitConverter.ToString(hash).Replace("-", "").ToLower();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -104,6 +104,8 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="ImageService.cs" />
|
||||||
|
<Compile Include="LanguageService.cs" />
|
||||||
<Compile Include="LanguagesForm.cs">
|
<Compile Include="LanguagesForm.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -116,6 +118,8 @@
|
|||||||
<Compile Include="MainForm.Designer.cs">
|
<Compile Include="MainForm.Designer.cs">
|
||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
<DependentUpon>MainForm.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="MetadataService.cs" />
|
||||||
|
<Compile Include="PdfService.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="SettingsForm.cs">
|
<Compile Include="SettingsForm.cs">
|
||||||
@@ -150,6 +154,7 @@
|
|||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
|
<None Include="PDFWorkflowManager.csproj" />
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
39
PDFWorkflowManager/PDFWorkflowManager/PdfService.cs
Normal file
39
PDFWorkflowManager/PDFWorkflowManager/PdfService.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace PDFWorkflowManager
|
||||||
|
{
|
||||||
|
public static class PdfService
|
||||||
|
{
|
||||||
|
public static void MergePdfs(string pdfToolkitPath, string inputPattern, string bannerPage, string outputFile)
|
||||||
|
{
|
||||||
|
var startInfo = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = pdfToolkitPath,
|
||||||
|
Arguments = $"\"{inputPattern}\" {bannerPage} cat output \"{outputFile}\"",
|
||||||
|
UseShellExecute = false,
|
||||||
|
RedirectStandardOutput = true,
|
||||||
|
CreateNoWindow = true
|
||||||
|
};
|
||||||
|
using (var process = Process.Start(startInfo))
|
||||||
|
{
|
||||||
|
process.WaitForExit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UpdatePdfMetadata(string ghostScriptPath, string tempFile, string metadataFile, string outputFile)
|
||||||
|
{
|
||||||
|
var startInfo = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = ghostScriptPath,
|
||||||
|
Arguments = $"-dBATCH -dNOPAUSE -dAutoRotatePages=/None -sDEVICE=pdfwrite -sOutputFile=\"{outputFile}\" \"{tempFile}\" \"{metadataFile}\"",
|
||||||
|
UseShellExecute = false,
|
||||||
|
RedirectStandardOutput = true,
|
||||||
|
CreateNoWindow = true
|
||||||
|
};
|
||||||
|
using (var process = Process.Start(startInfo))
|
||||||
|
{
|
||||||
|
process.WaitForExit(120000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Retro Commodore")]
|
[assembly: AssemblyCompany("Retro Commodore")]
|
||||||
[assembly: AssemblyProduct("PDF Workflow Manager")]
|
[assembly: AssemblyProduct("PDF Workflow Manager")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2023-2024 https://retro-commodore.eu")]
|
[assembly: AssemblyCopyright("Copyright © 2023-2025 https://retro-commodore.eu")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.9.3")]
|
[assembly: AssemblyVersion("0.9.4")]
|
||||||
[assembly: AssemblyFileVersion("0.9.3")]
|
[assembly: AssemblyFileVersion("0.9.4")]
|
||||||
|
Reference in New Issue
Block a user