#1 Re: mORMot 2 » There may be Error in ProcessStaticFile of Net.server.pas [solved] » 2023-07-14 01:13:16

ab wrote:

I am not sure I understand what you meant, sorry.

Do you mean that your callback should return result = 200 so that it works as expected?
So is it solved?

Yes

#2 Re: mORMot 2 » There may be Error in ProcessStaticFile of Net.server.pas [solved] » 2023-07-13 07:09:15

I See,  OnRequest call back shoud return HTTP_SUCCESS
OnRequest(Ctxt: THttpServerRequestAbstract): cardinal;   
begin
    Result:=HTTP_FOUND;         //default return value
   Ctxt.OutContentType:=TEXT_CONTENT_TYPE;   
   if StartWith(Ctxt.Url, uppercase('/upgradefile/')) then  begin
      Ctxt.OutContentType:=STATICFILE_CONTENT_TYPE; 
      ctxt.OutContent:=StringToUtf8('xxxxxxx');
      ctxt.RespStatus:= HTTP_SUCCESS;                                                      ==>   Result:=HTTP_SUCCESS;
   end

end;

#3 mORMot 2 » There may be Error in ProcessStaticFile of Net.server.pas [solved] » 2023-07-13 06:46:19

gunix
Replies: 3

if Context.ContentFromFile(fn, CompressGz) then
        OutContent := Context.Content                             ==>   fRespStatus := HTTP_SUCCESS              outContent  no need
      else
      begin
        FormatString('Impossible to find %', [fn], fErrorMessage);
        fRespStatus := HTTP_NOTFOUND;
      end;


follow :
  Context.Content := OutContent;                             ==>      if not ((OutContent <> '') and (OutContentType = STATICFILE_CONTENT_TYPE)) then     Context.Content := OutContent;               
  Context.ContentType := OutContentType;   


then can right download file

#4 Re: PDF Engine » Draw bmp Graphic Error When picture with Transparent:=True » 2018-08-25 12:27:27

i Understand:
image is no Transparent  property in pdf,so, should draw image first,then text out words.

#5 PDF Engine » Draw bmp Graphic Error When picture with Transparent:=True » 2018-08-25 10:09:56

gunix
Replies: 2

var
  Fpdf:TPdfDocumentGDI;
  Apic:TGraphic;
begin
  Fpdf:=TPdfDocumentGDI.Create;
  Apic:=TBitmap.Create;
  try
    Fpdf.DefaultPaperSize:=psA4;
    Fpdf.ScreenLogPixels:=Screen.PixelsPerInch;
    Fpdf.AddPage;
    Apic.LoadFromFile('d:\z.bmp');
    Apic.Transparent:=True;
    TBitmap(Apic).TransparentColor:=clWhite;
    Fpdf.VCLCanvas.StretchDraw(Rect(20,20,20+Apic.Width,20+Apic.Height),Apic);
    Fpdf.SaveToFile('d:\test.pdf');
  finally
    Apic.Free;
    Fpdf.Free;
  end;
------------------------------------------------
when pictuere with Transparent property set to be True,can not draw picture in pdf.

Board footer

Powered by FluxBB