PdfFontFactory.CreateFont(FontConstants.HELVETICA);
또는 웹 애플리케이션 내부
PdfFontFactory.CreateFont();
를 호출 할 때 C# 1 웹 애플리케이션에 동적 어셈블리에서 지원되지 않고, 타겟 프레임 워크 4.0, 나는 다음과 같은 오류가 발생합니다.
[NotSupportedException: The invoked member is not supported in a dynamic assembly.]
System.Reflection.Emit.InternalAssemblyBuilder.get_Location() +52
iText.IO.Util.ResourceUtil.<LoadITextResourceAssemblies>b__3(Assembly a) +30
System.Linq.WhereSelectListIterator`2.MoveNext() +115
System.Linq.Buffer`1..ctor(IEnumerable`1 source) +239
System.Linq.Enumerable.ToArray(IEnumerable`1 source) +77
iText.IO.Util.ResourceUtil.LoadITextResourceAssemblies() +172
iText.IO.Util.ResourceUtil..cctor() +125
[TypeInitializationException: The type initializer for 'iText.IO.Util.ResourceUtil' threw an exception.]
iText.IO.Font.Type1Parser.GetMetricsFile() +127
iText.IO.Font.Type1Font.Process() +53
iText.IO.Font.Type1Font..ctor(String metricsPath, String binaryPath, Byte[] afm, Byte[] pfb) +131
iText.IO.Font.FontProgramFactory.CreateFont(String name, Byte[] fontProgram, Boolean cached) +381
iText.Kernel.Font.PdfFontFactory.CreateFont(String fontProgram, String encoding) +29
iText.Kernel.Font.PdfFontFactory.CreateFont(String fontProgram) +31
PdfCreator.x(String pdf_file_name) in x.cs:165
ASP.x_cshtml.Execute() in x.cshtml:40
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +196
System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +68
System.Web.WebPages.WebPage.ExecutePageHierarchy() +151
System.Web.WebPages.StartPage.RunPage() +19
System.Web.WebPages.StartPage.ExecutePageHierarchy() +62
System.Web.WebPages.StartPage.RunPage() +19
System.Web.WebPages.StartPage.ExecutePageHierarchy() +62
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +76
System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +114
나는 나는 단지
PdfFontFactory.Register(windows_fonts + "ARIAL.TTF", "Arial");
PdfFont Arial = PdfFontFactory.CreateRegisteredFont("Arial");
를 사용하여 문제를 해결 할 수 있지만, 그래도 만 오류없이 빈 PDF가 발생합니다 생각했다.
C# 콘솔 앱에서 동일한 코드를 실행하면 모든 글꼴이 포함 된 유효한 PDF가 표시됩니다. 또한 C# 콘솔 응용 프로그램 .net 4를 대상으로하므로 대상 프레임 워크와 관련이 없다는 점이 매우 긍정적입니다. 의견을 보내 주셔서 감사합니다. iTextSharp를 들어
C# 버전의 라이브러리에 버그가 있습니다. 로컬에서 문제를 해결하는 방법에 대한 자세한 내용은이 풀 요청을 참조하거나 iText 팀의 수정을 기다리십시오. https://github.com/itext/itext7-dotnet/pull/2 –
감사합니다. 이제 문제를 이해합니다. –