1

現在、私はこのコードを使用しています:

StyleSheet css = new StyleSheet();
using (var htmlViewReader = new StringReader(htmlText)) {
    using (var htmlWorker = new HTMLWorker(pdfDocument)) {
        css.LoadStyle("body", "style", "width: 100%;");
        //  css.LoadStyle(".fr", "style", "float: right;");
        css.LoadStyle("fr","float","right");
        css.LoadStyle(".fl", "style", "float: left; width: 20%;");
        css.LoadStyle("container", "style", "width: 960px; margin: 0 auto;");
        css.LoadStyle("header", "style", "margin-top: 75px; width: 100%;");
        css.LoadStyle("header name", "style", "font-size: 18px;");
        css.LoadStyle("footer", "style", "border-top: 2px solid #333; text-align: center;");
        css.LoadTagStyle("p", "style", "padding: 0 45px 0 25px; color: #666;");
        css.LoadTagStyle("a", "style", "color: #666;");
        css.LoadStyle("deposit", "style", "font-size: 22px; width: 100%; color: #999; font-weight: bold; float:right;");
        css.LoadStyle("cl", "style", "clear: both;");
        css.LoadStyle("title", "style", "margin: 0 45px 0 25px; border-bottom: 2px solid #333; font-weight: bold;");
        css.LoadTagStyle("ul", "style", "list-style-type: none; width: 50%;");
        css.LoadTagStyle("ul li", "style", "line-height: 25px;");
        css.LoadTagStyle("li", "style", "line-height: 25px;");
        htmlWorker.SetStyleSheet(css);
        //htmlWorker.Parse(htmlViewReader);
    }
}

ただし、文書化されているように、HTMLWorkerCSS スタイルは解析されません。

XML Worker に置き換える必要があります。これを行う方法について何か考えはありますか?

4

1 に答える 1