There are many possible approaches to generating barcode images for ASP.NET pages, while avoiding the limitations of the display resolution. One method, suitable for use when the barcode is to be data-dependent, is to use two aspx files, one which creates the a moderate resolution memorystream barcode image and calls the second file as the SRC for and IMG tag to display the page at the correct size, eg
<script language="vb" runat="server">
sub Page_Load(Sender As Object, E As EventArgs)
…………………..
m_barcode.Unit = GraphicsUnit.Pixel
m_barcode.XUnit = 0
m_barcode.Font=m_Font
m_barcode.Orientation=0
m_barcode.AutoCheckdigit=TRUE
m_barcode.BarcodeHeight = ht
m_barcode.BarcodeWidth = wd
m_barcode.CodeTypeValue = 8
m_barcode.caption = Session("xx")
Session("ms")=m_barcode.sBarcode(300,300,System.Drawing.Imaging.ImageFormat.Png)
if Session("ms").Length>0 then
Session("ht")=m_barcode.ImageHeight
Session("wd")=m_barcode.ImageWidth
end if
</script>
</head>
<BODY>
<H1>dLSoft
dBarcode.NET - on ASP.NET</H1>
<IMG SRC="page2.aspx" HEIGHT=" <% =Session("ht") %> " WIDTH=" <% =Session("wd") %> ">
<p> dBarcode.NET components can generate barcode
images in BMP, GIF, PNG, JPG, TIF and WMF formats, and for more than 50 barcode
types.
</BODY>
</HTML>
The Session variables ht and wd contain the actual sizes at which the image is to be drawn on the web page. These are calculated when the page is loaded and used when the IMG SRC calls the second page.
The second file (page2.aspx) serves up the image at the correct size, eg.
<%@
LANGUAGE="VB"%>
<%
Response.ContentType="image/png"
Response.BinaryWrite(Session("ms").GetBuffer())
%>
A working sample is included with component distribution.
More: