GetDC
IPDFDocument4 :: General document management :: Metafiles

See Also Example
Collapse All

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

Syntax

OLE_HANDLE GetDC ()
Return value
Handle of the device context

Remarks

Note: This method returns a device context (DC) for the current page. If you change the current page or add a new page, you must call this method again to get the DC for the current page.

Example

Using the Device Context

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.SetLicenseData('demo', 'demo');
PDF.UseScreenBasedDC := true;

{ use standard GDI drawing functions: }
Rectangle(PDF.GetDC(), 10, 10, 20, 20);

PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->SetLicenseData("demo", "demo");
PDF->UseScreenBasedDC = true;

// use standard GDI drawing functions:
Rectangle(PDF->GetDC(), 10, 10, 20, 20);

PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.SetLicenseData("demo", "demo");
PDF.UseScreenBasedDC = true;

// use standard GDI drawing functions:
Rectangle(PDF.GetDC(), 10, 10, 20, 20);

PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.SetLicenseData "demo", "demo"
PDF.UseScreenBasedDC = True

// use standard GDI drawing functions:
Rectangle PDF.GetDC, 10, 10, 20, 20

PDF.SaveToFile "test.pdf", true

See Also

Reference