itextsharp html to pdf不会创建边框 [英] itextsharp html to pdf creates no borders

查看:208
本文介绍了itextsharp html to pdf不会创建边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用iTextSharp(在SharePoint上,但我希望这没关系)将HTML文档转换为PDF。到目前为止,我无法获得元素周围的任何边界。我该怎么做呢?


$ b 在c#代码
StyleSheet styles = new iTextSharp.text.html.simpleparser.StyleSheet();
styles.LoadStyle(borderCls,border-style,solid); //< td class =borderCls>
styles.LoadStyle(borderCls,border-width,1px);
styles.LoadStyle(borderCls,border-color,#000);
//
styles.LoadStyle(borderCls,border,solid 1px#000);

//在html
< td style =border:solid 1px#000>
//
< td border =1>
//
< td style =border-style:solid; border-width:1px>

但这些都不起作用。我只是无法让iTextSharp创建任何边框。



更新:也可以只在一个特定的边上定义边框

解决方案

使用此代码。

 < table border =1> 

确定它的纤细。
但固体和px不工作在HTML到PDF。


I use iTextSharp (on SharePoint but I hope this does not matter) to convert a HTML document to PDF. So far I was unable to get any borders around elements. How do I do this? Is this not supported?

Things I tried:

  // in c# code
StyleSheet styles = new iTextSharp.text.html.simpleparser.StyleSheet();
styles.LoadStyle("borderCls", "border-style", "solid"); // <td class="borderCls">
styles.LoadStyle("borderCls", "border-width", "1px");
styles.LoadStyle("borderCls", "border-color", "#000");
  //
styles.LoadStyle("borderCls", "border", "solid 1px #000");

  // in html
<td style="border:solid 1px #000">
  //
<td border="1">
  //
<td style="border-style:solid;border-width:1px">

But these did not work. I just can't get iTextSharp to create any borders.

Update: Also is it possible just to define a Border on only one specific side?

解决方案

use this code.

<table border="1">

sure its woirking. but solid and px is not working in html to pdf.

这篇关于itextsharp html to pdf不会创建边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆