1. 程式人生 > 其它 >delphi llPDFLib 新增EMF檔案

delphi llPDFLib 新增EMF檔案

llPDFLib 新增EMF檔案

屬性和方法

TPDFPage.PlayMetaFile

procedure PlayMetaFile(MF: TMetaFile; OptionalContent: TOptionalContent = nil); overload;
procedure PlayMetaFile(MF: TMetafile; x: Extended; y: Extended; XScale: Extended; YScale: Extended; OptionalContent: TOptionalContent = nil); overload;

在頁面畫布上繪製元檔案作為一系列線條、區域和文字。

引數

MF 描繪的元檔案。

x 將顯示元檔案的 X 座標。

y 將顯示元檔案的 Y 座標。

XScale 整個寬度的壓縮水平。

YScale 沿著高度的壓縮水平。

OptionalContent 可選內容,元檔案將在其中顯示。預設值 nil

例子

新增EMF檔案

uses llPDFDocument;

procedure TForm1.Button11Click(Sender: TObject);
var
  Pdf: TPDFDocument;
  MetaFile: TMetaFile;
begin
  Pdf := TPDFDocument.Create(nil);
  MetaFile := TMetaFile.Create;
  try
    //建立PDF文件
    Pdf.AutoLaunch := True;
    Pdf.FileName := 'C:\Users\Administrator\Desktop\ceshi.pdf';
    //匯入EMF檔案
    MetaFile.LoadFromFile('C:\Users\Administrator\Desktop\emf0004.emf');
    Pdf.BeginDoc;
    Pdf.CurrentPage.PlayMetaFile(MetaFile);
    Pdf.EndDoc;
  finally
    Pdf.Free;
    MetaFile.Free;
  end;
end;