Skip to content

Commit 26da323

Browse files
committed
Updated to version 0.0.0.3
- Bunch of minor changes including a likely dpi/compressed image fix. (see history.txt)
1 parent 74acaa9 commit 26da323

File tree

5 files changed

+32
-62
lines changed

5 files changed

+32
-62
lines changed

PdfConstruct/DataObjects/Construct.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ namespace PdfConstruct.DataObjects
2828
{
2929
public class Construct
3030
{
31-
public int DPI { get; set; }
3231
public string OutputPath { get; set; }
3332
public List<CardEntry> CardEntries { get; set; }
3433
}

PdfConstruct/PdfConstructForm.Designer.cs

Lines changed: 10 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PdfConstruct/PdfConstructForm.cs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,12 @@ private void selectCardFacesToolStripMenuItem_Click(object sender, EventArgs e)
147147
private void setCardCountsToolStripMenuItem_Click(object sender, EventArgs e)
148148
{
149149
var zQuery = new QueryPanelDialog("Set Card Count", 400, false);
150-
zQuery.AddNumericBox("Count", 1, 0, int.MaxValue, 1, 0, numericDPI);
150+
const string CARD_COUNT = "CARD_COUNT";
151+
zQuery.AddNumericBox("Count", 1, 0, int.MaxValue, 1, 0, CARD_COUNT);
151152

152153
if (DialogResult.OK == zQuery.ShowDialog(this))
153154
{
154-
SetSelectedItemsValue(listViewCards.SelectedItems, zQuery.GetDecimal(numericDPI).ToString(), ItemSubIndex.Count);
155+
SetSelectedItemsValue(listViewCards.SelectedItems, zQuery.GetDecimal(CARD_COUNT).ToString(), ItemSubIndex.Count);
155156
}
156157
}
157158

@@ -234,6 +235,11 @@ private void listViewCards_KeyDown(object sender, KeyEventArgs e)
234235
}
235236
}
236237

238+
private void PdfConstructForm_FormClosing(object sender, FormClosingEventArgs e)
239+
{
240+
SaveOnClose(e);
241+
}
242+
237243
#endregion
238244

239245
#region Export Thread
@@ -245,10 +251,8 @@ private void ExportThread(object zParam)
245251
//zDocument.Options.NoCompression = true;
246252

247253
var listFiles = (List<string>)zParam;
248-
Func<decimal> funcGetDpi = () => numericDPI.Value;
249254
Func<string> funcGetOutputPath = () => txtOutputPath.Text;
250255

251-
var dDPI = (double)numericDPI.InvokeFunc(funcGetDpi);
252256
var sOutputPth = txtOutputPath.InvokeFunc(funcGetOutputPath);
253257

254258
listFiles.ForEach(sFile =>
@@ -257,19 +261,23 @@ private void ExportThread(object zParam)
257261

258262
// wipe out any transparency on the images
259263
var zImgDestination = new Bitmap(zImgSrc.Width, zImgSrc.Height, PixelFormat.Format24bppRgb);
264+
zImgDestination.SetResolution(zImgSrc.HorizontalResolution, zImgSrc.VerticalResolution);
265+
260266
var zImageGfx = Graphics.FromImage(zImgDestination);
261267
zImageGfx.Clear(Color.White);
262268
zImageGfx.DrawImage(zImgSrc, 0, 0);
263269

264270
var zPage = zDocument.AddPage(new PdfPage()
265271
{
266-
Width = XUnit.FromInch((double)zImgSrc.Width / dDPI),
267-
Height = XUnit.FromInch((double)zImgSrc.Height / dDPI)
272+
Width = XUnit.FromInch((double)zImgSrc.Width / (double)zImgSrc.HorizontalResolution),
273+
Height = XUnit.FromInch((double)zImgSrc.Height / (double)zImgSrc.VerticalResolution)
268274
});
269275
var zGfx = XGraphics.FromPdfPage(zPage);
270276
using (var zMem = new MemoryStream())
271277
{
272278
zImgDestination.Save(zMem, ImageFormat.Bmp);
279+
// just for testing
280+
//zImgDestination.Save("C:\\temp.bmp", ImageFormat.Bmp);
273281
var zXImage = XImage.FromStream(zMem);
274282
zGfx.DrawImage(zXImage, new XPoint());
275283
zXImage.Dispose();
@@ -360,7 +368,6 @@ protected override bool OpenFormData(string sFileName)
360368
if (SerializationUtils.DeserializeFromXmlFile(sFileName, Encoding.UTF8, ref zConstruct))
361369
{
362370
listViewCards.Items.Clear();
363-
numericDPI.Value = zConstruct.DPI;
364371
txtOutputPath.Text = zConstruct.OutputPath;
365372
var nTargetIndex = 0;
366373
zConstruct.CardEntries.ForEach(e =>
@@ -378,7 +385,6 @@ protected override bool SaveFormData(string sFileName)
378385
{
379386
var zConstruct = new Construct()
380387
{
381-
DPI = (int) numericDPI.Value,
382388
OutputPath = txtOutputPath.Text,
383389
CardEntries = new List<CardEntry>(listViewCards.Items.Count)
384390
};
@@ -395,7 +401,6 @@ protected override bool SaveFormData(string sFileName)
395401
return SerializationUtils.SerializeToXmlFile(sFileName, zConstruct, Encoding.UTF8);
396402
}
397403

398-
#endregion
399-
404+
#endregion
400405
}
401406
}

PdfConstruct/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("0.0.0.2")]
36-
[assembly: AssemblyFileVersion("0.0.0.2")]
35+
[assembly: AssemblyVersion("0.0.0.3")]
36+
[assembly: AssemblyFileVersion("0.0.0.3")]

PdfConstruct/bin/Release/History.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
PdfConstruct Version History
22
--------------------------
3+
0.0.0.3
4+
- Removed DPI option (image will provide this)
5+
- Added save on close detection
6+
- Adjusted DPI functionality (appears to fix the issue with blurring/compressing)
7+
38
0.0.0.2
49
- Added movement buttons and shortcuts (Shift+up/down) for adjusting the order (supports multi-select moves)
510
- Updated PDFSharp version to 1.5beta3 to work around Acrobat transparency issue relating to PDF/X-1a conversion

0 commit comments

Comments
 (0)