我使用的是ABCPDF版本9.1.2.5
我们创建PDF的过程就像在后台导航URL一样,并将完整的HTML作为字符串获取,我们使用AddImageHtml()方法创建PDF,这将与英语完美配合但不适用于其他语言,如中文日语表示为“?”标记
Dim PDFData() As Byte = Nothing
Dim HtmlPage As String
Dim PDFDoc As New Doc
PDFDoc.Font = PDFDoc.EmbedFont("Arial Unicode MS", LanguageType.Unicode, False, True)
HtmlPage = myclass.GetWebPageAsString(TargetURL, PostData)
If Orientation = Myclass.PDFOrientation.Landscape Then
Width = PDFDoc.MediaBox.Width
Height = PDFDoc.MediaBox.Height
Left = PDFDoc.MediaBox.Left
Bottom = PDFDoc.MediaBox.Bottom
PDFDoc.Transform.Rotate(90, Left, Bottom)
PDFDoc.Transform.Translate(Width, 0)
PDFDoc.Rect.Width = Height
PDFDoc.Rect.Height = Width
End If
PDFDoc.Rect.Inset(20, 20)
PDFDoc.HtmlOptions.Timeout = 3600000
PDFDocID = PDFDoc.AddImageHtml(HtmlPage)
PDFData = PDFDoc.GetData
PDFDoc.Clear()
您正在使用的ABCpdf版本于2015年初停止使用。您使用的默认引擎的CJK字符呈现取决于运行应用程序的计算机上安装的Internet Explorer版本。从版本11开始,现在可以使用Chrome引擎,它更少依赖于您的操作系统配置。它也更快,更符合标准。