Skip to content

Commit 7a85dad

Browse files
Update Program.cs
1 parent bcccabe commit 7a85dad

File tree

1 file changed

+3
-11
lines changed
  • Paragraphs/Replace-DISPLAYBARCODE-to-image/.NET/Replace-DISPLAYBARCODE-to-image

1 file changed

+3
-11
lines changed

Paragraphs/Replace-DISPLAYBARCODE-to-image/.NET/Replace-DISPLAYBARCODE-to-image/Program.cs

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Syncfusion.DocIO.DLS;
1+
using Syncfusion.DocIO.DLS;
22
using Syncfusion.DocIO;
33
using Syncfusion.Pdf.Barcode;
44
using Syncfusion.Pdf.Graphics;
@@ -113,7 +113,6 @@ private static void ReplaceFieldwithImage(WordDocument document)
113113

114114
// Initialize flags for optional parameters
115115
bool addText = false;
116-
bool addCharacter = false;
117116

118117
// Check for the \t option (whether to display text below the barcode)
119118
var tabMatch = Regex.IsMatch(field.FieldCode, @"\\t");
@@ -122,15 +121,9 @@ private static void ReplaceFieldwithImage(WordDocument document)
122121
addText = true;
123122
}
124123

125-
// Check for the \d option (whether to include start/stop characters)
126-
var digitMatch = Regex.IsMatch(field.FieldCode, @"\\d");
127-
if (digitMatch)
128-
{
129-
addCharacter = true;
130-
}
131124

132125
// Generate the Code39 barcode image as a byte array
133-
byte[] qrCode = GenerateCODE39Image(qrBarcodeText, addCharacter, addText);
126+
byte[] qrCode = GenerateCODE39Image(qrBarcodeText, addText);
134127

135128
// Create a new picture object to hold the barcode image
136129
WPicture picture = new WPicture(document);
@@ -201,10 +194,9 @@ private static byte[] GenerateQRBarcodeImage(string qrBarcodeText, float sSwitch
201194
/// Generates a Code39 barcode image and converts it to a byte array.
202195
/// </summary>
203196
/// <param name="qrBarcodeText">The text to be encoded in the Code39 barcode</param>
204-
/// <param name="dSwitch">Whether to include start/stop characters (\d option)</param>
205197
/// <param name="tSwitch">Whether to display the text below the barcode (\t option)</param>
206198
/// <returns>A byte array representing the Code39 barcode image</returns>
207-
private static byte[] GenerateCODE39Image(string qrBarcodeText, bool dSwitch, bool tSwitch)
199+
private static byte[] GenerateCODE39Image(string qrBarcodeText, bool tSwitch)
208200
{
209201
// Create a new Code39 barcode instance
210202
PdfCode39Barcode barcode = new PdfCode39Barcode();

0 commit comments

Comments
 (0)