itextsharp

CS0246: The type or namespace name 'itextsharp' could not be found

好久不见. 提交于 2019-12-11 04:42:12
问题 Hello: I received the above error message and searched for a solution from various websites. I have copied the itextsharp.dll library into the bin folder of my C# project, into the c:\windows\assembly folder, c:\Program Files\Microsoft.Net\Primary Interop Assemblies folder, and the c:\windows\Microsoft.Net\Framework\2.0.50727 folder. Unfortunately, I am still getting the same error. Can anyone help me with this? Thanks in advance. 回答1: Download the (itextsharp.dll) file and paste that file in

How to extract text from a PDF and decode characters?

微笑、不失礼 提交于 2019-12-11 04:17:07
问题 I am using itextsharp to extract text from a pdf document using this code: public static bool does_document_text_have_keyword(string keyword, string pdf_src, Report report_object) // TEST { try { PdfReader pdfReader = new PdfReader(pdf_src); string currentText; int count = pdfReader.NumberOfPages; for (int page = 1; page <= count; page++) { ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy(); currentText = PdfTextExtractor.GetTextFromPage (pdfReader, page, strategy);

iTextSharp. Why cell background image is rotated 90 degrees clockwise?

与世无争的帅哥 提交于 2019-12-11 04:15:38
问题 I would like to have cell background using it's natural dimensions and if they don't fit cell - image should be cropped. One more thing that when I use pattern fill image is actually 90 degress rotated. So the main thing in this question is why pattern image is rotated after it adding I have googled for answer and read documentation, but can't find any explanation. Here is code: Image img = Image.GetInstance("someImage.png"); var cell = new PdfPCell() { BorderWidthTop = 0, BorderWidthBottom =

Prevent page break in text block with iText, XMLWorker

╄→尐↘猪︶ㄣ 提交于 2019-12-11 03:48:51
问题 I have a text block in a <div> or <p> which I want not to have a page break within. If the text block does not fit on the current page then I want it on a new page. How can I setup XMLWorker to prevent page breaks within certain tags? 回答1: As of version 5.5.7 the XMLWorker in iText supports page-break-inside: avoid; See Changelog 来源: https://stackoverflow.com/questions/29601081/prevent-page-break-in-text-block-with-itext-xmlworker

.net, Itextsharp, how to flatten comments (specifically stamps)?

十年热恋 提交于 2019-12-11 03:43:55
问题 In short, I'm having issues specifically "flattening" stamp comments in PDF's while using Itextsharp. The effect I'm looking for is identical to what you get when you "print to PDF" from Acrobat (the stamp can no longer be moved/edited/etc. but you can still select any text it might have). Using some very simple Javascript code also seems to work just fine (this.flattenPages). This problems seems to specifically pertain to stamps, which is the real trick of it. I've successfully used the

Why aren't my fonts getting registered?

*爱你&永不变心* 提交于 2019-12-11 03:27:18
问题 I have a program using iTextSharp that includes the code FontFactory.RegisterDirectories(); foreach (string fontname in FontFactory.RegisteredFonts) { Log.Info("**** Found registered font: " + fontname); } When I run it (using Mono on a CentOS box), the log shows only the core PostScript fonts: zapfdingbats times-roman times-italic helvetica-boldoblique courier-boldoblique helvetica-bold helvetica courier-oblique helvetica-oblique courier-bold times-bolditalic courier times-bold symbol But I

How to use iTextSharp to convert to PDF

假装没事ソ 提交于 2019-12-11 03:04:48
问题 ASP: <asp:Label ID="Label1" runat="server" Text="Folder Location: "></asp:Label> <asp:TextBox ID="tbFolder" runat="server"></asp:TextBox> <br /><br /> <asp:Label ID="Label2" runat="server" Text="Destination Folder: "></asp:Label> <asp:TextBox ID="tbDestination" runat="server"></asp:TextBox> <br /><br /> <asp:Button ID="btnExecute" runat="server" Text="Button" OnClick="btnExecute_Click" /> code-behind: public void btnExecute_Click(object sender, EventArgs e) { try { strFolder = tbFolder.Text;

Add multiple pages to pdf form with iTextSharp

北城余情 提交于 2019-12-11 02:53:29
问题 I am trying to fill out a pdf form and the form could have multiple pages of the same form, so instead of writing each one to disk I want to create one pdf document in memory with all the pages. I have seen plenty of example on adding pages from an existing pdf file with FileStream but nothing really for filling out forums and adding it to MemoryStream . basically I need to fill out the forum with PdfStamper then append that form to a "master" MemoryStream because I dont want to write it to

itext sharp merge pdfs with acrofields - fields go missing when merging

痞子三分冷 提交于 2019-12-11 02:47:17
问题 I have tried this now and its not working. form.GenerateAppearances = true; I merge my 2 documents and then save it. Then I open it again to populate all the fields. It says all the Acrofields keys are gone but when I open it in Nitro pro its there. Why can't I see them in code? Do I have to add something before I save? private static void CombineAndSavePdf1(string savePath, List<string> lstPdfFiles) { using (Stream outputPdfStream = new FileStream(savePath, FileMode.Create, FileAccess.Write,

ITextSharp Image Positioning within Cell

亡梦爱人 提交于 2019-12-11 02:36:03
问题 I'm trying to offset the position of an image within a table-cell in ITextSharp. Below is some pseudo-code outlining some of my attempts, none of which seem to affect the positioning of the image. I'd specifically like to align the middle of the image with the left border of the cell, but I can't even seem to figure out how to move the image at all. doc.Open(); var table = new PdfPTable(1); var cell = new PdfPCell(); var image = Image.GetInstance(); //etc image.SetAbsolutePosition(-10, 0); /