【发布时间】:2015-02-16 16:03:19
【问题描述】:
有没有人尝试过使用 ABCPDF Gecko 引擎来实现标签?只要我使用 Gecko,它就可以在 MSHTML 引擎 (Internet Explorer) 上正常工作,它可以更好地呈现我的 HTML,它找不到 HTML 中指定的标签。
我正在使用 style="abcpdf-tag-visible: true;"指定使用默认引擎工作的标签。
以下代码生成一个空白文档。
[Test]
public void Tags_With_Gecko()
{
Doc theDoc = new Doc();
theDoc.Rect.Inset(100, 100);
theDoc.Rect.Top = 700;
theDoc.HtmlOptions.Engine = EngineType.Gecko;
// Tag elements with style 'abcpdf-tag-visible: true'
theDoc.HtmlOptions.ForGecko.AddTags = true;
int id = theDoc.AddImageHtml("<FONT id=\"p1\" style=\"abcpdf-tag-visible: true; font-size: 72pt\">Gallia est omnis divisa in partes tres.</FONT>");
// Frame location of the tagged element
XRect[] tagRects = theDoc.HtmlOptions.ForGecko.GetTagRects(id);
foreach (XRect theRect in tagRects)
{
theDoc.Rect.String = theRect.ToString();
theDoc.FrameRect();
}
// Output tag ID
string[] tagIds = theDoc.HtmlOptions.ForGecko.GetTagIDs(id);
theDoc.Rect.String = theDoc.MediaBox.String;
theDoc.Rect.Inset(20, 20);
theDoc.FontSize = 64;
theDoc.Color.String = "255 0 0";
theDoc.AddText("Tag ID \"" + tagIds[0] + "\":");
// Save the document
const string testFilename = @"C:\pdf\HtmlOptionsGetTagRects.pdf";
if (File.Exists(testFilename))
File.Delete(testFilename);
theDoc.Save(testFilename);
theDoc.Clear();
Process.Start(testFilename);
}
默认引擎几乎相同的代码可以正确生成它。
【问题讨论】:
-
我遇到了完全相同的问题。向 WebSuperGoo 发送电子邮件寻求支持。如果我得到解决,将在此处更新......它在一台服务器上工作,在另一台服务器上失败,使用 Gecko。