On this page:
Paged  DC
Paged  DC.start
Paged  DC.end
Paged  DC.start_  doc
Paged  DC.end_  doc
Paged  DC.start_  page
Paged  DC.end_  page
PDFDC
PSDC
SVGDC
Paged  DC.Paper  Size
Paged  DC.Paper  Size.paper
Paged  DC.Config
Paged  DC.Config.margin
Paged  DC.Config.editor_  margin
Paged  DC.Config.translate
Paged  DC.Config.scale
Paged  DC.Config.orientation
Paged  DC.Config.paper
Paged  DC.Config.current
Paged  DC.Config.handle
Paged  DC.Config.from_  handle
0.45+9.1.0.1

4.3 Paged Drawing Contexts🔗ℹ

interface

interface draw.PagedDC

Drawing contexts that output to a file format, drawing must be explicitly started with PagedDC.start and ended with PagedDC.end.

method

method (dc :: draw.PagedDC).start(msg :: String = "Printing")

  :: Void

 

method

method (dc :: draw.PagedDC).end() :: Void

 

method

method (dc :: draw.PagedDC).start_doc(msg :: String = "Printing")

  :: Void

 

method

method (dc :: draw.PagedDC).end_doc() :: Void

 

method

method (dc :: draw.PagedDC).start_page() :: Void

 

method

method (dc :: draw.PagedDC).end_page() :: Void

Use PagedDC.start and PagedDC.end to bound all drawing for single-page output.

Use the more fine-grained combination of PagedDC.start_doc and PagedDC.start_page for multi-page output, where PagedDC.end_page ends a page and then PagedDC.start_page can be used again to start the next page. After the last page’s PagedDC.end_page, use PagedDC.end_doc to finish the document.

class

class draw.PDFDC():

  implements PagedDC

  constructor (

    size :: PagedDC.PaperSize,

    ~output: output :: Path || Port.Output,

    ~config: config :: PagedDC.Config

               = PagedDC.Config.current()

  )

Creates a drawing context that produces PDF output. Be sure to use PagedDC.start and PagedDC.end around all drawing.

class

class draw.PSDC():

  implements PagedDC

  constructor (

    size :: PagedDC.PaperSize,

    ~output: output :: Path || Port.Output,

    ~as_eps: as_eps = #true,

    ~config: config :: PagedDC.Config

               = PagedDC.Config.current()

  )

Creates a drawing context that produces PostScript output. Be sure to use PagedDC.start and PagedDC.end around all drawing.

class

class draw.SVGDC():

  implements PagedDC

  constructor (

    size :: SizeLike,

    ~output: output :: Path || Port.Output

  )

Creates a drawing context that produces SVG output. Be sure to use PagedDC.start and PagedDC.end around all drawing.

enumeration

enum draw.PagedDC.PaperSize

| ~is_a SizeLike

| paper

A size specification to be used with PSDC and PDFDC, which allows #'paper to specify the size indirectly as the current paper configuration’s size.

class

class draw.PagedDC.Config(

  ~margin: margin :: SizeLike.to_size = [16.0, 16.0],

  ~editor_margin: editor_margin :: SizeLike.to_size = [20.0, 20.0],

  ~translate: translate :: PointLike.to_point = [0.0, 0.0],

  ~scale: scale :: SizeLike.to_size = [0.8, 0.8],

  ~orientation: orientation :: PagedDC.Orientation = #'portrait,

  ~paper: paper :: PagedDC.Paper = #'letter

)

 

context parameter

Parameter.def draw.PagedDC.Config.current

  :: PagedDC.Config = PagedDC.Config()

A PagedDC.Config object describes a page configuration to be used by a PDFDC or PSDC drawing context.

Most fields affect all drawing, but editor_margin has no direct effect. The editor_margin field of the current configuration can be checked when printing a text editor’s content, for example.

property

property (config :: draw.PagedDC.Config).handle :: Any

 

function

fun draw.PagedDC.Config.from_handle(hand :: Any) :: PagedDC.Config

Converts between page-configuration objects and Racket-level configuration objects.