#1 2015-04-06 12:03:39

automacaosamos
Member
Registered: 2015-02-19
Posts: 20

Send PDF file using HTTPServer

I generated a report using FastReport and would like to send to client extjs, what steps?
I am using Delphi XE7 with mormot.

Offline

#2 2015-04-06 14:25:42

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Send PDF file using HTTPServer

Take first a look at those extjs samples:
https://github.com/synopse/mORMot/tree/ … tJS%20Grid
https://github.com/synopse/mORMot/tree/ … 0FishFacts

You have a way to return any kind of information from the server, then consume it from extjs.

Offline

#3 2015-04-06 17:33:39

automacaosamos
Member
Registered: 2015-02-19
Posts: 20

Re: Send PDF file using HTTPServer

this already implemented
My problem is how to send PDF to the client

function TMyClassDirect.relatorio(): RawJSON;
var
  ExtjsVO        : TExtjsVO;
  ListaRelatorio : TList;
  RelatorioVO    : TRelatorioVO;
  FS             : TFileStream;
begin
  ExtjsVO         := TExtjsVO.Create;
  ListaRelatorio  := TList.Create();
  RelatorioVO     := TRelatorioVO.Create;
  try
    FS := TFileStream.Create('\pdf\pedido.pdf', fmCreate);
    RelatorioVO.LISTA := FS;
    ListaRelatorio.Add(RelatorioVO);
    ExtjsVO.success := true;
    ExtjsVO.rows    := ListaRelatorio;
    ExtjsVO.total   := Registros;
  except
    ExtjsVO.success := False;
    ExtjsVO.rows    := ListaRelatorio;
    ExtjsVO.total   := 0;
  end;

  Result := ObjectToJson(ExtjsVO,[]);

  FreeAndNil(ExtjsVO);
  FreeAndNil(ListaRelatorio);
  FreeAndNil(RelatorioVO);
  FreeAndNil(FS);

end;

return:

{"result":[{"success":false,"rows":[],"total":0}]}

Offline

#4 2015-04-06 19:09:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Send PDF file using HTTPServer

Transmit the response as a BLOB, using a custom answer type for the interface method.

See http://synopse.info/files/html/Synopse% … #TITLE_405

Offline

#5 2015-04-07 12:00:54

automacaosamos
Member
Registered: 2015-02-19
Posts: 20

Re: Send PDF file using HTTPServer

sorry if I did not understand me
I just want to get a pdf server and render on the client using httpserver
researched and found not to do
I'm starting in mormot

Offline

#6 2015-04-07 13:11:04

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Send PDF file using HTTPServer

My previous link http://synopse.info/files/html/Synopse% … #TITLE_405
would show you how to transmit a pdf from the server.

Offline

#7 2015-04-07 19:25:06

automacaosamos
Member
Registered: 2015-02-19
Posts: 20

Re: Send PDF file using HTTPServer

sorry i read all the documentation
but still did not understand
my client is extjs 4
only understands json
so I can not send as Interface
if you can help with an example in direct mode?

Offline

Board footer

Powered by FluxBB