0
我使用code39來顯示條形碼。但由於某些原因,我不能使用下面的code39字體是我的代碼。我已經將ttf文件包含在字體文件夾中。下面如何包含code39字體ttf文件並使用它?
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryui")
@Styles.Render("~/fonts")
<table class="table">
<tr>
@{
string size = "0px";
int co = Model.BarCodeItems.FirstOrDefault().Columns;
if (co <= 2)
{
size = "90px";
}
if (co > 2 || co < 5)
{
size = "70px";
}
if (co >= 5)
{
size = "40px";
}
int count = 0;
}
@foreach (var items in Model.BarCodeItems)
{
<td style="text-align:center">
<p style="font-family:Code39r;font-size:@size"> @items.BarCode</p>
<p> @items.BarCode</p>
@*<ol class="" style="width:5px">@items.BarCode.Replace("*", "")</ol>*@
</td>
count++;
if (count == @items.Columns)
{
<tr></tr>
count = 0;
}
}
</tr>
</table>
是我包的配置我都添加進來捆綁配置,也呈現在我的網頁。
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.datepicker.css"));
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/bootstrap").Include(
"~/Content/bootstrap.min.css"));
bundles.Add(new StyleBundle("~/fonts").Include(
"~/fonts/Code39r.ttf"));
}