itext7

How to apply round corner border to table (single page / multipage)?

夙愿已清 提交于 2021-01-29 06:16:37
问题 I want to apply round corner border to a table. This table is dynamic. That means it can grow up to multiple pages or can accommodate in single page. If table comes in single page, then outermost corner of all four corner cells should be drawn as rounded. If table grows up to multiple pages (say 3 pages), then outermost corner of all four corner cells should be drawn as rounded for all 3 pages. Here is the approach which I am using to implement the above scenario. public void createPdf(String

In itext7, Various columns document or switched column document

风格不统一 提交于 2021-01-29 05:01:08
问题 I have to make a pdf document like this. In itext 7, I made columns document by ColumnDocumentRenderer class but i can't made like this. Whole document was separated to two columns. https://riptutorial.com/itext/example/20402/text2pdfcolumns-java--itext-7- Can someonw help me? 回答1: I solved this problem by self. i refer these pages. https://kb.itextpdf.com/home/it7kb/ebooks/itext-7-building-blocks/chapter-2-adding-content-to-a-canvas-or-a-document https://kb.itextpdf.com/home/it7kb/examples

behavior of PdfPage.flush()

只愿长相守 提交于 2021-01-29 04:27:53
问题 what exactly does PdfPage.flush(true) do? Does SmartMode (or any other setting) affect the behavior? For many cases, i want to leave the page editable for as long as possible, so never worried that the PDF document was assembled in memory until document.close() . But when generating very large files (tens of thousands of pages), memory is becoming constrained. I was naively hoping that PdfPage.flush(true) would write the content stream to disk and free up memory, but calling flush(true) only

Something strange with positioning text with custom font in Itext7

有些话、适合烂在心里 提交于 2021-01-28 09:28:27
问题 I'm working on a program that creates several pdf docs and puts different text in the same location in them. Text should be placed in a particular area and if it doesn't fit it in width it should wrap. It also has a custom font and may be differently aligned in that area. It should be Vertically aligned to Top because when the area is laid out for three lines and I has only one, it should appear on the top. Finally, I need to preserve leading on the level of font-size. It is important to be

Something strange with positioning text with custom font in Itext7

自古美人都是妖i 提交于 2021-01-28 09:23:02
问题 I'm working on a program that creates several pdf docs and puts different text in the same location in them. Text should be placed in a particular area and if it doesn't fit it in width it should wrap. It also has a custom font and may be differently aligned in that area. It should be Vertically aligned to Top because when the area is laid out for three lines and I has only one, it should appear on the top. Finally, I need to preserve leading on the level of font-size. It is important to be

iText7: How to get the real width of a Paragraph

为君一笑 提交于 2021-01-28 09:13:57
问题 I need to know the width (in point) of a Paragraph before add to the document. I searched here and found Alexey answer about Paragraph's height. So I made it with width, but it doesn't work. Always return the Rectangle's width no matter how long the Paragraph. I tried this code: private float getRealParagraphWidth(Document doc, Paragraph paragraph) { // Create renderer tree IRenderer paragraphRenderer = paragraph.createRendererSubTree(); // Do not forget setParent(). Set the dimensions of the

Merging two PdfDocument objects

风流意气都作罢 提交于 2021-01-28 09:02:21
问题 Simple question , how to merge two PdfDocument objects using itext7 .net Library ? this is how am trying but it's not working PdfDocument GlobalPdfDocument = new PdfDocument(new PdfWriter(multiContentPdf)); PdfDocument InitialPdfDoc = new PdfDocument(new PdfWriter(memStreamOfAddressAndBarcode)); InitialPdfDoc.CopyPagesTo(1, InitialPdfDoc.GetNumberOfPages(), GlobalPdfDocument); also this code throw same exception Merger.Merge(InitialPdfDoc,1,InitialPdfDoc.GetNumberOfPages()); Cannot copy

iText 7 can not set margin

我是研究僧i 提交于 2021-01-27 05:23:30
问题 I have an HTML string, i need to convert it to pdf, but pdf that i need must have specific size and margin. I did as the example show, now i have pdf with width and height that i set, BUT i can`t change or delete the margin, so pls help me. using (FileStream fs = new FileStream(somePDFFile, FileMode.OpenOrCreate, FileAccess.Write)) { iText.Kernel.Pdf.PdfWriter pdfWriter = new iText.Kernel.Pdf.PdfWriter(fs); iText.Kernel.Pdf.PdfDocument pdfDoc = new iText.Kernel.Pdf.PdfDocument(pdfWriter); var

iText 7 can not set margin

孤人 提交于 2021-01-27 05:22:18
问题 I have an HTML string, i need to convert it to pdf, but pdf that i need must have specific size and margin. I did as the example show, now i have pdf with width and height that i set, BUT i can`t change or delete the margin, so pls help me. using (FileStream fs = new FileStream(somePDFFile, FileMode.OpenOrCreate, FileAccess.Write)) { iText.Kernel.Pdf.PdfWriter pdfWriter = new iText.Kernel.Pdf.PdfWriter(fs); iText.Kernel.Pdf.PdfDocument pdfDoc = new iText.Kernel.Pdf.PdfDocument(pdfWriter); var

iText 7 - HTML to PDF write to MemoryStream instead of file

风流意气都作罢 提交于 2021-01-24 09:26:12
问题 I'm using iText 7, specifically the HtmlConverter.ConvertToDocument method, to convert HTML to PDF. The problem is, I would really rather not create a PDF file on my server, I'd rather do everything in memory and just send it to the users browser so they can download it. Could anyone show me an example of how to use this library but instead of writing to file write to a MemoryStream so I can send it directly to the browser? I've been looking for examples and all I can seem to find are those