Link to home
Start Free TrialLog in
Avatar of RichG
RichG

asked on

Visual C++ export function fails to create PDF

Custom report generator written in Visual C++ 6.0 using Crystal Reports 8.5 Developer edition. Code worked fantastic for several months ... until today. Just stopped working. Now, when the generator attempts to export the report, it creates a 0 byte PDF file, and then throws an unamed exception. At first I thought it might of been because %TEMP% was FULL of binary files which I'm 99% sure came from the report generation processes. However, I still see the same problem after deleting the temp files and rebooting. Note that the EXACT SAME code works fine when I move it to a different machine. I've unistalled/re-installed Crystal, installed the service pack, rebooted serveral times ...it's very puzzling.

Code snippet:

try
{
    ... lots of code here ...

    IExportOptionsPtr options = m_Report->ExportOptions;

    options->FormatType       = crEFTPortableDocFormat;
    options->DestinationType = crEDTDiskFile;
    options->DiskFileName     = SavePath;

    if(m_Report->Export(false) != S_OK)
    {
        cleanUp  (db, debugFile, "Failed to generate report", cr_id);
        EndDialog(IDOK);
        return;
    }

    ... bit more code here

catch (CDBException *cdbe)
{      
// process error
}
catch (CMemoryException  *cme)
{      
// process error;
}
catch (CException *e)
{
// process error
}
catch (...)
{
// This is the the block the code hits at runtime
}

Any thoughts?
Avatar of RichG
RichG

ASKER

Further data:

I bypassed this custom code and simply tried to export a report to PDF right in the Crystal report designer. The export fails. I can however export the same report to Excel.

Is there a hard limit to how many reports a single installation of Crystal can export to PDF?
Avatar of Mike McCracken
Sounds like the PDF export dll is corrupt.

When you move to another machine are you moving the code or an executable?

mlmcc
Avatar of RichG

ASKER

If it was a corrupted dll, wouldn't the uninstall/reinstall I described above fixed the issue?

I'm really starting to think it's a hard coded limit with the number of PDF's you can generate (Adobe licensing?) 'cause I uninstalled/reinstalled (like I did before ), but this time I went into the registry and manually deleted all registry keys associated with Seagate software ... and now it works.

Oh, and to answer your question, I didn't even really move the program (it's an exe we compile) to another machine. All I did is mount the machine via a windows network link. Once the machine was mounted, I used explorer to navigate to the machine (over the network ) the custom program runs on and clicked the icon for the executable. It works if invoked this way. If instead, I go directly to the console for the report machine, and click on the executable, the export fails as described above.

Anyway, I'm back up and running. Will have to figure out a new solution; however, as doing what I just described is pretty ugly.
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
Avatar of RichG

ASKER

Not sure what you mean by client machine. There is only one machine, a server that runs our custome exectable. On that same machine, we have Crystal 8.5 (Developer version) installed; plus Crystal service pack 2.

OS is Windows 2000 server fully updated with most recent service packs.

Files in what directory? I have a single directory on the server machine called reports. That directory contains all our rpt files, the custom executable, and a log file.

Like I said above, whatever it was (corrupt DLL, or some sort of limit to the number of PDF's that can be generated, or something else entirely) I'm all set now. Removing the registry keys appeared to work.

Thanks for the input.
I don't know of a limit but I'll keep my eyes open.  I can't think of a reason for having a limit.

mlmcc