SAP Knowledge Base Article - Public

1835763 - Text truncates when exporting a report to PDF format from Crystal Reports

Symptom

  • Text truncated when a report is exported to PDF format.
  • PDF document generated by Crystal Reports truncates some text.
  • Export to PDF truncates some text when the registry: ForceLargerFonts key, is set to: True.
  • When exporting a report to PDF format from Crystal Reports, the text is wrapped to the next line incorrectly, or some text is truncated.

Environment

  • SAP Crystal Reports 2011
  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016
  • SAP Crystal Reports 2020

Reproducing the Issue

  1. In Crystal Reports, create a report based on any data source.
  2. Add database fields and text to the report.
  3. Export the report to PDF format.
  4. When viewing the exported document in a PDF Reader, notice some of the text is truncated.

Cause

  • Text truncation occurs due to the difference in how the Font character width is calculated between PDF, the Microsoft Windows text rendering driver (USP10.dll), and the printer. 
         
  • This small difference of width between characters cause the text to take more space to display, than the size defined for the object on the report, and therefore cause, on occasion, text to be truncated on the right.

Resolution

  • To avoid text truncation when exporting a report to PDF format, perform one of the following:
    • Change the printer used for the report; 
    • Set the report to use no printer; 
    • Use a different font;
    • Insert the field in a Text Object, and use "Right Indentation";
    • Use the registry key: UsePrecisePositioningForText, and TruncationAdjustment
        
  • Notes:
    • If one option does not help in avoiding text truncation when exporting to PDF, try the next one.
    • The best option is to insert the field in a Text Object, and use Right Indentation.   
         
                              
  • Change the printer used for the report
    One of the most important factor in text rendering when exporting a report to PDF format, it's the printer used for the report, therefore changing the printer will change how the PDF document is generated.
     
    1. In Crystal Reports, open the report.
    2. Under the menu "File", select "Page Setup"
    3. Change the printer used for the report.
    4. Click "OK" 
           
          
  • Set the report to use no printer
    When no printer is selected for a report, it uses the screen display to help generating the PDF document.
          
    1. In Crystal Reports, open the report.
    2. Under the menu "File", select "Page Setup"
    3. Check the option "No Printer (optimize for screen display)"
    4. Click "OK" 
        
            
  • Use a different font     
    Each font have different character width, and spacing, and therefore changing the font will change how the text is exported.
          
    1. In Crystal Reports, open the report.
    2. Locate the Database Field, Formula Field, or Text Object displaying truncated text in the PDF document.
    3. Change the Font used.
          
        
  • Insert the field in a Text Object, and use "Right Indentation"
    This is the best option because by reserving space between the end of the text, and the size allocated for the object on the report design, it will give enough space for the text if the character width in PDF is different, which by consequent will eliminate the truncation. The only drawback is it involve changing the report design slightly.      
          
    • For steps with screenshots on how to add a field in a Text Object, and use "Right Indention", see the SAP Knowledge Base Article: 1334650
           
                 
  • Use the registry key: UsePrecisePositioningForText, and TruncationAdjustment
    In older versions of Crystal Reports, when exporting a report to PDF format, the font size was reduced by default by a small factor in order to avoid truncating text. To retain the font size, it was possible to set the registry key: "ForceLargerFonts", to True. But if the font size was retained, there was a potential to occasionally have text truncated on the right margin. This truncation occurs due to a mismatch of how character width of Fonts are calculated between PDF and Microsoft Windows, and the printer. 
            
    The PDF Export functionnality was enhanced in Crystal Reports 2011 to incorporate a new algorithm that positions characters precisely to prevent truncation from occurring, while maintaining the same font size. If truncation still occur, then an algorithm can be activated and controlled by two new registry keys: UsePrecisePositioningForText, and TruncationAdjustment.  
                   
    WARNING: The following resolution involves editing the registry. Using the Microsoft Registry Editor incorrectly can cause serious problems. Use the Registry Editor at your own risk. For further information see the SAP Knowledge Base Article 1323322         
         
             
    1. Open the Microsoft Registry Editor ( Regedit )
           
    2. In the Microsoft Registry Editor, navigate to the following path:
           
      • For 64 bit version of MS Windows:    
        HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\SAP BusinessObjects\Suite XI 4.0\Crystal Reports\Export\PDF
         
      • For 32 bit version of MS Windows:       
        HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Suite XI 4.0\Crystal Reports\Export\PDF
          
        Note: If the end of the path does not exist, add the directory.
          
    3. Add the DWORD key: UsePrecisePositioningForText
       
    4. Set the value to: 1
                 
    5. Add the DWORD key: TruncationAdjustment
        
    6. Set the value to: 2
                 
    7. Restart Crystal Reports, and when exporting to PDF format, the text will no longer be truncated.
                
         
  • Important Notes:  
    • The key: UsePrecisePositioningForText, turns on the new functionality when it is set to 1.
    • When this functionality is activated, the registry key: "ForceLargerFonts"  is ignored.
    • The "TruncationAdjustment" key controls a width calculation rounding function in the new algorithm and accepts values between 0 and 10 inclusively.
    • The default value of 2 has been tested to sufficiently eliminate most truncation issues.
    • If truncation is still observed, this value can be increased for added granularity.

See Also

  • 1334650 - Text truncated on the right, when exporting a report to PDF format from Crystal Reports

Keywords

Text truncates, text chops, exporting to PDF issue, crop , cropped, truncated, missing, character missing, CR, overflow, overlap, cut , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Problem

Product

SAP Crystal Reports 2011 ; SAP Crystal Reports 2013 ; SAP Crystal Reports 2016 ; SAP Crystal Reports 2020