itextsharp

C# iTextSharp stream PDF to browser and control zoom in IE

邮差的信 提交于 2019-12-11 12:19:21
问题 I am having trouble streaming my PDF to the browser and displaying the correct size. It actually works fine in Firefox, Chrome, Safari but for some reason IE wants to set my zoom level to 662%. If I manually set it to "Actual Fit" it looks like it does in all the other browsers. IE is setting to "Fit Width" I am not sure if I am missing something and that is why IE is doing it's own thing. My code is as follows: using (MemoryStream memoryStream = new MemoryStream()) { Document oDocument = new

Add itextsharp barcode image to PdfPCell

让人想犯罪 __ 提交于 2019-12-11 11:14:55
问题 I'm trying generate barcodes from a text string and then PDF the results using iTextSharp. Right now, I have the code below: // Create a Document object var pdfToCreate = new Document(PageSize.A4, 0, 0, 0, 0); // Create a new PdfWrite object, writing the output to a MemoryStream var outputStream = new MemoryStream(); var pdfWriter = PdfWriter.GetInstance(pdfToCreate, outputStream); PdfContentByte cb = new PdfContentByte(pdfWriter); // Open the Document for writing pdfToCreate.Open();

Auto paging with Itextsharp

拜拜、爱过 提交于 2019-12-11 10:49:41
问题 I have in my project changing number of tables and in the end of all of the tables I added image. My problem is that if I added too many tables, the image just shrink and not moving to the next page. Also I have more report that I want to auto paging them, so if one table is out of rage of current page, it automatically move this table to next page. I write in C# on VS 2010 This is part of my code: private void CreateQCTable(Document mdoc, DataRow Headers, DataTable Table, String imgurl, int

Draw Lines on Image in PDF using ItextSharp

泄露秘密 提交于 2019-12-11 10:38:17
问题 I am trying to draw lines on image that needs to be loaded on pdf document, just like we draw graphics on paint event of any control, but it fails to do so. Any Suggestions ? Document pdfDoc = new Document(PageSize.A2, 10f, 10f, 10f, 0f); pdfDoc.AddHeader("Batting Report - ", txtSearchBox.Text); iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance(Properties.Resources.bgWW , System.Drawing.Imaging.ImageFormat.Jpeg); PdfWriter writer = PdfWriter.GetInstance(pdfDoc, stream); pdfDoc

Add image in an existing PDF with itextsharp

孤者浪人 提交于 2019-12-11 10:36:33
问题 SO i have a created a PDF template form with textbox which are editable fields. I am able to generate the pre-populated PDF with values from my database into the template through MVC 4.0 Application. Which works fine. Now i want to add a image from a folder into the PDF which will distinguished one form with another form. The image will depend on the user in-put. Image will go at the bottom of the PDF. I don't see any image-box or image container as a filed option. Only one i can see are text

Cannot display background color when using rowspan with itext pdf

孤街浪徒 提交于 2019-12-11 10:15:59
问题 I am trying to create a table like the one shown here: I want to use a rowspan of 2. The problem is that when I use rowspan, the background color of the top row shows fine but the 2nd row shows white. I am facing the same issue shown here: http://itext.2136553.n4.nabble.com/Rowspan-and-background-color-td4659361.html I am trying to do this in Java. Am I missing something silly here ? 回答1: Please take a look at the SimpleTable10 example. In this example, I tried to reproduce your problem by

Blank page when copy document

混江龙づ霸主 提交于 2019-12-11 10:14:40
问题 When I copy document var document = new Document(); var writer = PdfWriter.GetInstance(document, memoryStream); document.Open(); var cb = writer.DirectContent; var reader = new PdfReader(this_file_name); document.SetPageSize(reader.GetPageSizeWithRotation(1)); document.NewPage(); var page = writer.GetImportedPage(reader, 1); cb.AddTemplate(page, 1f, 0, 0, 1f, 0, 0); document.CloseDocument(); writer.Close(); When I open new document - it's empty. I try change pdf version and compression level

Display data in two columns in a single row

筅森魡賤 提交于 2019-12-11 10:07:29
问题 I have a datatable containg address of users. I converted it to PDF using iTextSharp and now my requirement is i want to display one user's name, address in one column and another user's name and address in another column. In one row there must be two columns only, how to do this using iTextSharp? 回答1: Should be just a matter of creating a PdfPTable object and configuring the widths such that each row has 2 columns. http://www.mikesdotnetting.com/Article/86/iTextSharp-Introducing-Tables A

iTextSharp or XSL-FO to create a PDF dynamically with fillable forms?

99封情书 提交于 2019-12-11 10:04:29
问题 This is my first stackoverflow question. After days of research, I am still lost on how this can be done, if its even possible. I am trying to create a PDF document using either iTextSharp or XSL-FO (FO.NET is what I am using currently). Creating the documnet is no problem. I need this documnet to have fields that the user can still fill in. I am aware of the ability to create a PDF form using acrobat, then using iTextSharp to fill in those fields. This can then be saved and the user can open

How to introduce rounded cells with a background color?

感情迁移 提交于 2019-12-11 09:35:55
问题 I have seen how to set rounded borders for a table cell in this question How to create a rounded corner table using iText\iTextSharp? But is it possible to make cell that will have no borders, but colored and rounded background? 回答1: To achieve that, you need cell events. I've provided different examples in my book. See for instance calendar.pdf: The Java code to create the white cells looks like this: class CellBackground implements PdfPCellEvent { public void cellLayout(PdfPCell cell,