Pdf在Acrobat中打开错误?

时间:2016-11-16 05:36:06

标签: c# asp.net itext

当我使用iTextSharp在pdf中添加页脚时,在acrobat中打开时c#pdf显示错误。

我的代码是:

base.OnEndPage(writer, document);
iTextSharp.text.Rectangle pageSize = document.PageSize;

float GCEStart = pageSize.Width - 200;
float CapitalNovusStart = pageSize.Width - 175;
float ReportGeneratedStart = pageSize.Width - (pageSize.Width - 20);
float eZREviewStart = pageSize.Width - (pageSize.Width - 130);

float offset = 0;
offset = (document.PageSize.Width - template.Width) / 2;

cb.SetRGBColorFill(128, 128, 128);
cb.BeginText();
cb.SetFontAndSize(bf, 8);
cb.SetTextMatrix(ReportGeneratedStart, 15);
cb.ShowText("Report has been generated by");
cb.AddTemplate(template, offset, 20);
cb.EndText();

cb.SetRGBColorFill(255, 192, 0);
cb.BeginText();
cb.SetFontAndSize(bf, 16);
cb.SetTextMatrix(eZREviewStart, 15);
cb.ShowText("eZReview");
cb.AddTemplate(template, offset, 20);
cb.EndText();

cb.SetRGBColorFill(128, 128, 128);
cb.BeginText();
cb.SetFontAndSize(bf, 8);
cb.SetTextMatrix(GCEStart, 10);
cb.ShowText("GOVERNANCE | COMPLIANCE | E-DISCOVERY");
cb.AddTemplate(template, offset, 20);
cb.EndText();

cb.SetRGBColorFill(255, 192, 0);
cb.BeginText();
cb.SetFontAndSize(bf, 16);
cb.SetTextMatrix(CapitalNovusStart, 20);
cb.ShowText("CAPITAL NOVUS");
cb.AddTemplate(template, offset, 20);
cb.EndText();

我一直在搜索setTextMatrix中存在的问题,我不知道如何设置此代码正常工作pdf生成fin但是当我在acrobat中打开pdf文件时显示错误

0 个答案:

没有答案