Support for leading in irregular columns? - itext

I am using iTextSharp 5.5.1 and am laying out a document using irregular columns. Irregular columns are always rendered in text mode.
I need to be able to set the leading for the paragraphs in my irregular column, but am not able to do so - the calls to ColumnText.SetLeading are ignored.
Dim doc As New Document
Dim writer As PdfWriter = PdfWriter.GetInstance(doc, Response.OutputStream)
doc.Open()
Dim column As New ColumnText(writer.DirectContent)
column.SetLeading(fixed, multiple)
column.SetColumns(New Single() {...}, New Single() {...})
column.AddText(New Paragraph(""))
column.AddText(Chunk.NEWLINE)
column.AddText(New Paragraph("..."))
column.AddText(Chunk.NEWLINE)
...
column.Go(False)
The generated PDF has the same leading regardless of what values I use for fixed and multiple in the call to ColumnText.SetLeading. I can adjust the spacing after each paragraph using ColumnText.ExtraParagraphSpace, but I am unable to set the leading within each paragraph.
I did find a related SO question and answer, Reducing paragraph line break height on iTextSharp, but that talks about setting the spacing after a paragraph ends. This works in irregular columns, but I'm interested in the leading, which is the space between the lines within a paragraph.

Related

Deleting the last paragraph in a table cell in MS Word

In an empty table cell with the cursor inside, I am inserting multiple paragraphs of text (each with different styles) using insertFileFromBase64.
When no newline is present at the bottom of the Base64 DOCX file, the last paragraph will not receive the style assigned to it within the Base64 DOCX file.
However, when a newline is present within the Base64 DOCX file, I cannot get rid of it. Selecting the last paragraph within the cell and performing a delete does not return an error, but the newline remains present.
I guess this is related to the special status of the "cell marker" within Word, but I cannot find a way around this problem.
Does anyone know a solution?
Found workaround myself: when you FIRST set the style of the current paragraph to the style of the very last paragraph that is contained in the Base64 DOCX file, then the problem can be avoided. (Of course, this supposes that you know upfront the style of that very last paragraph -- which is not necessarily always the case.)

Itext TextRenderInfo different behavior for different pdf

I am using
itext -> LocationTextExtractionStrategy for retrieving the text from PDF,
I have read 2 different pdf and debug them
For 1st one i have found in
public void renderText(TextRenderInfo renderInfo)
method text is rendering with word
e.g: I have a pdf with some content
ACCOUNT TYPE A/C. BALANCE (I) FIXED DEPOSITS (LINKED) BAL. (II)
then renderText method rendering text in a loop like:
ACCOUNT TYPE then A/C. BALANCE (I) and then FIXED DEPOSITS (LINKED) BAL. (II)
Now when i the debugging 2 pdf with content and it's rendering with letter e.g i have content:
Date Details Withdrawals
then renderText method rendering text in a loop:
D then a then t then e and so on
I am wondering how it renders the text(means some time iterate with word and some time with a group of words and some time iterate with just a letter )?
how it renders the text(means some time iterate with word and some time with a group of words and some time iterate with just a letter )?
The iText parsing framework forwards the atomic strings used in arguments of PDF text drawing operations.
Thus, if the PDF draws text letter by letter, you'll receive one TextRenderInfo instance per letter. If it draws text word by word, you'll receive one instance per word.

Apache fop : Unable to handle if single Word in text is larger than the containing block

I am new to fop , will be greatful if i get help from someone...,
I am not using XSLT tranformation but creating XSLFO file directly using Java code. Everything works fine but the problem comes when particular word(long text without space) is inserted into a cell of a table-column . That bigger word is overlapping the successive block.
I have an fo:block element in fo:table-cell which is in fo:table-row of a fo:table. This table has 6 columns, obviously column width is small. Now, when a Word in the block is larger than the block it is overlapping the next block. Give me some attribute value or any other solution to change my XSLFO file ,so that the bigger word breaks into the new line at end of the column.
Thanks in advance...
The things you need to look into are:
For the fo:table-cell: number-columns-spanned="3"
For setting the width of fo:table-column: column-width="proportional-column-width(1.5)"
The number-columns-spanned is used as attribute of and provides you with a means to select a bigger area where your fo:block fits.
The column-width makes it easy to define absolute width or, when using proportional-column-width, a width relative to the other columns.
I don't know of a way that lets FOP break words into multiple parts when they don't fit.

Is it possible to add a list to an irregular column?

I am using iTextSharp to programmatically generate a PDF file.
I am using an irregular column (a ColumnTextin text mode) and am having difficulty adding an unordered list to the column.
The ColumnText class's AddText method only accepts a Phrase or Chunk, so I can't add a List directly. I have tried adding a List to a Paragraph and then adding the Paragraph to the ColumnText but the result is the list items appear concatenated one after another and not as a bulleted list.
Can this be done or do I need to explore an alternative route?
ANSWER: There is no support in iText to add lists to irregular columns. However, it is possible to render lists in irregular columns with a bit of legwork. I blogged about it here: Rendering Lists in Irregular Columns Using iText / iTextSharp.
With AddText(), you're using ColumnText in text mode. If you want to use a List, you should use ColumnText in composite mode. You can switch from text mode to composite mode by replacing AddText() by AddElement().

Eclipse BIRT Report Designer paragraph style different

Let's say I have a bunch of paragraphs coming from a Word file. These paragraphs have different styles applied to them (some are bold, some have smaller or bigger font size, some are italicized, different color, different font-family and so on). Is it possible to add all of these paragraphs into the same Text element in birt and apply the styles that correspond to each paragraph or do I really have to put each paragraph separately into its own Text element and then apply the style to each Text element in birt? Obviously the second approach is more tedious, I would love to find a solution similar to the first approach.
You can set the text element content as RTF and apply Paragraph Formatting Tags .
Take a look at this document for more information.