Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
gomi42 committed Aug 21, 2023
1 parent a1d1967 commit 4e03900
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions BarcodeGenerator/EmfBarcodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal class EmfBarcodeGenerator : BarcodeGenerator

/////////////////////////////////////////////////////////////

private string imageBaseFilename;
private string filename;
private Metafile metafile;
private Graphics graphics;
private int currentPage;
Expand All @@ -50,7 +50,7 @@ internal class EmfBarcodeGenerator : BarcodeGenerator

public bool GenerateEmf(string focal, string outputBaseFilename)
{
imageBaseFilename = Path.Combine(Path.GetDirectoryName(outputBaseFilename), Path.GetFileNameWithoutExtension(outputBaseFilename));
filename = outputBaseFilename;
currentPage = 1;

return Generate(focal, false);
Expand Down Expand Up @@ -80,7 +80,8 @@ private void InitImage()
Graphics referenceGraphics = Graphics.FromImage(bitmap);
IntPtr referenceHdc = referenceGraphics.GetHdc();

metafile = new Metafile(imageBaseFilename + "-" + currentPage.ToString() + ".emf", referenceHdc, EmfType.EmfOnly);
var baseFilename = Path.Combine(Path.GetDirectoryName(filename), Path.GetFileNameWithoutExtension(filename));
metafile = new Metafile(baseFilename + "-" + currentPage.ToString() + Path.GetExtension(filename), referenceHdc, EmfType.EmfOnly);

referenceGraphics.ReleaseHdc(referenceHdc);
referenceGraphics.Dispose();
Expand Down

0 comments on commit 4e03900

Please sign in to comment.