Executing a Crystal Report (on Windows) using Perl (on Linux)

Posted on 2007-10-06
Last Modified: 2008-01-09
Has anyone tried running a Perl script on Linux/Unix to execute a Crystal Report 9 (.rpt) on another Windows server?

If so, could you please specify what Perl modules are needed and provide sample code.

Thanks in advance,
Question by:COS_IT_AU
    LVL 14

    Expert Comment

    Can you go into a bit more detail about the relationship / connection between the two servers? Are you going to execute the report via HTTP? Or are you looking for a more direct socket connection? Has the report already been generated and then needs to just be triggered? Or do you need to actually create the report on the Perl box and transmit it to the Windows machine?

    Would it not be just simpler to install ActivePerl on the Windows Box and port your Perl script to Windows, cutting out the Linux server altogether?


    Author Comment

    Hi Tom,

    Currently I have a Crystal report template (samplereport.rpt) created in Crystal Report 9 and use a win 32 Delphi program to connect to a database, grab some parameters and using a Delphi Crystal package to pass it to the Crystal Report template (samplereport.rpt) to generate a nicely formatted PDF.

    I would like to transfer this process to Linux using Perl as all our nights jobs are done in Perl on a Linux box and to reduce administration of multiple OS boxes. Basically I want to replicate what Delphi does with Perl, where it will grab some parameters from a database, then use some Perl package to pass the paramters to the Crystal report template  (samplereport.rpt) and execute it to create a PDF.

    My question is:
    1) Is there a Perl package available to interact with Crystal Reports .rpt files under Linux?
    2) If not, what other methods are available using Perl on a Linux server to execute .rpt located on a Windows server? You mentioned HTTP (would this mean the Crystal Report Server version is required?) and direct socket connection.

    LVL 1

    Accepted Solution

    Hi Tom,

    I've got Crystal Reports 9 myself and an Unix box, but I haven't done this. It would be possible following these steps:

    1) Set up the CR engine under IIS on the Windows machine. I'm currently doing this to expose the reports over out intranet. The reports are generated on-the run. Query parameters can be provided either by POST or GET. The IIS machine appears as the database client.
    2) There's probably license limitations to this. I have the Enterprise CR. I'm not sure if other flavors allow the IIS setup. Anyway, you will always need a host for the CR engine.
    3) On the http client-side (Unix in this case), CR can act either as an ActiveX component, a Java applet or plain HTML. You should use plain HTML, setup a LWP request and then use htmldoc to get the desired pdf. Using plain HTML under CR9 loses a great deal of formatting, though.

    In that scenario, the perl script should be like:

    use LWP::SImple;

    my $querystring=GrabSomeParametersFromDatabase();
    system("htmldoc -f report_for_today.pdf -t pdf report_for_today.html");

    You should have guessed that the showreport.asp is the tricky part. CR9 provides a no-brainer sample for this.


    Author Comment

    Hi Estrelow,

    looks like there is no avoiding for Perl to use a secondary script either ASP or VBSCRIPT on the Windows machine to interact with Crystal instead of Perl directly interacting with Crystal.

    I found this Perl snippet through Google which is very similar to your example:
    system("WSCRIPT","crystal.vbs","$crystal_rpt_name","$username","$ibookref","$out putfile");


    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    hasOne  challenge 59 66
    ClickOnce Install - Shortcut Question 3 44
    countHi challenge 25 63
    parentbit challenge 3 38
    A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (,  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
    In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now