DG Kernel Documentation


Skip Navigation Links.
Skip Navigation LinksHome Page > API Reference > View > IPrint_KC Search Documentation


IPrint_KC Interface

PrintView
GetDefaults
Print
PrintToFile
Get2DView
StartDocument
EndDocument

IPrint_KC provides access to printing of two dimensional views. IPrint_KC can be queried from IView via: DG Kernel > GetView > IView > IPrint_KC

See also Interface List


HRESULT PrintView(EPageOrientation orientation)

Parameters

orientation - [in] Orientation of the printed page

Remarks:

The methods prints the current DG Kernel window with paper orientation specified by the parameter. If orientation is eOrientAuto the view will be printed with portrait orientation if height of the window is greater than its width and with landscape orientation otherwise.


HRESULT GetDefaults(PrintContext_KC* options)

Parameters

options - [out] PrintContext_KC structure to be initialized

Remarks:

The methods acts as a constructor for PrintContext_KC structure. It initializes its members with default values.


HRESULT Print(PrintContext_KC* options)

Parameters

options - [in] PrintContext_KC additional options for printing. See remarks.

Remarks:

The method prints the view with the specified options.

validOrientation, validPaperSize, validMargin and validScale determine whether the correspondent parameters have valid data and should not be ignored.

orientation - Orientation of the printed page. If orientation is eOrientAuto the view will with portrait orientation if height of the window is greater than its width and with landscape otherwise

paperSize - Selection of the paper size

marginHorizontal, marginVertical - Margins for the printout. Must be greater than 0 and less than 1. Used only if validMargin is true and scale is negative or zero.. This option allows controlling amount of white space around the drawing.

The actual margins are calculated as next: Drawing size is calculated as the longest side if the minimal bounding rectangle containing the drawing. Margin on the left hand edge will be equal to marginHorizontal*(Drawing size). Margin on the right hand edge will be equal to the margin on the left hand side. Analogously the vertical margin will be calculated as marginVertical*(Drawing size).

Margins are ignored when scale is positive even if validMargin is true

scale - If scale is negative the image will be fit with maximal size into the page. Otherwise the model will be printed with the specified scale. For example if scale is 1.0  lengths measured on paper will coincide with lengths specified in the model.. If scale is 2.0 the printed model will have double size on paper. There are no warnings when scaled image does not fully fit the page. The image will be printed clipped in this case.


HRESULT PrintToFile(char* szFilePath, float aspect, PrintContext_KC* options)

Parameters

szFilePath - [in] Full path of the file with an .emf or .wmf extension to save the drawing to

 aspect - Aspect ratio of the rectangle (width divided by height) where the emf file will be displayed or a non-positive number to use default. See remarks.

options - [in] PrintContext_KC additional options for printing. See remarks. for Print method above.

Remarks:

This method is available only in 2D mode. It saves the current 2D drawing to a Extended Windows Metafile or Windows Metafile. The drawing is positioned and scaled to fit best a rectangle with aspect ratio aspect inside a document.

If aspect is zero or negative it will be calculated automatically as aspect ration of the minimal rectangle, containing the drawing.


HRESULT Get2DView(I2DView_KC **view)

Parameters

view - [out, retval] The returned I2DView_KC interface implemented by printing view

Remarks:

This method is available only in 2D mode. It gives access to printing view


HRESULT StartDocument)

Remarks:

Call before starting a sequence of PrintToFile() calls to optimize performance. The method allocates and cashes some additional resources used in consequent calls to PrintToFile().


HRESULT EndDocument)

Remarks:

Call in the end of a sequence of PrintToFile() calls to free resources allocates with a cal to StartDocument()