DynaPDF Manual - Page 453
Previous Page 452 Index Next Page 454
Function Reference
Page 453 of 839
FView.Left := FView.Right;
FView.Right := tmp;
end;
if (FView.Top > FView.Bottom) then begin
tmp := FView.Top;
FView.Top := FView.Bottom;
FView.Bottom := tmp;
end;
// ViewRect is the current size of the EMF graphic in pixel.
sx := (r.Right - r.Left) / (ViewRect.Right - ViewRect.Left);
sy := (r.Bottom - r.Top) / (ViewRect.Bottom - ViewRect.Top);
// See how the rectangle must be calculated:
tmp
:= r.Left;
r.Left
:= Round(r.Left + FView.Left
* sx);
r.Right
:= Round(tmp
+ FView.Right
* sx);
tmp
:= r.Top;
r.Top
:= Round(r.Top
+ FView.Top
* sy);
r.Bottom := Round(tmp
+ FView.Bottom * sy);
// Now we have the unscaled cutting area. We want to output the
// EMF file onto the entire page with a border of 20 units so
// that we must only check whether the width or the height can be
// calculated by DynaPDF to preserve the aspect ratio.
sx := (r.Right - r.Left) / pdf.GetPageWidth;
sy := (r.Bottom - r.Top) / pdf.GetPageHeight;
pdf.SetMetaConvFlags(mfClipView); // we clip the viewport
if (sx > sy) then
pdf.InsertMetafileExt(EMF,
r, 20, 20, pdf.GetPageWidth - 40, 0)
else
pdf.InsertMetafileExt(EMF,
r, 20, 20, 0, pdf.GetPageHeight - 40);
pdf.EndPage;
pdf.CloseFile;
except
on E: Exception do MessageDlg(E.Message, mtError, [mbOK], 0);
end;
if pdf <> nil then pdf.Free;
end;
GetLogMetafileSizeEx
Syntax:
SI32 pdfGetLogMetafileSizeEx(
const PPDF* IPDF,
// Instance pointer
const void* Buffer, // EMF buffer
UI32 BufSize,
// Buffer size in bytes
struct TRectL* R)
// out -> Bounding rectangle
The function retrieves the logical bounding box of an enhanced or Windows metafile. The
parameter Buffer must be a file buffer of an EMF or WMF file.
Because the GDI function SetWinMeatFileBits() is used to convert WMF files to EMF, WMF files are
not supported under Linux or UNIX.
The original size of a metafile must be known to compute a user defined cutting area or viewport.
See GetLogMetafileSize() for an example application.
Return Values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
Previous topic: GetLineWidth, GetLinkHighlightMode, GetLogMetafileSize
Next topic: GetMatrix, GetMaxFieldLen, GetMeasureObj