GithubHelp home page GithubHelp logo

franciscovaasconcelos / fastreportprinter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from antoniojmsjr/fastreportprinter

0.0 0.0 0.0 1.03 MB

Biblioteca de impressão de relatórios utilizando Fast Report em ambientes multithreading e não GUI(Graphical User Interface) usando spooler de impressão.

License: Apache License 2.0

Pascal 100.00%

fastreportprinter's Introduction

Maintained YES Memory Leak Verified YES Release Stars Forks Issues
Compatibility Delphi Supported Versions FastReport Supported Versions

FastReportPrinter

FastReportPrinter é uma biblioteca de impressão de relatórios com Fast Report para ambientes multithreading e não GUI(Graphical User Interface).

Implementado na linguagem Delphi, utiliza o conceito de fluent interface para guiar no uso da biblioteca, desenvolvido para impressão de relatórios em ambientes não GUI(Graphical User Interface) usando spooler de impressão.

Ambientes

  • Windows Forms
  • Windows Console
  • Windows Service *
  • IIS ISAPI(Horse) *
  • IIS CGI(Horse) *

⭕ Pré-requisito

Para utilizar o FastReportPrinter é necessário a instalação do componente Fast Report.

⚙️ Instalação Automatizada

Utilizando o Boss (Dependency manager for Delphi) é possível instalar a biblioteca de forma automática.

boss install github.com/antoniojmsjr/FastReportPrinter

⚙️ Instalação Manual

Se você optar por instalar manualmente, basta adicionar as seguintes pastas ao seu projeto, em Project > Options > Delphi Compiler > Target > All Configurations > Search path

..\FastReportPrinter\Source

🧬 DataSet de Exportação

DataSets é uma interface utilizada pela biblioteca para comunicação com o banco de dados através dos componentes:

Classe Componente
TDataSet Nativo
TfrxDBDataset Fast Report

⚡️ Uso da biblioteca

Para exemplificar o uso do biblioteca foi utilizado os dados da API de localidades do IBGE para geração e impressão do relatório.

Arquivo de exemplo de impressão: LocalidadesIBGE.pdf

Os exemplos estão disponíveis na pasta do projeto:

..\FastReportPrinter\Samples

Banco de dados de exemplo

..\FastReportPrinter\Samples\DB

Relatório de exemplo

..\FastReportPrinter\Samples\Report

Exemplo

uses FRPrinter, FRPrinter.Types;
var
  lPrinted: Boolean;
begin

  //CLASSE DE IMPRESSÃO
  try
    lPrinted := TFRPrinter.New.
      DataSets.
        SetDataSet(qryEstadosBrasil, 'EstadosBrasil').
        SetDataSet(frxdbMunicipioEstado).
        SetDataSet(frxdbMunicipioRegiao).
        SetDataSet(qryEstadoRegiao, 'EstadoRegiao').
        SetDataSet(qryMunicipios, 'Municipios').
      &End.
      Print.
        SetPrinter('Microsoft Print to PDF'). //QUANDO NÃO INFORMADO UTILIZA A IMPRESSORA CONFIGURADA NO RELATÓRIO *.fr3
        SetFileReport(TUtils.PathAppFileReport). //LOCAL DO RELATÓRIO *.fr3
        Report(procedure(pfrxReport: TfrxReport) //CONFIGURAÇÃO DO COMPONENTE DE RELATÓRIO DO FAST REPORT
        var
          lfrxComponent: TfrxComponent;
          lfrxMemoView: TfrxMemoView absolute lfrxComponent;
        begin
          //CONFIGURAÇÃO DO COMPONENTE

          pfrxReport.ReportOptions.Name := 'API de localidades IBGE'; //NOME PARA IDENTIFICAÇÃO NA IMPRESSÃO DO RELATÓRIO
          pfrxReport.ReportOptions.Author := 'Antônio José Medeiros Schneider';

          //PASSAGEM DE PARÂMETRO PARA O RELATÓRIO
          lfrxComponent := pfrxReport.FindObject('mmoProcess');
          if Assigned(lfrxComponent) then
          begin
            lfrxMemoView.Memo.Clear;
            lfrxMemoView.Memo.Text := Format('Aplicativo de Exemplo: %s', ['VCL']);
          end;
        end).
        Execute; //PROCESSAMENTO DO RELATÓRIO/IMPRESSÃO
  except
    on E: Exception do
    begin
      if E is EFRPrinter then
        ShowMessage('Erro de impressão: ' + E.ToString)
      else
        ShowMessage('Erro de impressão: ' + E.Message);
      Exit;
    end;
  end;

  if lPrinted then
    ShowMessage('Impresso')
  else
    ShowMessage('Falha de impressão');

end;

Observação

  • Falta de memória pode gerar falha de impressão.
  • Impressão de documento grande pode ter demora na resposta de sucesso da impressão.
  • Windows Service Application é necessário configurar "logon" usando uma conta administrativa ou NT AUTHORITY\LocalService e ou NT AUTHORITY\NetworkService para uma impressão com sucesso.
  • IIS(ISAPI/CGI) devido a um bug quando app 32 bits e Windows 64 bits não é possível imprimir, solução, compilar app 64 bits e com permissão usando uma conta NT AUTHORITY\LocalService e ou NT AUTHORITY\NetworkService.

Exemplo compilado

Download: Demo.zip

FastReportPrinter-VCL.mp4
FastReportPrinter-IIS.mp4

Teste de desempenho para aplicações web usando JMeter:

..\FastReportPrinter\Samples\JMeter

⚠️ Licença

FastReportPrinter is free and open-source software licensed under the License

fastreportprinter's People

Contributors

antoniojmsjr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.