Tag: pdf generation

使用itextSharp 5.3.3对数字签名和validationPdf文档

我正在尝试使用iTextSharp 5.3.3对服务器(c#)上的pdf文档进行数字签名和validation。 我使用DigiSign(在线工具)生成.Pfx文件,然后使用Windows生成证书(.cer)文件 /// /// Signs a PDF document using iTextSharp library /// /// The path of the source pdf document which is to be signed /// The path at which the signed pdf document should be generated /// A Stream containing the private/public key in .pfx format which would be used to sign the […]

如何使用C#中的iTextSharp将添加的图像带到最前沿

好的,我必须制作一个有一些风格的PDF。 这是标签。 我有以下代码: Document doc = new Document(PageSize.A4); int labelHeight = 394; int labelWidth = 556; float labelTop = doc.PageSize.Height – 2; float labelBottom = doc.PageSize.Height – labelHeight; MemoryStream ms = new MemoryStream(); PdfWriter writer = PdfWriter.GetInstance(doc, ms); doc.Open(); PdfContentByte cb = writer.DirectContent; // Generate Boxes For Content cb.SetColorStroke(new CMYKColor(207, 115, 255, 133)); cb.SetLineWidth(4); cb.SetColorFill(new […]

计算iTextSharp PDF文件的高度?

使用iTextSharp时,如何计算PDF文档的高度? 我正在使用iTextSharp使用绝对位置在PDF文档上定位各种图像。 但是我注意到SetAbsolutePosition()从底部定位Y参数,所以我需要计算高度才能做到这样的事情: Y = PdfHeight – i

基于Microsoft Word模板生成PDF文档

我需要一个Word文档,这是一个类别的模板…收集用户输入以填充该模板中的特定字段..然后生成一个PDF文件,其中包括已完成的模板以及一些其他文档类型。 有没有人对组件有一个很好的建议来实现这个目标? 优选地,不需要在Web服务器上安装Microsoft Office。

如何将HTML转换为XHTML转换以在iText C#中生成封闭标签

我使用类iTextSharp.tool.xml.XMLWorkerHelper将HTML格式的文本添加到ASP .NET C#项目的pdf文件中。 这是我的代码: Paragraph bookingTemplateDescriptionContent = new Paragraph(); desc.Content = desc.Content.Replace(“”, “”); //HACK : To avoid exception, replace the br tag in HTML formatted to XHTML formatted ElementList list = XMLWorkerHelper.ParseToElementList(desc.Content, null); foreach (var element in list) { foreach (Chunk chunk in element.Chunks) { chunk.Font = bookingTemplateDescFont; } bookingTemplateDescriptionContent.Add(element); } 但最近我得到一个例外: Invalid nested tag […]

在MigraDoc中将页码对齐到右角

我知道如何显示页码以及如何在页脚中对齐它们。 但是我的问题是我的页脚包含一些自定义文本,应该左对齐,页码应该对齐到右上角。 string footer = “My custom footer”; Paragraph footerParagraph = section.Footers.Primary.AddParagraph(footer); footerParagraph.AddTab(); footerParagraph.AddPageField(); 上面将为第1页生成“我的自定义页脚1”,我需要将页面nmuber放在页面的最右边。 我可以添加额外的空格或标签,但认为必须有一个干净的方法来实现这一点。 谢谢。

iTextSharp:在表格单元格上的文本字段上设置文本会导致文本太宽并且被压扁

我认为这可能是一个错误,但如果有人可以提供帮助,我会很感激。 我目前还有另一个问题涉及类似的问题,但我认为这个问题可以更好地说明问题,更简单。 话虽如此,我不想删除旧的,以防它增加我的等待时间。 我屈服于mods来决定哪个问题更好。 这是一个示例应用程序,它创建一个pdf,然后是一个表。 它向表中添加一个单元格,然后将fieldpositioningevent绑定到单元格事件。 using System; using System.Diagnostics; using System.IO; using iTextSharp.text; using iTextSharp.text.pdf; namespace iTextSharpTextBoxInTableCell { class Program { static void Main(string[] args) { // Create a PDF with a TextBox in a table cell BaseFont bfHelvetica = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1250, false); Font helvetica12 = new Font(bfHelvetica, 12, Font.NORMAL, BaseColor.BLACK); Document doc = […]

如何在传递多个参数的同时生成PDF格式的Crystal Report?

我想以pdf格式生成水晶报告。 我通过传递一个参数做了同样的事情。 但这次我要传递10个参数。 我遵循了与传递一个参数所做的相同的事情。 但现在我收到错误消息“无法评估表达式,因为代码已优化或本机框架位于调用堆栈之上。” 任何人请提出建议。 提前致谢。 请根据生成PDF格式的Crystal Report修改我的代码。 在按钮单击事件中,我编写了以下代码。 try { CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); string conn = ConfigurationManager.ConnectionStrings[“ConnectionString”].ToString(); string[] str = conn.Split(‘;’); string server = str[0].Substring(str[0].IndexOf(” = “) + 3); string database = str[1].Substring(str[1].IndexOf(” = “) + 3); string userid = str[2].Substring(str[2].IndexOf(” = “) + 3); string password = “Welc0me”; rpt.Load(Server.MapPath(“~/Reports/Marketing/JobOrdersList.rpt”)); for […]

使用iTextSharp将pdf显示到网页?

我正在使用iTextSharp生成pdf。 我想在网页上显示它,让用户从在线pdf查看器中保存它。 dynamicpdf有一个drawtoweb()方法,但它不能免费使用,我无法使用iTextSharp找到相同的function。 如何显示pdf? string newFile = “Pdf Document.pdf”; Document doc = new Document(); PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(newFile, FileMode.Create)); doc.AddCreator(“Myself”); doc.AddTitle(“Sample PDF Document”); doc.Open(); doc.Add(new Paragraph(“Hello, World!”)); doc.Close();

C#html到pdf转换器使用wkhtmltopdf或任何其他免费工具

什么是在C#中将html转换为pdf的完美工具? 我通过stackoverflow.com找到了wkhtmltopdf。 但它不起作用。 在命令行中转换“www.google.com”时显示此消息。 C:\ Program Files \ wkhtmltopdf> wkhtmltoimage.exe www.google.com go.pdf 载入页面(1/2) 渲染(2/2) 错误:无法保存图像 完成 我还下载了EO.pdf,但不确定如何通过C#或命令行使用它。 只需要一个C#中的简单工具和指南,它可以将url或html soruce中的html转换为pdf。 提前致谢