Skip to Content
avatar image
Former Member

Right margin being truncated when exporting to PDF through .Net Framework

We have some crystal reports that I am access through a c# .Net application and saving as a PDF, using the "Cystal Reports for .Net Framework 4.0". The application is installed on a Windows 2008 R2 64-bit server. We are having some issues with the font. I have already set the following registry entries:

ForceLargerFonts : 1

UsePrecisePositioningForText : 1

TruncationAdjustment : 2

However we are still getting issues with the right margin being truncated. I am out of ideas. Are there any other suggestions?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Jan 22 at 08:57 PM

    When using No Printer the formatting engine uses GDIPlus and USP10 and some of your default printer properties.

    Always recommended to use a real printer and Dissociate also.

    Don

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 05, 2017 at 11:23 PM

    What SP are you using?

    We've fixed this issue in various updates. to get the latest go here:

    https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

    Don

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      It seems to work fine with just the ForceLargerFonts on a 32-bit machine, but when I put it onto a 64-bit server and run it there (where it currently runs as a Windows Service) it seems to have these issues -- with the additional registry entries not affecting anything. No other ideas?

  • avatar image
    Former Member
    Dec 13, 2017 at 03:47 PM

    We are currently on SP21

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 13, 2017 at 04:17 PM

    Any other suggestions?

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 13, 2017 at 03:49 PM

    Hi Scott,

    Use ProcessMonitor and make sure it's reading those registry keys in 64 bit mode. It may be a permission issue with the account the service is running under.

    Don

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 19, 2017 at 08:54 PM

    I believe I am experiencing the same issue. Rather than asking a new question, I'll comment here first.

    Using certain heavy fonts or a font with bold attributes, the text is cut off on the right side of a text box. If the text is centered, it cuts off text on both sides.

    I reproduced this with various sized text boxes and the following fonts: Verdana Bold size 10, Arial Black size 10, Century Schoolbook size 10. I am using the registry settings (KBA 2165260) UsePrecisePositioningForText=1 and TruncationAdjustment=2-10 to avoid rendering smaller fonts. I verified with process monitor that the values were being read from the proper registry locations.

    The text I am using in the textbox is the following:

    (POLICY RECAP IS FOR AGENCY INFORMATION ONLY, IS NOT PART OF THE POLICY, AND SHOULD NOT BE DELIVERED TO THE POLICYHOLDER!)

    This appears fine when I preview the report (in Visual Studio), but is also cut off I export to PDF. I can send you the sample RPT and PDF output if you wish. Here is my environment

    Windows 10
    Visual Studio 2017 (15.4.1)
    Crystal Runtime 13 sp 21, 32bit and 64bit.

    I built my project in 32bit mode and tested it. I also built it in 64bit mode and tested it. I also tested this on a Windows 7 machine with only 32bit runtime installed. All tests reproduced the same issue.

    I just upgraded from Crystal Runtime sp6 to sp21. SP6 did not have this issue. I also remove all of the registry settings I manually added, but the font is smaller and that is not desired. I tested with ForceLargerFonts only and the font is cut off as described.

    If I had to guess, I would say that it was not honoring the UsePrecisePositioningForText like it used, no matter what value I set TruncationAdjustment.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thank you very much for your responses. I was able to resolve this by this flag.

      crDoc.PrintOptions.NoPrinter = false;

      where crDoc is a CrystalDecisions.CrystalReports.Engine.ReportDocument object.

      I am not sure if I'll need to define a printer or not, I'll have to do some more tests. I consider this issue resolved.

      Thanks you Don! You guys do a great job with this product.