LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-REPORT to Acrobat .PDF File Generation

Review the link provided by Sheetal, shown above.  It explains how to build the .PDF printer. This printer contains a configurator utility (config.exe).  Before using NIReport_Print( ) where you specify the name of the printer in quotes, you can launch the configurator utility within your application and set the intended path and name of the .PDF file as arguments.

I agree that it would be greatly beneficial for all for NI to expand CVI's reporting capability.
0 Kudos
Message 11 of 19
(2,335 Views)
This Bullzip solution is a better workaround than what is proposed by NI. The config.exe file is located in the following folder after installing the Bullzip and Ghostscript programs: C:\Program Files\Bullzip\PDF Printer\API\EXE\config.exe. If you double click on the executable without any arguments, it will open up an information message popup which will give you an example of how to use it to send an output command. One can also open the Bullzip printer properties window from the Start/All Programs/Bullzip/PDF Printer/PDF Printer Options/ which will open up a printer options window that will allow you to configure the printer. Then you can call config.exe to point to the path of your document that you want to save from the NI Reports print function in your program. Not a bad alternative workaround!
0 Kudos
Message 12 of 19
(2,317 Views)

Hi Steve,

Sorry to be asking you this question about BullZip, but since you got it to work, I have the following question that I sent to Bullzip, i have included the Labwindows code snipet that errors due to the config.exe:

"I am trying to programmatically save a file using the config.exe program from my CVI/Labwindows program. My useage is as follows: <path>\config.exe Output "<path><filename>" for which I am following the example from the config.exe usage popup window. I opened up a DOS command window and tried the above command directly, but the config usage popup window keeps opening. I am not sure what I am doing wrong since the pathname for the document is correct and I am following the example from the BullZip printer config popup window. Any ideas as to what the problem may be?"
 
The Labwindows code fails when trying to launch the config executable, similar to when i try to launch it from the DOS command window!
code snipet:
 sprintf (docPath,"C:\\NeoGuideTest\\config Output %s",gDocFilename);
 if ((LaunchExecutableEx(docPath, LE_SHOWNORMAL, &bullzipHandle)) == 0)
  while (!ExecutableHasTerminated (bullzipHandle));
   ProcessSystemEvents();
 RetireExecutableHandle (bullzipHandle);
    /* Now save the report using the Bullzip PDF create program */
    if (NIReport_Print (reportHandle, "Bullzip PDF Printer", 1))
        error++;
0 Kudos
Message 13 of 19
(2,296 Views)
I have a quick snippet, where the the printer is installed at the path C:\Program Files\Bullzip\PDF Printer:

int execHandle = 0;
int iStatus;

//pathstring contains the full path name of your target .PDF report file within double quotes
sprintf(string,"\"C:\\Program Files\\Bullzip\\PDF Printer\\config.exe\" /S OUTPUT pathstring");
LaunchExecutableEx(string,LE_HIDE,&execHandle);
while (ExecutableHasTerminated(execHandle) == 0);
RetireExecutableHandle(execHandle);

iStatus = NIReport_Print (reportHandle,"BullZip PDF Printer", 1);
//The purpose of the message popup below is to allow time for the writing process to take place
if (iStatus == 0)
{
    MessagePopup("Report","Report sent Successfully");
}
else
{
    MessagePopup("Report","Error printing report");
}

Regards,
SteveMac
0 Kudos
Message 14 of 19
(2,278 Views)

I am definitely perplexed with this issue as i would sure like to use this utility. No matter how I format the string, I always gets the following error when trying to launch the executable:

"NON-FATAL RUN-TIME ERROR:   "SCUMain.c", line 3948, col 10, thread id 0x00000DC4:   Library function error (return value == -19 [0xffffffed])."

The following code snippet is in the following form similar to what Steve sent me:

 sprintf (docPath,"C:\\NeoGuideTest\\config /S Output \"C:\\NeoGuideTest\\Test_Reports\\testReport.pdf\"");
 if ((LaunchExecutableEx(docPath, LE_SHOWNORMAL, &bullzipHandle)) == 0)

As you can see, I have the test report in double quotes, but it still gives me the above error. I did find that it likes to have the '/S' switch before the 'Output' command.

 

Thx,

Mike

0 Kudos
Message 15 of 19
(2,266 Views)
Instead of:
sprintf (docPath,"C:\\NeoGuideTest\\config /S Output \"C:\\NeoGuideTest\\Test_Reports\\testReport.pdf\"");
 
try this:
sprintf (docPath,"\"C:\\NeoGuideTest\\config.exe\" /S OUTPUT \"C:\\NeoGuideTest\\Test_Reports\\testReport.pdf\"");

Steve

0 Kudos
Message 16 of 19
(2,259 Views)

Thanks Steve for all of your help, I finally got it working. I also found out from Bullzip that for each change or setting that you would like to make, you need to send it separately as you did with the 'Output' command.

Thx,

Mike

0 Kudos
Message 17 of 19
(2,214 Views)

Hi,

I could not manage to avoid the BullZip popup. When I call the PrintTextFile function (BullZip is set as default printer) or print manually from Notepad, for instance, I always get the popup with title "BullZip PDF Printer - Create PDF". From gui.exe I disabled all popups and I run config.exe using cmd.exe to specify an output file using the command

CONFIG /S Output "e:\test.pdf"

I know this command is accepted because in the popup that appers file path is e:\test.pdf.

Is there another command to suppress this popup?
Thanks in advance,

S. Eren BALCI
IMESTEK
0 Kudos
Message 18 of 19
(2,194 Views)

If you follow this example, as per Steve's instructions, and DONT set the Bullzip printer to the default printer, that is if you are trying to do this programatically, then here is my code snippet that executes printing the NI test report:

 sprintf (docPath,"\"C:\<pathname>\\config.exe\" /S Output \"C:\\<pathname>\\testReport.pdf\"");
 if ((LaunchExecutableEx(docPath, LE_SHOWNORMAL, &bullzipHandle)) == 0)
    while (!ExecutableHasTerminated (bullzipHandle));
 ProcessSystemEvents();
 RetireExecutableHandle (bullzipHandle);
 /* Now save the report using the Bullzip PDF create program */
 if (NIReport_Print (reportHandle, "Bullzip PDF Printer", 1))
        error++;
   
 NIReport_Discard (reportHandle);

The key is to not set the Bullzip printer to the default printer and just enter the name of the printer as found in the BullZip printer properties, into the NIReport_Print function in quotes. Just substitute "e:\test.pdf" into the sprintf function after the OUTPUT \". If you need to set any other printer settings, such as suppressing the saveas popup window, then you will have to repeat the first five lines with the new setting. Hopefully I understood your question and answered your question.

0 Kudos
Message 19 of 19
(2,182 Views)