我想用 iText 创建一个 PDF/A-1A 文件,但我无法绕过经典的 Helvetica 错误,但我不知道如何修复它。这是代码:
Imports iTextSharp.text.pdf
Imports iTextSharp.text
Imports System.IO
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim document As Document = New Document(PageSize.A4)
Dim writer As PdfAWriter = PdfAWriter.GetInstance(document, New FileStream("./Test.pdf", FileMode.Create), PdfAConformanceLevel.PDF_A_1A)
writer.CreateXmpMetadata()
document.Open()
'The sRGB File is located in my Resources.'
Dim icc = ICC_Profile.GetInstance(My.Resources.sRGB)
writer.SetOutputIntents("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1", icc)
Dim fonts As Font = FontFactory.GetFont("./FreeSansBold.ttf", BaseFont.WINANSI, BaseFont.EMBEDDED, 10)
Dim normal9 As Font = FontFactory.GetFont("./FreeSans.ttf", BaseFont.WINANSI, BaseFont.EMBEDDED, 9)
Dim bold9 As Font = FontFactory.GetFont("./FreeSansBold.ttf", BaseFont.WINANSI, BaseFont.EMBEDDED, 9)
Dim normal8 As Font = FontFactory.GetFont("./FreeSans.ttf", BaseFont.WINANSI, BaseFont.EMBEDDED, 8)
document.Add(New Paragraph("Hello world"))
writer.Close()
document.Close()
End Sub
End Class
如果你有问题,就问我。我希望你能帮助我。
问候
纳迪克斯。