Jump to content
  • Text fields with "stretch with overflow" truncated in pdf


    jppelletier
    Assigned User lucianc
    CategoryBug report
    PriorityNormal
    ReproducibilityAlways
    ResolutionFixed
    SeverityMinor
    StatusClosed

    Hi,

     

    In some cases, text fields with "stretch with overflow" are truncated in pdf output.

     

    I've attached a simple .jrxml that shows the problem.

     

    Thanks,

    Jean-Pierre Pelletier

    e-djuster


    Attachments: pdfTruncateBug.jrxml

    User Feedback

    Recommended Comments

     

    Hi,

     

    By default, generated PDF documents have a sligthly different line break policy and this is what you are seeing in your example.

     

    The "DEPTH,QUICK" sequence is considered a single word in PDF, because there is no space.

     

    If you want to force the PDF exporter to use the same line break policy as the AWT renderer, use the FORCE_LINEBREAK_POLICY exporter parameter or set the net.sf.jasperreports.export.pdf.force.linebreak.policy configuration property to true, in a jasperreports.properties file that you put in the classpath of your application.

     

    I hope this helps.

    Teodor

     

    Link to comment
    Share on other sites

    Hi,

     

    I tried both of your suggestions, they worked

    great and I\'ll use one of them in my applications.

     

    However I believe this is a bug,

    That line breaks in a different place as

    in AWT is reasonable but it should never

    truncate text fields that have "stretch with overflow",

    Otherwise what\'s the purpose of "Stretch with overflow".

     

    Thanks for an outstanding product.

    Jean-Pierre Pelletier

     

    Link to comment
    Share on other sites

    Just to clarify:

     

    The problem is not about DEPTH and QUICK being

    or not being on the same line.

     

    Each of the 6 textfields in my .jrxml attachment end with the word "DISCONNECT",

    but that word is not displayed 5 time out of 6.

     

    Link to comment
    Share on other sites

     

    Hi,

     

    I understand that your problem is the missing "DISCONNECT" word, but as I explained, this is caused by the "DEPTH,QUICK" sequence being wrapped differently in PDF.

     

    Note that all element size calculations and rendering of the document is made at fill time and when we export to PDF or some other format we use the exact layout of the elements that was produced at fill time.

    If word wrapping occurs differently in a particular export format like PDF, we are not going to calculate again the size of text fields because that would require pushing other elements downwards if they have positionType="Float" and so forth. It would be like filling the whole report again.

     

    So you need to use the parameter or the configuration property I mentioned to make sure PDF looks exactly like the original AWT rendered document.

    For us this is not a bug, as we wanted things to work this way from the begining (not performing rendering again at export time).

     

    Thank you,

    Teodor

     

    Link to comment
    Share on other sites

    Hi,

     

    The workarounds you suggested worked for that case but introduced another problem.

     

    A text field that contains "BUILDING SUPPLIES"

    is now split as "BUILDING SUPPLIE" / "S"

    instead as "BUILDING" / "SUPPLIES" as it was before.

     

    Would you have another setting to suggest to fix this one.

     

    Thanks,

    Jean-Pierre Pelletier

     

     

    Link to comment
    Share on other sites

     

    Hi,

     

    Can you post another sample showing the new problem?

    Or can we use the existing one and only replace the text?

     

    Note that you should make sure the pdfFontName property specifies the exact same TTF font used for the fontName property to ensure measurements will be the same in AWT and PDF.

     

    I hope this helps.

    Teodor

     

    Link to comment
    Share on other sites

    Hi,

     

    I\'ve attached a revised version of the .jrxml file to show both problems.

     

    So far, I\'ve seen the new problem with fonts combinaisons (AWT,PDF) of

    (Arial, Helvetica), (Arial, Arial.ttf) and (Times New Roman, Times-Roman).

     

    (Courier New, Courier) is ok, at least with the

    string "BUILDING SUPPLIES".

     

    Thanks,

    Jean-Pierre Pelletier

     

    p.s.: Arial and Helvetica are said to be compatible

    size wise (Wikipedia on True Type) ?

    Link to comment
    Share on other sites

     

    Hi,

     

    Yes, I have tested and I was able to reproduce the problem. We have not yet gone to the full length of the investigation.

    At first sight this seems very weird as all we\'ve been doing was to reuse the line break policy from AWT by wrapping one of their classes.

     

    We\'ll look into it and let you know.

     

    Thank you,

    Teodor

     

    Link to comment
    Share on other sites

    Hi i have same kind of issue with fonts(AWT,PDF).

    1) What is the exact pdf font for SanSerif? and

    2) for AWT font: Courier New i have used PDF font: Courier

     

    Issue: for 1st scenario i have used Helvitica and other types as PDF ,but i am getting extra space after the text

    For the 2nd scenario text is displaying properly but some text is truncating at the end.

     

    Please anyone can suggest me Which one is exact PDF match for Sanserif.

    NOTE: this behavior is happening only in Linux. but in windows its working as expected in both the scenarios.

     

     

    Thanks,

    charan

    Link to comment
    Share on other sites



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...