我正在尝试使用外部css文件打印pdf,但是我的文件可以从xml完美读取,但是没有将css应用于pdf。
我尝试执行此代码:
pdfDoc.Open();
string css = "D:\\Office\\cases_converter_tool\\cases_converter_tool\\styleCase.css ";
var cssResolver = XMLWorkerHelper.GetInstance().GetDefaultCssResolver(false);
cssResolver.AddCss(css, "utf-8", true);
//var cssResolver = XMLWorkerHelper.GetInstance().GetDefaultCssResolver(false);
XMLWorkerHelper.GetInstance().ParseXHtml(pdfWriter, pdfDoc, new StreamReader("C:\\Users\\Dip\\Desktop\\MLRA_1982_402.xml")
PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDoc, msReport);
pdfWriter.PageEvent = new ITextEvents();
pdfDoc.Open();
string css = "D:\\Office\\cases_converter_tool\\cases_converter_tool\\styleCase.css ";
var cssResolver = XMLWorkerHelper.GetInstance().GetDefaultCssResolver(false);
cssResolver.AddCss(css, "utf-8", true);
XMLWorkerHelper.GetInstance().ParseXHtml(pdfWriter, pdfDoc, new StreamReader("C:\\Users\\Dip\\Desktop\\MLRA_1982_402.xml"));
我希望xml数据不应与标题重叠,它在页眉和页脚部分的页面的开头和结尾应留有一定的间隔。