topdfu.pas
来自「wptools5 pro 完整源代码 Msword界面的文本编辑器源代码」· PAS 代码 · 共 60 行
PAS
60 行
unit ToPDFU;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,
WPCtrMemo, WPRTEPaint, WPRTEDefs,
WPPDFR1, WPPDFWP
;
type
TDocConverter = class(TForm)
InputFile: TEdit;
OutputFile: TEdit;
Button1: TButton;
OpenDialog1: TOpenDialog;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
DocConverter: TDocConverter;
implementation
{$R *.dfm}
procedure TDocConverter.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
InputFile.Text := OpenDialog1.FileName;
end;
procedure TDocConverter.Button2Click(Sender: TObject);
var wp : TWPCustomRtfEdit;
pdf : TWPPDFExport;
begin
wp := TWPCustomRtfEdit.CreateDynamic;
pdf := TWPPDFExport.Create(nil);
try
pdf.Source := wp;
pdf.AutoLaunch := TRUE;
pdf.Filename := OutputFile.Text;
wp.LoadFromFile(InputFile.Text, true);
wp.ReformatAll(true);
pdf.Print;
finally
pdf.Free;
wp.Free;
end;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?