我有一个通过 Webforms.LocalReport 创建的 RDLC 报告,它使用了我在开发机器上安装的一些自定义字体。这很好用,并将字体嵌入到 PDF 中,以便其他人不需要安装字体即可查看。
我的问题是,在部署到我们的生产环境时,有许多机器可能会运行报告。我不想在每台“潜在”机器上安装字体 - 有没有办法将(.TTF)字体文件附加到(VB.NET)解决方案,并从这里提取字体,而不是从本地机器?
希望这是有道理的!
如果有帮助,下面是我正在使用的代码示例
Dim PDFfile As FileInfo
Dim deviceInfo As String = String.Empty
Dim PDF() As Byte
Dim reportParams As List(Of ReportParameter)
Using report As New LocalReport
' Set up report
' Report device information to create PDF with A4 sized pages
deviceInfo = "<DeviceInfo>" & _
" <OutputFormat>EMF</OutputFormat>" & _
" <Orientation>Portrait</Orientation>" & _
" <PageWidth>21cm</PageWidth>" & _
" <PageHeight>29.7cm</PageHeight>" & _
" <MarginTop>0cm</MarginTop>" & _
" <MarginLeft>0cm</MarginLeft>" & _
" <MarginRight>0cm</MarginRight>" & _
" <MarginBottom>0cm</MarginBottom>" & _
"</DeviceInfo>"
With report
.DisplayName = "Display Name"
report.ReportEmbeddedResource = "ReportName.rdlc"
' Add all necessary parameters
reportParams = New List(Of ReportParameter)
reportParams.Add(...)
.SetParameters(reportParams)
End With
PDF = report.Render("PDF", deviceInfo)
PDFfile = New FileInfo("C:\")
Using stream As FileStream = PDFfile.Create
stream.Write(PDF, 0, PDF.Length)
End Using
End Using
提前致谢!