Long text truncated when exporting to PDF

hallj05
edited February 11, 2022 in Analytics #1

Hey, we are using OS BIRT 4.7 and when we have a very long block of text that does not have any spaces or line breaks (like Very_long_text_...) that can possibly be around 1000 characters long.

When we view the report in HTML it displays one record per line and does not truncate the text and displays everything, since we can have scrollbars to move over and see all the data. But when we export the report to PDF it truncates the text once it gets to the end of the page and doesn't go to a new line. Is there a way to make it go to a new line to display all the text without adding a space in the text?

Thanks,
Jordan

Comments

  • Hi Jordan,
    I did some searching and did not see a setting to break in the middle of a string without spaces. It's actually a fairly difficult thing to search on because there are so many different wrapping/breaking topics. If I locate a setting I will post it.

    One idea for a workaround is to create a computed column in your Data Set. Add the data column containing the long text in the expression builder. Instead of just displaying the data, write JavaScript to insert a newline ("\n") into the string of data every X characters where X is the length you want each line to be. Add the computed column to your table. Set the Visibility property of the table column so that the column is hidden except for PDF. Set the original column so that it is hidden only for PDF.

    Warning No formatter is installed for the format ipb
  • Hi Jeff,
    Yeah, we tried researching around and didn't really find anything else related to our issue. I think there was one other post somewhere but it didn't have any solutions.

    We thought about doing something like what you said with adding the newline, but we are not sure that would work well in our case. Since this is pretty much a log output but the text that we are using to display is coming from the database all in one record and we don't know where the possible really long text parts could be and it's going to be very large amounts of data so we feel like it could be slow to try and parse through it to add spaces/newlines.

    Also the report is first displayed in HTML with the BIRT web viewer, so when we export it to PDF we are using the button on the viewer. When we do it this way would it know to display a column that we had only visible for PDF? I think I remember it still treating it as though it's an HTML before, but I could be wrong on this.

    We were thinking that we would have to make changes to the PDF emitter that is being used. But we were not sure if this would fix the issue. We did notice that it looked like exporting to word and then having word convert it to PDF allowed the PDF to look fine, so it does seem like PDF normally does line breaks once it reaches the right side of the page even on really long words with no spaces/newlines.

    Thanks,
    Jordan

  • jfranken
    edited August 21, 2019 #4

    Hi Jordan,

    First, when exporting to PDF from the Viewer menu, the PDF document visibility rules do get applied. So this option will work. Regarding performance, adding a computed column will have an effect. I suggest testing the report with and without the computed column to see how the performance is impacted. When testing with large amounts of data, make sure the Eclipse -Xmx setting is high enough so that the memory allocated to running the report is sufficient. Otherwise the timing could be skewed.

    Attached is an example to help get you started. The computed column inserts a newline into a word if it is longer than 10 characters.

    Warning No formatter is installed for the format ipb
  • jfranken
    edited August 22, 2019 #5

    This example is probably closer to what you need.

    Warning No formatter is installed for the format ipb