Converting NDR File to PRN File

Category

Code Based - General

Question

I have previously saved NDR files and I want to render them to printer (PRN) files. How would I do that?

Solution

This solution applies to Rave Reports version 5.1.2 or later. The following code starts with dropping a RvSystem component on your form and naming it RvSystem1.

It is important to note that the current printer (default) will be used to generate the printer file. This means that the generated file can ONLY be sent to that printer since the contents of printer files are specific to the printer they were generated for.

Also, the copy binary command on some operating systems may have problems if you use the PRN extension.

	COPY filename.ext PRN: /B

Delphi Example:

Procedure TForm1.Button1Click(Sender: TObject);
Begin
  RvSystem1.DefaultDest := rdPrinter;
  RvSystem1.SystemFiler.FileName := 'Test.NDR';
  RvSystem1.SystemOptions := RvSystem1.SystemOptions + [soNoGenerate];
  RvSystem1.SystemSetups := RvSystem1.SystemSetups - [ssAllowSetup];
  RvSystem1.SystemFiler.StreamMode := smFile;
  RvSystem1.OutputFileName := 'test1.ptr';
  RvSystem1.Execute;
  ShowMessage('Printer File created');
End;

C++Builder Example:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  RvSystem1->DefaultDest = rdPrinter;
  RvSystem1->SystemFiler->FileName = "Test.NDR";
  RvSystem1->SystemOptions = RvSystem1->SystemOptions + [soNoGenerate];
  RvSystem1->SystemSetups = RvSystem1->SystemSetups - [ssAllowSetup];
  RvSystem1->SystemFiler->StreamMode = smFile;
  RvSystem1->OutputFileName = "test1.ptr";
  RvSystem1->Execute;
  ShowMessage("NDR Converted to Printer File");
}