• 0
Sign in to follow this  
Jhonas

Converter Doc para PDF

Question

Primeiro voce deve baixar o Acrobat Distiller 5.0 e instalar ( impressora PDF ) e depois deixa-la em OFF-LINE

http://www.4shared.com/file/31999630/1b5dd...ler_50.html?s=1

Os códigos abaixo são para o delphi 5 e delphi 7

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, OleServer, Word97;

type
  TForm1 = class(TForm)
    Button1: TButton;
    OpenDialog1: TOpenDialog;
    WordApplication1: TWordApplication;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

// NESSECITA TER INSTALADO UMA IMPRESSORA PDF ... EXEMPLO: ACROBAT DISTILLER
// PARA SER USADO NO DELPHI 5

procedure TForm1.Button1Click(Sender: TObject);
var
  oWord : TWordApplication;
  varFileName : OleVariant;
begin
  // CONVERTER DOC PARA PDF
  // DEIXE A IMPRESSORA EM OFF-LINE PARA SALVAR O DOCUMENTO NO HD

  oWord := TWordApplication.Create (Nil);
  Try
    if OpenDialog1.Execute then
       begin
          oWord.Connect;
          varFileName := OpenDialog1.FileName;
          oWord.Documents.Open (varFileName,EmptyParam,EmptyParam,
                                EmptyParam,EmptyParam,EmptyParam,
                                EmptyParam,EmptyParam,EmptyParam,
                                EmptyParam);

          oWord.ActiveDocument.PrintOut (EmptyParam,EmptyParam,EmptyParam,
                                         EmptyParam,EmptyParam,EmptyParam,
                                         EmptyParam,EmptyParam,EmptyParam,
                                         EmptyParam,EmptyParam,EmptyParam,
                                         EmptyParam,EmptyParam);

          oWord.Disconnect;
       end;
  Finally
    oWord.Free;
  End;
end;

end.
/////////////////////////////////////////////////////////////////////////////////////////
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, OleServer, WordXP;

type
  TForm1 = class(TForm)
    Button1: TButton;
    WordApplication1: TWordApplication;
    OpenDialog1: TOpenDialog;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// NESSECITA TER INSTALADO UMA IMPRESSORA PDF ... EXEMPLO: ACROBAT DISTILLER
// PARA SER USADO NO DELPHI 7

procedure TForm1.Button1Click(Sender: TObject);
var
  oWord : TWordApplication;
  varFileName : OleVariant;
begin
  // CONVERTER DOC PARA PDF
  // DEIXE A IMPRESSORA EM OFF-LINE PARA SALVAR O DOCUMENTO NO HD

  oWord := TWordApplication.Create (Nil);
  Try
    if OpenDialog1.Execute then
       begin
          oWord.Connect;
          varFileName := OpenDialog1.FileName;
          oWord.Documents.Open (varFileName,EmptyParam,EmptyParam,
                                EmptyParam,EmptyParam,EmptyParam,
                                EmptyParam,EmptyParam,EmptyParam,
                                EmptyParam,EmptyParam,EmptyParam,
                                EmptyParam,EmptyParam,EmptyParam);

          oWord.ActiveDocument.PrintOut (EmptyParam,EmptyParam,EmptyParam,
                                         EmptyParam,EmptyParam,EmptyParam,
                                         EmptyParam,EmptyParam,EmptyParam,
                                         EmptyParam,EmptyParam,EmptyParam,
                                         EmptyParam,EmptyParam,EmptyParam,
                                         EmptyParam,EmptyParam,EmptyParam);
          oWord.Disconnect;
       end;
  Finally
    oWord.Free;
  End;
end;


end.

OBS: O documento word ( .doc ) será salvo no disco em formato PDF

abraço

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this