Skip to Content
0

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

Dec 05, 2017 at 11:22 PM

166

avatar image
Former Member

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?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

6 Answers

Best Answer
Don Williams
Jan 22 at 08:57 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Don Williams
Dec 05, 2017 at 11:23 PM
0

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

I am using the latest SP, SP 21

0
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?

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

We are currently on SP21

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Dec 13, 2017 at 04:17 PM
0

Any other suggestions?

Share
10 |10000 characters needed characters left characters exceeded
Don Williams
Dec 13, 2017 at 03:49 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Dec 19, 2017 at 08:54 PM
0

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.

Show 5 Share
10 |10000 characters needed characters left characters exceeded

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
Former Member

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
Former Member

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

0

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
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.

0