I'm converting the text in the barcode which working fine. Then converting the barcode to bitmap, is working fine. But instead of saving the barcode, I want to display it on the pdf. Here I'm using iTextSharp for Pdf & barcode generation. Below is my code:-
Barcode128 code128 = new Barcode128
{
CodeType = Barcode.CODE128,
ChecksumText = true,
X = 1.1f,
BarHeight = 20,
GenerateChecksum = true,
StartStopText = true,
Code = "Angular 9"
};
Bitmap bms = new Bitmap(code128.CreateDrawingImage(Color.Black, Color.White));
I don't want to Save. But directly display in my pdf
bb.Save("E:/API/MyBarCode.jpg", System.Drawing.Imaging.ImageFormat.Gif);
**Appending my html in pdf like this.Here img src I'm creating dynamic filename. in img src I want to pass the value directly **
sb.Append("<img src='" + dta.Rows[0]["PATH"].ToString() + "'></img>");
So can I do it? Please help.
You can show your barcode in the PDF in the following way (no need to create intermediate bitmap):
PdfContentByte canvas = writer.getDirectContent();
Barcode128 code128 = new Barcode128 { ... };
code128.placeBarcode(canvas, BaseColor.BLACK, BaseColor.BLACK);