cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

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

0 Kudos

This resolved the issue for me! Thank you!

Answers (5)

Answers (5)

0 Kudos

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.

0 Kudos

Hi JJ,

What is the size of the text box that text is in?

What is your default printer?

What printer are you using in the report?

Is Dissociate checked on? Even if using No Printer..

Don

0 Kudos

Thanks for your response. Anything I can do to help troubleshoot this, let me know. I can send you the .RPT if you want.

What is the size of the text box that text is in?
Test TextBox1 - Width: 8955, Height: 510
Test TextBox2 - Width: 8955, Height: 555
Test TextBox3: Width: 10650, Height: 480
Test TextBox4: Width: 8160, Height: 555


What is your default printer?

My default printer is a "Dell Color Laser 3110cn PCL6"


What printer are you using in the report?
"No printer (optimize for screen display)"

Is Dissociate checked on? Even if using No Printer..

No. I tested it with this checked on and it produced the same results.

I should note that I get these same results when I preview this report in the Visual Studio 2017 designer. When I choose a specific printer for this report, it works fine, so I went through all of my printers installed until I found the one that had this issue. "Foxit PhantomPDF Printer" (Version 5.0.0.0601 www.foxitsoftware.com/products/phantomPDF)

Soooo... we found the problem, how do we fix it?

0 Kudos

Would it be useful if I installed every version of Crystal Runtime from support pack 6 to 21 until this is issue surfaces?

0 Kudos

No, each version is a newer build of the previous version.

When selecting fonts in the CR UI do not change the Style to bold, what you need to do is select a font with BOLD in the name. It's due to how the Glyphs are mapped in Windows.


Don't use No Printer, that relies on usp10.dll to do the formatting, use a real printer and check on Dissociate so it remove that design printer specific dependency.

PDF Print drivers have issues, not a valid test.

Using the Embedded Report Designer is an old legacy Designer that does not work 100%, preview and export the report by running the app and previewing and then export from the Viewer.

Report he issue to Foxit, they need to fix their driver.

0 Kudos

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.

Former Member
0 Kudos

Any other suggestions?

0 Kudos

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

Former Member
0 Kudos

We are currently on SP21

0 Kudos

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

Former Member
0 Kudos

I am using the latest SP, SP 21

Former Member
0 Kudos

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?