OffsetXForDC
IPDFDocument4 :: General document management :: Metafiles

See Also Example
Collapse All

This property retrieves the horizontal offset for the virtual DC contents on the PDF page.

Syntax

FLOAT OffsetXForDC { get; set; }
Value

The vertical offset value for mapping the virtual DC contents to PDF page.

Default value is 0.

Example

Mapping from the Device Context to the PDF Page

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.UseScreenBasedDC := true;
PDF.PageResolution := PDF.GetDCResolution();

{ use standard GDI drawing functions: }
Rectangle(PDF.GetDC(), 0, 0, PDF.PageWidth, PDF.PageHeight);

PDF.ScaleXForDC := 0.5;
PDF.ScaleYForDC := 0.5;
PDF.OffsetXForDC := PDF.PageWidth / 4;
PDF.OffsetYForDC := PDF.PageHeight / 4;

PDF.FlushDC();
{ rectangle from DC will be translated to this rectangle in PDF: }
{ left = PDF.PageWidth / 4; }
{ top = PDF.PageHeight / 4; }
{ width = PDF.PageWidth / 2; }
{ height = PDF.PageHeight / 2; }
C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->UseScreenBasedDC = true;
PDF->PageResolution = PDF.GetDCResolution();

// use standard GDI drawing functions:
Rectangle(PDF->GetDC(), 0, 0, PDF->PageWidth, PDF->PageHeight);

PDF->ScaleXForDC = 0.5f;
PDF->ScaleYForDC = 0.5f;
PDF->OffsetXForDC = PDF->PageWidth / 4.0f;
PDF->OffsetYForDC = PDF->PageHeight / 4.0f;

PDF->FlushDC();
// rectangle from DC will be translated to this rectangle in PDF:
// left == PDF->PageWidth / 4;
// top == PDF->PageHeight / 4;
// width == PDF->PageWidth / 2;
// height == PDF->PageHeight / 2;
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.UseScreenBasedDC = true;
PDF.PageResolution = PDF.GetDCResolution();

// use standard GDI drawing functions:
Rectangle(PDF.GetDC(), 0, 0, PDF.PageWidth, PDF.PageHeight);

PDF.ScaleXForDC = 0.5f;
PDF.ScaleYForDC = 0.5f;
PDF.OffsetXForDC = PDF.PageWidth / 4.0f;
PDF.OffsetYForDC = PDF.PageHeight / 4.0f;

PDF.FlushDC();
// rectangle from DC will be translated to this rectangle in PDF:
// left == PDF.PageWidth / 4;
// top == PDF.PageHeight / 4;
// width == PDF.PageWidth / 2;
// height == PDF.PageHeight / 2;
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.UseScreenBasedDC = true
PDF.PageResolution = PDF.GetDCResolution

' use standard GDI drawing functions
Rectangle PDF.GetDC, 0, 0, PDF.PageWidth, PDF.PageHeight

PDF.ScaleXForDC = 0.5
PDF.ScaleYForDC = 0.5
PDF.OffsetXForDC = PDF.PageWidth / 4
PDF.OffsetYForDC = PDF.PageHeight / 4

PDF.FlushDC
' rectangle from DC will be translated to this rectangle in PDF:
' left = PDF.PageWidth / 4
' top = PDF.PageHeight / 4
' width = PDF.PageWidth / 2
' height = PDF.PageHeight / 2

See Also

Reference