在Chrome PDF查看器的第一页中没有显示图像和内容,但是当我们保存PDF时,它正确显示所有页面。我使用XSLT生成PDF的格式。我的代码如下所示
using (MemoryStream myMemoryStream = new MemoryStream())
{
iTextSharp.text.Document pdfDoc = new iTextSharp.text.Document(PageSize.A4, 40f, 10f, 40f, 36);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
StyleSheet style = new StyleSheet();
htmlparser.Style = style;
PdfWriter myPDFWriter = PdfWriter.GetInstance(pdfDoc, myMemoryStream);
pdfDoc.Open();
htmlparser.Parse(sr);
HTMLWorker htmlparser1 = new HTMLWorker(pdfDoc);
StyleSheet style1 = new StyleSheet();
htmlparser1.Style = style1;
pdfDoc.Close();
content = AddPageNumbers(myMemoryStream.ToArray());
}