summaryrefslogtreecommitdiff
path: root/lib/wx/doc/src/wxPrintout.xml
blob: 83fe8640c570fa82040c4fdde59a79e9e42eeedd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<!-- THIS FILE IS GENERATED DO NOT EDIT -->


<erlref>
<header>
  <copyright>
    <year>2020</year><year>2021</year>
    <holder>wxWidgets team.</holder></copyright>
  <legalnotice>Licensed under the wxWindows Free Documentation Licence, Version 3
  </legalnotice>
  <title>wxPrintout</title>
</header>
<module>wxPrintout</module>
<modulesummary>Functions for wxPrintout class</modulesummary>
<description><p>This class encapsulates the functionality of printing out an application document.
      </p><p>A new class must be derived and members overridden to respond to calls such as <c>OnPrintPage()</c> (not implemented in wx) and <c>HasPage()</c> (not implemented in wx) and to render the print image onto an associated <seeerl marker="wxDC"><c>wxDC</c></seeerl>. Instances of this class are passed to <seemfa marker="wxPrinter#print/4"><c>wxPrinter:print/4</c></seemfa> or to a <seeerl marker="wxPrintPreview"><c>wxPrintPreview</c></seeerl> object to initiate printing or previewing.
      </p><p>Your derived <seeerl marker="wxPrintout"><c>wxPrintout</c></seeerl> is responsible for drawing both the preview image and the printed page. If your windows' drawing routines accept an arbitrary DC as an argument, you can re-use those routines within your <seeerl marker="wxPrintout"><c>wxPrintout</c></seeerl> subclass to draw the printout image. You may also add additional drawing elements within your <seeerl marker="wxPrintout"><c>wxPrintout</c></seeerl> subclass, like headers, footers, and/or page numbers. However, the image on the printed page will often differ from the image drawn on the screen, as will the print preview image - not just in the presence of headers and footers, but typically in scale. A high-resolution printer presents a much larger drawing surface (i.e., a higher-resolution DC); a zoomed-out preview image presents a much smaller drawing surface (lower-resolution DC). By using the routines FitThisSizeToXXX() and/or MapScreenSizeToXXX() within your <seeerl marker="wxPrintout"><c>wxPrintout</c></seeerl> subclass to set the user scale and origin of the associated DC, you can easily use a single drawing routine to draw on your application's windows, to create the print preview image, and to create the printed paper image, and achieve a common appearance to the preview image and the printed page.
      </p><p>See: <url href="https://docs.wxwidgets.org/3.1/overview_printing.html#overview_printing">Overview printing</url>, <c>wxPrinterDC</c> (not implemented in wx), <seeerl marker="wxPrintDialog"><c>wxPrintDialog</c></seeerl>, <seeerl marker="wxPageSetupDialog"><c>wxPageSetupDialog</c></seeerl>, <seeerl marker="wxPrinter"><c>wxPrinter</c></seeerl>, <seeerl marker="wxPrintPreview"><c>wxPrintPreview</c></seeerl>
      </p>
  <p>wxWidgets docs: <url href="https://docs.wxwidgets.org/3.1/classwx_printout.html">wxPrintout</url></p>
  </description>
<datatypes><datatype><name name="wxPrintout"/></datatype></datatypes>

<funcs>
  <func>
    <name name="new" arity="3" clause_i="1" since=""/>
    <fsummary>Constructor. </fsummary>
    <desc><p>Constructor. 
      </p><p>Creates a <seeerl marker="wxPrintout"><c>wxPrintout</c></seeerl> object with a callback fun and optionally other callback funs. The <c>This</c> argument is the <seeerl marker="wxPrintout"><c>wxPrintout</c></seeerl> object reference to this object
      </p><p>Notice: The callbacks may not call other processes. 
      </p></desc>
  </func>
  
  <func>
    <name name="destroy" arity="1" clause_i="1" since=""/>
    <fsummary>Destructor. </fsummary>
    <desc><p>Destructor. 
      </p></desc>
  </func>
  
  <func>
    <name name="getDC" arity="1" clause_i="1" since=""/>
    <fsummary>Returns the device context associated with the printout (given to the printout at start of printing or previewing). </fsummary>
    <desc><p>Returns the device context associated with the printout (given to the printout at start of printing or previewing). 
      </p><p>The application can use <seemfa marker="#getDC/1"><c>getDC/1</c></seemfa> to obtain a device context to draw on.
      </p><p>This will be a <c>wxPrinterDC</c> (not implemented in wx) if printing under Windows or Mac, a <seeerl marker="wxPostScriptDC"><c>wxPostScriptDC</c></seeerl> if printing on other platforms, and a <seeerl marker="wxMemoryDC"><c>wxMemoryDC</c></seeerl> if previewing. 
      </p></desc>
  </func>
  
  <func>
    <name name="getPageSizeMM" arity="1" clause_i="1" since=""/>
    <fsummary>Returns the size of the printer page in millimetres. </fsummary>
    <desc><p>Returns the size of the printer page in millimetres. 
      </p></desc>
  </func>
  
  <func>
    <name name="getPageSizePixels" arity="1" clause_i="1" since=""/>
    <fsummary>Returns the size of the printer page in pixels, called the page rectangle. </fsummary>
    <desc><p>Returns the size of the printer page in pixels, called the page rectangle. 
      </p><p>The page rectangle has a top left corner at (0,0) and a bottom right corner at (w,h). These values may not be the same as the values returned from <seemfa marker="wxDC#getSize/1"><c>wxDC:getSize/1</c></seemfa>; if the printout is being used for previewing, a memory device context is used, which uses a bitmap size reflecting the current preview zoom. The application must take this discrepancy into account if previewing is to be supported. 
      </p></desc>
  </func>
  
  <func>
    <name name="getPaperRectPixels" arity="1" clause_i="1" since=""/>
    <fsummary>Returns the rectangle that corresponds to the entire paper in pixels, called the paper rectangle. </fsummary>
    <desc><p>Returns the rectangle that corresponds to the entire paper in pixels, called the paper rectangle. 
      </p><p>This distinction between paper rectangle and page rectangle reflects the fact that most printers cannot print all the way to the edge of the paper. The page rectangle is a rectangle whose top left corner is at (0,0) and whose width and height are given by wxDC::GetPageSizePixels().
      </p><p>On MSW and Mac, the page rectangle gives the printable area of the paper, while the paper rectangle represents the entire paper, including non-printable borders. Thus, the rectangle returned by wxDC::GetPaperRectPixels() will have a top left corner whose coordinates are small negative numbers and the bottom right corner will have values somewhat larger than the width and height given by wxDC::GetPageSizePixels().
      </p><p>On other platforms and for PostScript printing, the paper is treated as if its entire area were printable, so this function will return the same rectangle as the page rectangle. 
      </p></desc>
  </func>
  
  <func>
    <name name="getPPIPrinter" arity="1" clause_i="1" since=""/>
    <fsummary>Returns the number of pixels per logical inch of the printer device context. </fsummary>
    <desc><p>Returns the number of pixels per logical inch of the printer device context. 
      </p><p>Dividing the printer PPI by the screen PPI can give a suitable scaling factor for drawing text onto the printer.
      </p><p>Remember to multiply this by a scaling factor to take the preview DC size into account. Or you can just use the FitThisSizeToXXX() and MapScreenSizeToXXX routines below, which do most of the scaling calculations for you. 
      </p></desc>
  </func>
  
  <func>
    <name name="getPPIScreen" arity="1" clause_i="1" since=""/>
    <fsummary>Returns the number of pixels per logical inch of the screen device context. </fsummary>
    <desc><p>Returns the number of pixels per logical inch of the screen device context. 
      </p><p>Dividing the printer PPI by the screen PPI can give a suitable scaling factor for drawing text onto the printer.
      </p><p>If you are doing your own scaling, remember to multiply this by a scaling factor to take the preview DC size into account. 
      </p></desc>
  </func>
  
  <func>
    <name name="getTitle" arity="1" clause_i="1" since=""/>
    <fsummary>Returns the title of the printout. </fsummary>
    <desc><p>Returns the title of the printout. 
      </p></desc>
  </func>
  
  <func>
    <name name="isPreview" arity="1" clause_i="1" since=""/>
    <fsummary>Returns true if the printout is currently being used for previewing. </fsummary>
    <desc><p>Returns true if the printout is currently being used for previewing. 
      </p><p>See: <c>GetPreview()</c> (not implemented in wx)
      </p></desc>
  </func>
  
  <func>
    <name name="fitThisSizeToPaper" arity="2" clause_i="1" since=""/>
    <fsummary>Set the user scale and device origin of the <c>wxDC</c> associated with this <c>wxPrintout</c> so that the given image size fits entirely within the paper and the origin is at the top left corner of the paper. </fsummary>
    <desc><p>Set the user scale and device origin of the <seeerl marker="wxDC"><c>wxDC</c></seeerl> associated with this <seeerl marker="wxPrintout"><c>wxPrintout</c></seeerl> so that the given image size fits entirely within the paper and the origin is at the top left corner of the paper. 
      </p><p>Use this if you're managing your own page margins.
      </p><p>Note: With most printers, the region around the edges of the paper are not printable so that the edges of the image could be cut off. 
      </p></desc>
  </func>
  
  <func>
    <name name="fitThisSizeToPage" arity="2" clause_i="1" since=""/>
    <fsummary>Set the user scale and device origin of the <c>wxDC</c> associated with this <c>wxPrintout</c> so that the given image size fits entirely within the page rectangle and the origin is at the top left corner of the page rectangle. </fsummary>
    <desc><p>Set the user scale and device origin of the <seeerl marker="wxDC"><c>wxDC</c></seeerl> associated with this <seeerl marker="wxPrintout"><c>wxPrintout</c></seeerl> so that the given image size fits entirely within the page rectangle and the origin is at the top left corner of the page rectangle. 
      </p><p>On MSW and Mac, the page rectangle is the printable area of the page. On other platforms and PostScript printing, the page rectangle is the entire paper.
      </p><p>Use this if you want your printed image as large as possible, but with the caveat that on some platforms, portions of the image might be cut off at the edges. 
      </p></desc>
  </func>
  
  <func>
    <name name="fitThisSizeToPageMargins" arity="3" clause_i="1" since=""/>
    <fsummary>Set the user scale and device origin of the <c>wxDC</c> associated with this <c>wxPrintout</c> so that the given image size fits entirely within the page margins set in the given <c>wxPageSetupDialogData</c> object. </fsummary>
    <desc><p>Set the user scale and device origin of the <seeerl marker="wxDC"><c>wxDC</c></seeerl> associated with this <seeerl marker="wxPrintout"><c>wxPrintout</c></seeerl> so that the given image size fits entirely within the page margins set in the given <seeerl marker="wxPageSetupDialogData"><c>wxPageSetupDialogData</c></seeerl> object. 
      </p><p>This function provides the greatest consistency across all platforms because it does not depend on having access to the printable area of the paper.
      </p><p>Remark: On Mac, the native <seeerl marker="wxPageSetupDialog"><c>wxPageSetupDialog</c></seeerl> does not let you set the page margins; you'll have to provide your own mechanism, or you can use the Mac-only class wxMacPageMarginsDialog. 
      </p></desc>
  </func>
  
  <func>
    <name name="mapScreenSizeToPaper" arity="1" clause_i="1" since=""/>
    <fsummary>Set the user scale and device origin of the <c>wxDC</c> associated with this <c>wxPrintout</c> so that the printed page matches the screen size as closely as possible and the logical origin is in the top left corner of the paper rectangle. </fsummary>
    <desc><p>Set the user scale and device origin of the <seeerl marker="wxDC"><c>wxDC</c></seeerl> associated with this <seeerl marker="wxPrintout"><c>wxPrintout</c></seeerl> so that the printed page matches the screen size as closely as possible and the logical origin is in the top left corner of the paper rectangle. 
      </p><p>That is, a 100-pixel object on screen should appear at the same size on the printed page. (It will, of course, be larger or smaller in the preview image, depending on the zoom factor.)
      </p><p>Use this if you want WYSIWYG behaviour, e.g., in a text editor. 
      </p></desc>
  </func>
  
  <func>
    <name name="mapScreenSizeToPage" arity="1" clause_i="1" since=""/>
    <fsummary>This sets the user scale of the <c>wxDC</c> associated with this <c>wxPrintout</c> to the same scale as <c>mapScreenSizeToPaper/1</c> but sets the logical origin to the top left corner of the page rectangle. </fsummary>
    <desc><p>This sets the user scale of the <seeerl marker="wxDC"><c>wxDC</c></seeerl> associated with this <seeerl marker="wxPrintout"><c>wxPrintout</c></seeerl> to the same scale as <seemfa marker="#mapScreenSizeToPaper/1"><c>mapScreenSizeToPaper/1</c></seemfa> but sets the logical origin to the top left corner of the page rectangle. 
      </p></desc>
  </func>
  
  <func>
    <name name="mapScreenSizeToPageMargins" arity="2" clause_i="1" since=""/>
    <fsummary>This sets the user scale of the <c>wxDC</c> associated with this <c>wxPrintout</c> to the same scale as <c>mapScreenSizeToPageMargins/2</c> but sets the logical origin to the top left corner of the page margins specified by the given <c>wxPageSetupDialogData</c> object. </fsummary>
    <desc><p>This sets the user scale of the <seeerl marker="wxDC"><c>wxDC</c></seeerl> associated with this <seeerl marker="wxPrintout"><c>wxPrintout</c></seeerl> to the same scale as <seemfa marker="#mapScreenSizeToPageMargins/2"><c>mapScreenSizeToPageMargins/2</c></seemfa> but sets the logical origin to the top left corner of the page margins specified by the given <seeerl marker="wxPageSetupDialogData"><c>wxPageSetupDialogData</c></seeerl> object. 
      </p></desc>
  </func>
  
  <func>
    <name name="mapScreenSizeToDevice" arity="1" clause_i="1" since=""/>
    <fsummary>Set the user scale and device origin of the <c>wxDC</c> associated with this <c>wxPrintout</c> so that one screen pixel maps to one device pixel on the DC. </fsummary>
    <desc><p>Set the user scale and device origin of the <seeerl marker="wxDC"><c>wxDC</c></seeerl> associated with this <seeerl marker="wxPrintout"><c>wxPrintout</c></seeerl> so that one screen pixel maps to one device pixel on the DC. 
      </p><p>That is, the user scale is set to (1,1) and the device origin is set to (0,0).
      </p><p>Use this if you want to do your own scaling prior to calling <seeerl marker="wxDC"><c>wxDC</c></seeerl> drawing calls, for example, if your underlying model is floating-point and you want to achieve maximum drawing precision on high-resolution printers.
      </p><p>You can use the GetLogicalXXXRect() routines below to obtain the paper rectangle, page rectangle, or page margins rectangle to perform your own scaling.
      </p><p>Note: While the underlying drawing model of macOS is floating-point, wxWidgets's drawing model scales from integer coordinates. 
      </p></desc>
  </func>
  
  <func>
    <name name="getLogicalPaperRect" arity="1" clause_i="1" since=""/>
    <fsummary>Return the rectangle corresponding to the paper in the associated <c>wxDC</c> 's logical coordinates for the current user scale and device origin. </fsummary>
    <desc><p>Return the rectangle corresponding to the paper in the associated <seeerl marker="wxDC"><c>wxDC</c></seeerl> 's logical coordinates for the current user scale and device origin. 
      </p></desc>
  </func>
  
  <func>
    <name name="getLogicalPageRect" arity="1" clause_i="1" since=""/>
    <fsummary>Return the rectangle corresponding to the page in the associated <c>wxDC</c> 's logical coordinates for the current user scale and device origin. </fsummary>
    <desc><p>Return the rectangle corresponding to the page in the associated <seeerl marker="wxDC"><c>wxDC</c></seeerl> 's logical coordinates for the current user scale and device origin. 
      </p><p>On MSW and Mac, this will be the printable area of the paper. On other platforms and PostScript printing, this will be the full paper rectangle. 
      </p></desc>
  </func>
  
  <func>
    <name name="getLogicalPageMarginsRect" arity="2" clause_i="1" since=""/>
    <fsummary>Return the rectangle corresponding to the page margins specified by the given <c>wxPageSetupDialogData</c> object in the associated <c>wxDC</c>'s logical coordinates for the current user scale and device origin. </fsummary>
    <desc><p>Return the rectangle corresponding to the page margins specified by the given <seeerl marker="wxPageSetupDialogData"><c>wxPageSetupDialogData</c></seeerl> object in the associated <seeerl marker="wxDC"><c>wxDC</c></seeerl>'s logical coordinates for the current user scale and device origin. 
      </p><p>The page margins are specified with respect to the edges of the paper on all platforms. 
      </p></desc>
  </func>
  
  <func>
    <name name="setLogicalOrigin" arity="3" clause_i="1" since=""/>
    <fsummary>Set the device origin of the associated <c>wxDC</c> so that the current logical point becomes the new logical origin. </fsummary>
    <desc><p>Set the device origin of the associated <seeerl marker="wxDC"><c>wxDC</c></seeerl> so that the current logical point becomes the new logical origin. 
      </p></desc>
  </func>
  
  <func>
    <name name="offsetLogicalOrigin" arity="3" clause_i="1" since=""/>
    <fsummary>Shift the device origin by an amount specified in logical coordinates. </fsummary>
    <desc><p>Shift the device origin by an amount specified in logical coordinates. 
      </p></desc>
  </func>
  </funcs>
</erlref>