Access Violation error when trying to assign the Printer

Hi,

We are using Delphi XE7 with Fast-Report Enterprise 5.6.

Since upgrading to 5.6 we are encountering an Access Violation exception when trying to assign the chosen printer name to the TfrxReport.PrintOptions.Printer property.

Here's the code that I have:
            frxReport1.PrintOptions.Collate := dlgPntPrintStatements.Collate;
            frxReport1.PrintOptions.Copies := dlgPntPrintStatements.Copies;
            vPrinterName := Printer.Printers[Printer.PrinterIndex];
            {$IFDEF DEBUG}
            MessageDlg('Printer Name = '+vPrinterName, mtInformation, [mbOK], 0);
            {$ENDIF}
            frxReport1.PrintOptions.Printer := vPrinterName;
The Collate and Copies properties work without any problems. The MessageDlg will display the vPrinterName value. But, the line "frxReport1.PrintOptions.Printer := vPrinterName;" generates an Access Violation.
This is code that we had for over 10 years without any problems. And, we do have the same code running with a previous version of Fast-Report and that is not generating any errors.

Daniel Rail

Comments

  • gpigpi
    edited 8:26PM
    1. What is vPrinterName value?
    2. What is build number of previous version of Fast Report?
  • edited 8:26PM
    gpi wrote: »
    1. What is vPrinterName value?
    2. What is build number of previous version of Fast Report?

    The vPrinterName value is "Canon MF8300 Series UFRII LT". And, that value comes straight from Printer.Printers[Printer.PrinterIndex], as in the code that I supplied originally. And, this is reproducible on other computers with other printers(i.e.: HP and Epson printers)

    I even tried for fun the following:
    MessageDlg('frxReport.PrintOptions.Printer = '+frxReport1.PrintOptions.Printer, mtInformation, [mbOK], 0);
    And, an Access Violation exception is raised when executing that line.

    And, I also get an Access Violation exception on the following line:
    frxReport1.ReportOptions.Compressed := False;

    The previous version that we used that worked is 5.5.11.

    I just upgraded to 5.6.1, and the problem still persists.

    The problem only occurs when using packages. The problem doesn't occur if not using packages. I did do a recompile of the packages, just to be certain. And, I also made certain that no other version of the package can be located on the computer. And, I have to use packages, because the application uses a plugin architecture that requires to build with packages.
  • gpigpi
    edited 8:26PM
    Try to completely uninstall FR, remove all FR's files, packages and folders (see system and hidden folders too) and then install FR again
  • edited April 2017
    Found the problem.

    I forgot that version 5.5 was installed on the E: drive, and when I installed 5.6, I used the default folder on the C: drive. And, this was causing the problems, since Delphi was using the .bpl files on the E: drive and then the application was using those on the C: drive for runtime.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.