PDF显示使用iTextSharp之间的空白部分

时间:2015-11-24 06:56:25

标签: c# pdf itextsharp

我的iTextSharp代码如下所示我正在使用XSLT来获取HTML设计:

int pageCount = GetNoofPages(outputString);
StringReader sr = new StringReader(outputString.Replace("###Noofpages###", pageCount.ToString()));
byte[] content = null;
string savedfile = string.Empty;
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.SetStyleSheet(style);
    PdfWriter myPDFWriter = PdfWriter.GetInstance(pdfDoc, myMemoryStream);
    pdfDoc.Open();
    htmlparser.Parse(sr);
    HTMLWorker htmlparser1 = new HTMLWorker(pdfDoc);
    StyleSheet style1 = new StyleSheet();
    htmlparser1.SetStyleSheet(style1);
    pdfDoc.Close();
    content = AddPageNumbers(myMemoryStream.ToArray());
}                 
return content;

我的输出是:

Leg 1: 4311 route
// Now rest of the page is blank
.
.
.
.
.
// Now it will continue on next page
Route details:
// remaining instructions

请帮帮我。

0 个答案:

没有答案