Link to home
Start Free TrialLog in
Avatar of Joe Brown
Joe Brown

asked on

Problem with exporting crystal report to PDF through ASP.NET

I'm having an issue with exporting some Crystal Reports XI to PDF through an ASP.NET web application.  The export works fine in my development environment, but when I publish the same code to production (Microsoft Windows Server 2012 Standard) the export starts to work strangely.  The crystal reports I have connect to an MSSQL Server 2008 (SP3) through an ODBC connection.  I've tried doing several things:

1)  Setup an ODBC connection using 64 bit driver.  In this case some reports works, while others give me a "System can not find the path specified error".
2)  Setup an ODBC connection using a 32 bit driver.  In this case all reports behave the same, giving me a message that "The report you requested requires further information." and asking for server, database, username and password.  If I provide the correct info here the reports still don't go forward.

If I try to run a crystal report through Crystal Reports (without going through ASP.NET) then the reports work fine with a 32 bit ODBC connection in place.  

I'm kind of new to CR and not sure how to debug or get further information on the problem I am experiencing.  Searching Google for these errors didn't produce any results.  Any help would be greatly appreciated!
Avatar of Mike McCracken
Mike McCracken

Crystal XI is strictly 32-bit so you need to have the 32-bit ODBC available.

Did you name the ODBC connection the same as the development machine?
Does it use the same database driver?

mlmcc
Avatar of Joe Brown

ASKER

Yes, I named the connection exactly the same, I wasn't sure if it is case sensitive, so I tried both ways.

As far as the database driver is concerned, I tried SQL Server driver and SQL Server Native Client 11.0 driver.  I tried both 32 bit and 64 bit versions of each.  I tried them all under System DSN (not User).

The weird thing is that for some reports 64 bit version seems to work, while for others the web page displays this stack trace:

The system cannot find the path specified.
<!-- Inner Stack Trace: Stack Trace: at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.ReportSource.LocalReportSourceBase.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.Web.ReportAgent.Export(ExportRequestContext reqContext) at CrystalDecisions.Reporting.WebControls.ReportExporter.onExportInternal() at CrystalDecisions.Reporting.WebControls.ReportExporter.OnPreRender(EventArgs e)
Joe, this may have nothing to do with data access.  You can confirm by exporting to text instead of PDF.

If only PDF shows this problem, it is probably a font issue. Make sure the account under which the process is running has access to the fonts used in the report and that the fonts have embedding permissions.
Can you display a report?

What version of Adobe is on the machine?
Is Adobe Reader installed on the server?

mlmcc
mlmcc - I'm not sure which version of Adobe Reader is installed, but I assume it's fine since some reports do export to PDF and display just fine.  Does Adobe Reader need to be installed on the server in order to generate reports?  

IdoMillet - You may be onto something.  Especially given the fact that I am able to run the reports through SAP Crystal Reports 2011 and get the preview to display on the server (with 32 bit ODBC drivers only).  However, changing the export format type to text still produces the same stack trace when ran through the web app (with 64 bit ODBC drivers) or gives the "The report you requested requires further information." message (with 32 bit ODBC drivers).  

Does anyone know how to get more information out of the error messages displayed?  Or how to dig in further beyond the "The report you requested requires further information." message, find the underlying cause...
I asked about the Adobe version because there used to be a minimum version required and I believe a "max" version in that Crystal XI couldn't use a version of Adobe Reader that was from several after it was released.

I do believe you need the reader installed on the server.
You can have several versions available.

mlmcc
mlmcc - We do have adobe acrobat XI standard installed on the server.

Do you know of a any way to debug these error messages and login screens?  How do I drill down to get more information about the root cause of the issue?

Thanks for all your help and suggestions.
Did you develop the ASP.Net application?
It may be possible through the SDK to get a better error message.  Not being an ASP or .Net programmer, I don't know how to do that or if it is even possible.

Do the reports all display and this is just an export issue?

mlmcc
mlmcc - yes, we did develop the ASP.net application.

All reports display when ran through CR XI on the server.  However, when exported through ASP.net application the above mentioned problems start happening.
Can the ASP.Net application display a report or does it just export them?

IS the code the same for exporting a report you just provide the report name?
ASP.Net application exports the report, there are different export types that can be used (PDF, text, Excel, some others I believe).

There are a lot of things that need to be set in order to export a CR into PDF through ASP.net.  Login information, etc.  Our setup seemed to work fine on our previous server.  It also works fine on the new server for some reports and not others.
Is there separate code for each report or is it the same code?

mlmcc
The code is the same for each report.  

There is new piece of information.  We were able to narrow down the problem somewhat more.  The reports that are producing an error have QR codes printed on them.  The QR codes are generated using IDAutomation's software:  http://www.idautomation.com/barcode-fonts/2d/qr-code/

If we remove the QR code from the report it exports as PDF just fine through ASP.Net.  Also, the report is generated with or without QR code directly through CR XI.  So it would seem that the problem is with QR codes generation when running through the ASP.Net only.
DO the QR codes generate to PDF from CR XI?

mlmcc
Yes, QR codes generate to PDF from CR XI.

Actually, we finally fixed this issue.  The problem was that the QR code generation software was not up to date, wasn't able to handle 64 bit.  Once we upgraded that software everything seemed to work fine.

We now have a different problem.  The font sizes that are generated on the PDF seem to be smaller and in general a bit off from other documents.  We installed the latest support pack (17) from here: http://scn.sap.com/docs/DOC-7824 but that didn't seem to help.  Any idea how to resolve this issue?
That is a known issue with Crystal.  There is a registry fix for the issue.
You have to create registry entries for ForceLargerFonts
The change is different based on Crystal version.

See this link for the details.
http://www.barcode-soft.com/crystal-reports-export-pdf-font-size.aspx

mlmcc
The wrong font and spacing issue only happens when we export the report through ASP.Net exporter.  Crystal Reports 2016 produces the correct fonts and spacing when the report is ran.  Is there anything I need to do to upgrade ASP.Net's handling of the export process in order to fix this issue?  Outside of installing the latest support pack (which we did).

Thanks for your help.
When you built the ASP application what assemblies did you include?
Were they for CR XI or for CR for .Net?

Have you loaded the reports in CR 2016 and saved them then used those reports in the application?

mlmcc
mlmcc,

I'm not sure what you mean by which assemblies we include.  I believe the way to do this is to install their support pack on the server for Visual Studio and then include the version of the assembly in web.config.  I think we have the latest referenced - Version=13.0.2000.0.

We will try to do what you suggest with saving the report in CR 2016 and see what happens.
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yeah, we just installed the latest service pack from here:  http://scn.sap.com/docs/DOC-7824  and referenced it in web.config, I believe that's all we need to do, but I might be wrong.

I tried saving the crystal report in CR 2016, that didn't seem to solve the issue.

Thanks for all your help by the way, we really appreciate it.