我正在将代码从itextsharp移植到itext7,并在字体权重方面遇到困难。下面是我来自itextsharp的代码片段(不是最好的代码!)但是工作得很好,给了我任何可用的字体重量。
public class MyLocationTextExtractionStrategy : LocationTextExtractionStrategy
{
public override void RenderText(TextRenderInfo renderInfo)
{
var oFont = renderInfo.GetFon
我正试图从iText5迁移到iText7,但是文本的绝对定位一直存在问题。似乎在相同文本的相对位置上有相当大的偏移,即使对iText5和iText7进行了完全相同的测量。
下面是显示问题的代码:
using iText.Kernel.Geom;
using iText.Kernel.Pdf;
using iText.Layout;
using iText.Layout.Element;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threadin
我需要从头开始重写一个VB.NET解决方案,因为我无法修复一个编译器错误(VS支持要求我从头创建解决方案,以查看错误是否消失)。
我创建了一个新的VB.NET项目,并添加了旧的表单、类和模块。然后我添加了NuGet包。
以我的形式
Imports iTextSharp.text.pdf
Imports iTextSharp.text.pdf.parser
我现在收到错误了
itextsharp.text.document is not defined
Type 'PDFWriter' is not defined
PDFContentByte is not defined.
以
我有一个问题,从一个PDF文件导入页面到另一个。一些颜色从源PDF更改为红色(见下图)。
输入:
输出:
这是源文件:
这是我使用的PDF合并代码:
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
using Matrix = System.Drawing.Drawing2D.Matrix;
using Rectangle = iT
请告诉我在iText7中可以使用什么方法将pdf转换为图像。在Itexsharp中,有一个选项可以将pdf文件转换为图像。下面是链接。使用iTextSharp将PDF转换为图像http://www.csharpcorner.com/UploadFile/a0927b/create-pdf-document-and-convert-to-image-programmatically/ 下面是使用以下引用链接创建的示例代码。itext7 pdf to image --这没有按预期的那样工作。它没有将pdf转换成图像。它正在创建一个1kb的空白图像。 string fileName = Syste
有一个使用iTextSharp的代码:
PdfReader reader = new PdfReader(document);
PdfStamper st = PdfStamper.CreateSignature(reader, new FileStream(document + "_signed.pdf", FileMode.Create, FileAccess.Write), '\0');
PdfSignatureAppearance sap = st.SignatureAppearance;
// some
如何使用iText7检索存储在PDF中的所有元数据?
using (var pdfReader = new iText.Kernel.Pdf.PdfReader("path-to-a-pdf-file"))
{
var pdfDocument = new iText.Kernel.Pdf.PdfDocument(pdfReader);
var pdfDocumentInfo = pdfDocument.GetDocumentInfo();
// Getting basic metadata
var author = pdfDocumentInf
最近,我们的项目升级到了一个新的iTextSharp.LGPLv2.Core v1.6.5。我有一种从PDF文件中提取文本的方法。
当时我用了这个:
if (File.Exists(pdf1Path))
{
var pdfReader = new PdfReader(pdf1Path);
string pdfText;
string currentText;
//Text extracting to List
for (int i = 1;
我有一段使用iTextSharp 5的C#代码,我需要将它移植到IText7。 public static PdfReader Fix(PdfReader pdfReader, int pagina)
{
var dic = pdfReader.GetPageN(pagina);
var resources = dic.GetAsDict(PdfName.Resources);
var fonts = resources?.GetAsDict(PdfName.Font);
if (fonts == null) return pdfReader;
f
需要一些帮助我有一个pdf,我只需要阅读它,并将其内容存储在数据库中。由于某种原因,我找不到使用Itext 7完成此操作的简单示例
另一件事,内容是在希伯来语,一开始我使用iTextSharp,但我得到的内容是在相反的顺序,所以我有两个选择: 1.修复反向代码2.也许找到一个更正常的代码可能在Itext7中没有这个问题。
StringBuilder text = new StringBuilder();
if (File.Exists(fileName))
{
PdfReader pdfReader = new PdfReader(fileName);
for (int p
我需要底部对齐文本,我从TextBox获得的PDF文件。
我使用下面的代码从TextBox中获取pdf格式的文本。
for (int i = 1; i <= reader.NumberOfPages; i++)
{
iTextSharp.text.pdf.PdfArray array = reader.GetPageN(i).GetAsArray(iTextSharp.text.pdf.PdfName.ANNOTS);
if (array == null) continue;
for (int j
我正在使用2008。我想生成pdf文件的按钮点击。我用过
using iTextSharp.text;
using iTextSharp.text.pdf;
但它显示出一个错误
The type or namespace name iTextSharp could not be found (are you missing a using directive or an assembly reference?
从搜索中我发现,需要添加一个源程序集(iTextSharp.dll)。怎么可能呢?