iText vs 4 layers values on top of each other - itext

I am generating the creation of a PDF using values from an XML file. The file is being created properly. The problem I'm having is a bunch of values are being put into the same field. I have commented out all the PDFStamper SetValue statements and brought them back one by one no matter how many lines are execute values are being duplicated in the last row.
I wanted to add an image to show what it looks like, but I keep getting errors about the "Body is missing".... Isn't this the body?

Related

Can access display multiline captions in Access 365 form datasheet view?

I have read about using VBA to concatenate terms together using VbCrLf; I personally used Ctrl-Enter to create a second line in the caption field in the properties box.
But, after I do my ctrl-enter, it then only shows the first line of my multi-line caption in the datasheet view of my form.
becomes this...
This form is meant to recreate the functionality our owner is looking for from a current excel spreadsheet (the ability to sort on various columns), so I can't just use a report.
Please tell me I'm missing something obvious such as a caption height property value or something. The multiline caption will be very useful to help maintain appropriate column widths for the data.
Whilst you can display multiple lines of content within the datasheet view for a table by increasing the row height of each record, e.g.:
A more appropriate solution might be to use a text box on a form to display the data, where the height of the text box can be predefined in the design of the form, and scroll bars can be displayed:
There is no solution to adjusting column headers in the specific "datasheet" form that I was trying to use. It's a nice quick way that works for 95% of your uses. But, if you need more control (like me and others on the internet) the only solution is to create the form as a "Tabular" form in the form wizard. There are other descriptions of this type of form in Access (just to be confusing).
This is also described as a continuous form likely because that's the form property value toggle when you dive into the details.
It's more work but you have full control over the size, format, etc. of your column headers when creating/designing a tabular form.

#officewriter - Worksheet.PopulatedCells.AutoFitHeight(); not working

#officewriter - Worksheet.PopulatedCells.AutoFitHeight(); not working.
Recently i have updated excel version from xls to xlsx, but now the above function is not working, giving below error.
Error : No cells have been populated in the Worksheet
Populated cells will look for cells with values in them and return an
area that includes all the cells. If populated cells have no values
then it will thrown an exception, however if that is the case there is
nothing to autoFit.
One way to work around this would be to define the area to autofit
(say the whole worksheet) and then call autofit. Then you don't have
to rely on populated cells to determine the area.

iTextSharp: change the order of objects in existing PDF

I'm dealing with a corporate report generating system that generates documents with stamps and signatures.
The sad thing is that the system is not able to place images below existing text and tables, so the jpg-stamps overlapping text look really odd and unrealistic. The system does not support images with transparency channel either.
I'm trying to fix things by first printing reports to PDF and then manipulating images sending all them to back (below text and other vector content) using iTextSharp. Finally the results are sent to a hardware printer.
All the images are stored in resources (XObjects).
The problem is that I have no idea how to manipulate PDF-objects z-order (creation order) with iTextSharp.
The current version (a c# COM-object/assembly) works as follows:
Build the list of references to existing images (reference, image bytes, image CTM) in a page loop with parser.ProcessContent()
Execute KillIndirect() on any reference found
Replace them with writer.AddDirectImageSimple() and blank image (with transparent mask)
Insert previously stored image bytes as images (taking CTM into account) with stamper, in GetUnderContent mode.
I wonder if is there a more simple solution without blank images, excess references etc.

iTextSharp - Reading PDF with 2 columns

I'm having trouble reading a PDF with header and footer but with 2 columns in your body.
I already have the column widths and height of the header but I need the code to read the pages with columns.
Can anyone provide me a piece of code that reads PDF with columns?
thank you
It's very hard to achieve what you want if you don't know the position of the columns, but I assume that you have its coordinates because you say "I already have the column widths and height". In that case, your question isn't that different from this other question posted on StackOverflow: iTextSharp read from specific position
Suppose that rect is a Rectangle corresponding with the position of a column, then you need this code:
RenderFilter[] filter = {new RegionTextRenderFilter(rect)};
ITextExtractionStrategy strategy = new FilteredTextRenderListener(
new LocationTextExtractionStrategy(), filter);
String single_column = PdfTextExtractor.GetTextFromPage(reader, i, strategy));
Now you have the text in a single column. You need to repeat this for every column on your page.
Extra comment: While in most cases using the RegionTextRenderFilter will work just fine, a few cases (in which columns are created by simply inserting additional space characters in the lines) might require to split the text chunks to process in advance. This can be done e.g. by using the TextRenderInfoSplitter from this answer and wrapping the FilteredTextRenderListener in it. (This comment was provided by mkl.)

birt report tables not displaying in PDF

I've created a BIRT report in Eclipse (Juno) using BIRT v 4.2. The report has four tables, all tables are contained within grids. When I preview the report all the data displays properly, but if I select run as .pdf only a 2-3 rows of each table are displaying. I can export the report as html, xls and view it in web viewer without an issue. Has anyone else experienced this? (I've validated the sizing of the grid and tables).
I had the same issue and to overcome the problem I simply increased the size of the grid to fit the page manually.
If your rows are going to another page you need to script your way around that issue and you can find the solution here:
data cut when exporting as PDF
Update to cover broken link:
Quoting Michael Willians:
The PDF won't adjust like the GUI because of the fixed size constraint. To get a long, unbroken string to break, you'll have to add break characters of your own, either in a computed column or using a dynamic text box to write the script to break the long text up. Once you've broken the long text up, it should wrap to multiple lines within your PDF.
As an example, you could do something like this in a computed column, replacing "data1" with your column's name:
temp = "";
i=0;
while (i<row["data1"].length){
if (row["data1"].length - 10 < i){
temp = temp + row["data1"].substring(i,row["data1"].length);
}
else{
temp = temp + row["data1"].substring(i,i+10) + "\n";
}
i += 10;
}
temp;
To apply changes in the entire report, you could do a script in your beforeFactory method, stepping through your data elements, changing their expression. The easiest way would be to name your data elements, element1, element2, element2, etc., in the property editor. Then, you can easily access them by name, in your script.
Here's were you can edit the beforeFactory method, or any other:
You may also maintain a separate script with all your changes, as you can see on the resources directory:
Remember to add it as a Javascript resource: