GARANTIR DESCONTO

Fórum Intraweb Fortes Report #346107

15/09/2007

0

Olá como faço para gerar um pdf em fortes. Pelo que li preciso gravar para depois abrir, mas como gravo se está em um provedor ?

Obrigado


Paulo Cortez

Paulo Cortez

Responder

Posts

16/09/2007

Sremulador

Veja o exemplo do sendmail.

var
  pdf,rtf,htm,ftr:TRLCustomSaveFilter;
  s,preview,tmpfile,tmpext:string;
  go:boolean;
  i:integer;
begin
  with TFormSendMailOptions.Create(nil) do
    try
      Pages           :=aPages;
      EditAssunto.Text:=Pages.Title;
      // procura no diretório corrente
      GetDir(0,s);
      preview:=IncludeTrailingBackslash(s)+SelfFileName;
      // se não achar procura no diretório do executável
      if not FileExists(preview) then
        preview:=IncludeTrailingBackslash(ExtractFilePath(Application.ExeName))+SelfFileName;
      // valida os filtros
      pdf:=SaveFilterByFileName(´.pdf´);
      rtf:=SaveFilterByFileName(´.rtf´);
      htm:=SaveFilterByFileName(´.htm´);
      // habilita botões
      RadioButtonEXE.Enabled:=FileExists(preview);
      RadioButtonPDF.Enabled:=(pdf<>nil);
      RadioButtonRTF.Enabled:=(rtf<>nil);
      RadioButtonHTM.Enabled:=(htm<>nil);
      // seta filtro default
      if not RadioButtonEXE.Enabled then
      begin
        if RadioButtonPDF.Enabled then
          RadioButtonPDF.Checked:=True
        else if RadioButtonRTF.Enabled then
          RadioButtonRTF.Checked:=True
        else if RadioButtonHTM.Enabled then
          RadioButtonHTM.Checked:=True
        else
          RadioButtonEXE.Checked:=False;
      end;
      //
      go:=(ShowModal=mrOk);
      if not go then
        Exit;
      // seleciona filtro
      if RadioButtonPDF.Checked then
        ftr:=pdf
      else if RadioButtonRTF.Checked then
        ftr:=rtf
      else if RadioButtonHTM.Checked then
        ftr:=htm
      else if RadioButtonEXE.Checked then
        ftr:=nil
      else
        Exit;
      if ftr=nil then
        tmpext:=´.exe´
      else
        tmpext:=ftr.DefaultExt;
      //
      tmpfile:=ExpandFileName(ChangeFileExt(EditAssunto.Text+´.´,tmpext));
      try
        // faz selfprint
        if ftr=nil then
          MakeSelfPrint(preview,tmpfile,Pages)
        else
        begin
          // filtra
          ftr.FileName:=tmpfile;
          FilterPages(Pages,ftr);
        end;
        with TSendMail.Create(nil) do
          try
            Subject:=EditAssunto.Text;
            Body   :=´´;
            s:=EditDestinatarios.Text;
            while s<>´´ do
            begin
              i:=Pos(´;´,s);
              if i=0 then
                i:=Length(s)+1;
              Recipients.Add(Copy(s,1,i-1));
              Delete(s,1,i);
            end;
            Attachments.Add(tmpfile);
            EditDialog:=CheckBoxAbrir.Checked;
            Send;
          finally
            Free;
          end;
      finally
        SysUtils.DeleteFile(tmpfile);
      end;
    finally
      Free;
    end;



Mais dúvidas...

www.produsys.com.br/forum


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar