방금 다음과 같이 했으므로 정확하게 작동했습니다. Wingdings 글꼴은 두 단어 사이에 오른쪽 아래 그림자가있는 사각형 상자로 나타납니다. 유일한 것은 실제로 Wingdings 글꼴을 실제로 자체적으로 포함 할 수 없다는 것입니다. iTextSharp 암시 적 규칙은 어디 에나 있다고 가정하기 때문에 믿을 수 있습니다. 나는 WINGDNG2.TTF
로 시도하고 올바르게 삽입했다.
어구를 제대로 추가하지 않았습니까? 아니면 Wingdings가없는 머신에서 이것을 여실 까? \ WINDOWS \ FONTS \ WINGDING.TTF :
는
''//Create a new document
Dim Doc As New iTextSharp.text.Document(PageSize.LETTER, 20, 20, 20, 20)
''//Store the document on the desktop
Dim writer = PdfWriter.GetInstance(Doc, New FileStream(Path.Combine(My.Computer.FileSystem.SpecialDirectories.Desktop, "Output.pdf"), FileMode.Create, FileAccess.Write, FileShare.Read))
''//Open the PDF for writing
Doc.Open()
''//Insert a page
Doc.NewPage()
''//Add a regular text block using the default font
Dim Phrase = New Phrase("Hello")
Doc.Add(Phrase)
''//Create our base font
Dim base As BaseFont = BaseFont.CreateFont("C:\Windows\Fonts\wingding.ttf", BaseFont.CP1252, BaseFont.EMBEDDED)
''//Create our usable font
Dim wd As Font = New Font(base, 12, iTextSharp.text.Font.NORMAL, BaseColor.BLACK)
''//Add a text block using Wingdings
Phrase = New Phrase("q", wd)
Doc.Add(Phrase)
''//Add a trailing text block using the default font again
Phrase = New Phrase("Bye")
Doc.Add(Phrase)
''//Close the PDF
Doc.Close()
특히'base' ...'getFontFamilyName()'과'getPostscriptFontName()'을 검사하는 것이 좋습니다. 'getEncoding()'도 해롭지 않습니다. 당신이 요구하는 글꼴을 가져 왔는지 확인하십시오. –
또한 iTextSharp의 어떤 버전을 사용하고 있습니까? 크리스의 기본적으로 똑같은 코드가 잘 작동했는데 ... 설정 문제가 의심 스럽습니다. 버전, 글꼴 경로 등. –