GetUsedDC
IPDFDocument3 :: General document methods

See Also Example
Collapse All

This method gets the handle of a device context (HDC) of a PDF document for use with EMF drawing functions.

Syntax

LONG GetUsedDC ()
Return value
Handle of the device context

Remarks

GetUsedDC returns the HDC property used as a reference DC for Windows GDI functions.

Example

Drawing Text Directly to a PDF Document

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.UseScreenDC := true;
PDF.BeginDoc;
r := Rect(10, 10, 200, 200);
DrawText(PDF.GetUsedDC, 'Hello, PDF!', 11, R, DT_CENTER);
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->UseScreenDC = TRUE;
PDF->BeginDoc();
RECT r = {10, 10, 200, 200 };
DrawText((HDC)PDF->GetUsedDC(), "Hello, PDF!", 11, &r, DT_CENTER);
PDF->EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.UseScreenDC = true;
PDF.BeginDoc();
Rect r = new Rect();
r.Bottom = 200;
r.Right = 200;
r.Left = 10;
r.Top = 10;
DrawText((HDC)PDF.GetUsedDC(), "Hello, PDF!", 11, ref r, DT_CENTER);
PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.UseScreenDC = True
PDF.BeginDoc
Dim r as RECT
r.bottom = 200
r.right = 200
r.left = 10
r.top = 10
DrawText PDF.GetUsedDC, "Hello, PDF!", 11, R, DT_CENTER
PDF.EndDoc

See Also

Reference