PDF文本显示在Google Chrome中,但不显示在Adobe Acrobat中 [英] PDF text show in Google Chrome but not in Adobe Acrobat
本文介绍了PDF文本显示在Google Chrome中,但不显示在Adobe Acrobat中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个非常奇怪的问题。当我在Adobe Acrobat中打开它时,我使用iTextSharp创建的文档显示为空,但在谷歌浏览器中工作正常。以下是我用来生成文件的一些基本代码:
I have a very strange problem. Documents i create using iTextSharp appears empty when i open them in Adobe acrobat, but works fine in Google Chrome. Here is some basic code that i use to generate my files:
mDocument = new iTextSharp.text.Document(PageSize.A4, 0, 0, 0, 0);
mStream = new MemoryStream();
var writer = PdfWriter.GetInstance(mDocument, mStream);
var font = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
mDocument.Open();
mContent = writer.DirectContent;
mContent.SetFontAndSize(font, 12);
mContent.SetTextMatrix(200, 200);
mContent.ShowText(value);
mDocument.Close();
让其他人遇到此问题或看到我遗漏的任何可能导致此问题的内容。
Have anyone else run into this problem or see anything that I am missing that might cause this problem.
BR
Andreas
BR
Andreas
推荐答案
找到了问题的解决方案。 Adobe Acrobat需要进行这一小改动。
Just found the solution to the problem. Adobe Acrobat requires this small change to work.
mContent.BeginText(); // New line!!!
mContent.ShowText(value);
mContent.EndText(); // New line!!!
这篇关于PDF文本显示在Google Chrome中,但不显示在Adobe Acrobat中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文