jjzjj

itextsharp

全部标签

c# - 在 Itextsharp 中使用 ITextExtractionStrategy 和 LocationTextExtractionStrategy 获取字符串坐标

我有一个PDF文件,我正在使用ITextExtractionStrategy将其读入字符串。现在我从字符串中获取一个子字符串,例如MynameisXYZ并且需要从PDF中获取子字符串的直角坐标文件,但无法执行。在谷歌搜索中,我知道了LocationTextExtractionStrategy但不知道如何使用它来获取坐标。这是代码..ITextExtractionStrategystrategy=newSimpleTextExtractionStrategy();stringcurrentText=PdfTextExtractor.GetTextFromPage(pdfReader,pa

c# - ITextSharp : Set table cell border color

如何设置表格单元格的边框颜色。这是我的代码://createanddefinetablevartable=newPdfPTable(8);table.HorizontalAlignment=Element.ALIGN_CENTER;//table.HeaderRows=1;//thecellobjectPdfPCellcell;varf=FontFactory.GetFont("Tahoma",11,Font.BOLD);cell=newPdfPCell(newPhrase("SourceReview",f));cell.BorderColorLeft=newBaseColor(255

c# - iTextSharp 居中对齐 Document 对象中的对象

有没有一种快速简单的方法可以使文档对象中的对象居中对齐?不执行任何计算逻辑,即。获取页面宽度、获取内容宽度、除以二等。我在Document对象中的Paragraph对象中有一个PdfPTable对象。我想将Paragraph对象居中。谢谢! 最佳答案 iTextSharp的等效替代品:paragraph.Alignment=Element.ALIGN_CENTER;或者这样试试paragraph.IndentationRight=100;paragraph.IndentationLeft=100;

c# - 如何使用 iTextSharp 将空白页添加到 pdf?

我正在尝试做一些我认为非常简单的事情,但它并不是那么简单,谷歌也没有帮助。我正在使用iTextSharp将PDF文档(信件)合并在一起,以便可以一次打印它们。如果一封信的页数是奇数,我需要附加一个空白页,这样我们就可以双面打印这些信件。这是我目前拥有的用于合并所有字母的基本代码://initiaiseMemoryStreampdfStreamOut=newMemoryStream();Documentdocument=null;MemoryStreampdfStreamIn=null;PdfReaderreader=null;intnumPages=0;PdfWriterwriter=

c# - 如何使用 iTextSharp 获取文本格式

我正在使用iTextSharp从PDF中读取文本内容。我也能读懂。但是我丢失了文本格式,如字体、颜色等。有什么方法也可以获得这种格式。下面是我用来精确文本的代码段-PdfReaderreader=newPdfReader("F:\\EBooks\\AspectsOfAjax.pdf");textBox1.Text=ExtractTextFromPDFBytes(reader.GetPageContent(1));privatestringExtractTextFromPDFBytes(byte[]input){if(input==null||input.Length==0)return

c# - iTextSharp 表格宽度为页面的 100%

我正在尝试使用iTextSharp将表格添加到文档中。这是一个例子:Documentdocument=newDocument(PageSize.LETTER,72,72,72,72);PdfWriterwriter=PdfWriter.GetInstance(document,newFileStream("C:\\test.pdf",FileMode.Create));document.Open();Tabletable=newTable(2,1);table.Width=document.RightMargin-document.LeftMargin;//Cellplaceholde

c# - 使用 CSS 从 HTML 在 iTextSharp 中呈现 PDF

知道如何使用iTextSharp呈现PDF,以便它使用CSS呈现页面。css可以嵌入到HTML中,也可以单独传入,我并不关心,只是希望它能工作。将非常感谢具体的代码示例。此外,我真的很想坚持使用iTextSharp,但如果您对其他东西有任何建议,它必须是免费的、开源的,并且拥有允许在商业软件中使用它的许可证。 最佳答案 现在不可能,但没有什么可以阻止您启动可以做到这一点的开源项目。我可能真的会开始一个,因为我也需要它!基本上,您需要将html和css标记转换为iTextSharp类的解析器。所以成为iTextSharp.Simple

c# - 让 PdfStamper 与 MemoryStreams 一起工作(c#,itextsharp)

我想到重新编写将PDF文件签名为新代码的旧代码,该代码对来自Web服务并发送的MemoryStreams(字节数组)进行签名。简单吧?嗯,那是昨天。今天我就是无法让它工作。这是旧代码,它使用FileStreams并且有效:publicstaticstringOldPdfSigner(PdfReaderpdfReader,stringdestination,stringpassword,stringreason,stringlocation,stringpathToPfx){using(FileStreampfxFile=newFileStream(pathToPfx,FileMode.

c# - 如何在 iTextSharp\iText 中的两个元素之间添加空格\边距?

我是iTextSharpt(C#的iText移植)的新手,我有以下疑问。在我的代码中有类似的东西:iTextSharp.text.Paragraphtitolo=newiTextSharp.text.Paragraph(currentVuln.Title,_fontTitolo0);titolo.Alignment=iTextSharp.text.Element.ALIGN_CENTER;_document.Add(titolo);table=newPdfPTable(3);table.WidthPercentage=98;cell=newPdfPCell(newPhrase("Hea

c# - iTextsharp、PdfPCell.VerticalAlignment 和 PdfPCell.Horizo​​ntalAlignment

我试图弄清楚如何让PdfPCell中的文本显示在中间。我尝试了很多不同的选择,例如:myCell.VerticalAlignment=Element.ALIGN_MIDDLE;myCell.VerticalAlignment=PdfPCell.ALIGN_MIDDLE;myCell.VerticalAlignment=Rectangle.ALIGN_MIDDLE;Noneofthatworksforme.VerticalAlignmenttakesanint,soItriedtomakealoop,toseeificouldfindtherightnumber,buteverythin