<< Click to Display Table of Contents >> VpeSetPageFormat |
Sets the page format for the current page. You can set the page format for each page separately. All newly with PageBreak() added pages will have the page format which was specified at last.
void VpeSetPageFormat(
VpeHandle hDoc,
int page_format
)
VpeHandle hDoc
Document Handle
int page_format
one of the constants below
Default:
VPAPER_A4
Example:
VPE instructs the printer during printing, to switch the paper dimensions automatically according to the page dimensions of the VPE Document's currently printed page. Many printers can react on this and choose automatically the right paper from a different paper input bin. If you want to stop VPE from this automatism, you can specify the flag PRINT_NO_AUTO_PAGE_DIMS for the property PrintOptions.
Since the PageFormat and the Orientation of the document are independent from the settings of the printer, you can copy the settings of the printer to the document by using one of the following code samples:
Copying the printer's page format to the document from the default printer:
hDoc = VpeOpenDoc(hwnd, "Test", 0);
// the default printer is chosen automatically, so just copy the
// dimensions
VpeSetPageWidth(hDoc, VpeGetDevPaperWidth(hDoc));
VpeSetPageHeight(hDoc, VpeGetDevPaperHeight(hDoc));
VpeSetPageOrientation(hDoc, VpeGetDevOrientation(hDoc));
Copying the printer's page format to the document from a specific printer:
hDoc = VpeOpenDoc(hwnd, "Test", 0);
// choose "Office Printer 2"
VpeSetDevice(hDoc, "Office Printer 2");
VpeSetPageWidth(hDoc, VpeGetDevPaperWidth(hDoc));
VpeSetPageHeight(hDoc, VpeGetDevPaperHeight(hDoc));
VpeSetPageOrientation(hDoc, VpeGetDevOrientation(hDoc));
Copying the printer's page format to the document from a PRS file:
hDoc = VpeOpenDoc(hwnd, "Test", 0);
// use PRINT_NO_AUTO_PAGE_DIMS, in order to be able to retrieve the
// values for the page dimensions from the PRS file:
VpeSetPrintOptions(hDoc, PRINT_ALL + PRINT_NO_AUTO_PAGE_DIMS);
VpeSetupPrinter(hDoc, "personal settings.prs", PRINTDLG_ONFAIL);
VpeSetPageWidth(hDoc, VpeGetDevPaperWidth(hDoc));
VpeSetPageHeight(hDoc, VpeGetDevPaperHeight(hDoc));
VpeSetPageOrientation(hDoc, VpeGetDevOrientation(hDoc));
// Switch PrintOptions back and let VPE control the printer's page
// dimensions, i.e. clear the flag PRINT_NO_AUTO_PAGE_DIMS
VpeSetPrintOptions(hDoc, PRINT_ALL);
You will notice that we are using PageWidth and PageHeight in the examples above. The reason is, that this circumvents a bug in many printer drivers, which return wrong values for DevPaperFormat in case a user defined format has been assigned to the printer. Because of this, the construction "VpeSetPageFormat(hDoc, VpeGetDevPaperFormat(hDoc))" can not be used reliably. Instead, use the code from the examples above.
page_format can be one of the following values:
Constant |
Value |
Comment |
VPAPER_USER_DEFINED |
0 |
User-Defined |
VPAPER_A4 |
-1 |
A4 Sheet, 210- by 297-millimeters |
VPAPER_LETTER |
-2 |
US Letter, 8 1/2- by 11-inches |
VPAPER_LEGAL |
-3 |
Legal, 8 1/2- by 14-inches |
VPAPER_CSHEET |
-4 |
C Sheet, 17- by 22-inches |
VPAPER_DSHEET |
-5 |
D Sheet, 22- by 34-inches |
VPAPER_ESHEET |
-6 |
E Sheet, 34- by 44-inches |
VPAPER_LETTERSMALL |
-7 |
Letter Small, 8 1/2- by 11-inches |
VPAPER_TABLOID |
-8 |
Tabloid, 11- by 17-inches |
VPAPER_LEDGER |
-9 |
Ledger, 17- by 11-inches |
VPAPER_STATEMENT |
-10 |
Statement, 5 1/2- by 8 1/2-inches |
VPAPER_EXECUTIVE |
-11 |
Executive, 7 1/4- by 10 1/2-inches |
VPAPER_A3 |
-12 |
A3 sheet, 297- by 420-millimeters |
VPAPER_A4SMALL |
-13 |
A4 small sheet, 210- by 297-millimeters |
VPAPER_A5 |
-14 |
A5 sheet, 148- by 210-millimeters |
VPAPER_B4 |
-15 |
B4 sheet, 250- by 354-millimeters |
VPAPER_B5 |
-16 |
B5 sheet, 182- by 257-millimeter paper |
VPAPER_FOLIO |
-17 |
Folio, 8 1/2- by 13-inch paper |
VPAPER_QUARTO |
-18 |
Quarto, 215- by 275-millimeter paper |
VPAPER_10X14 |
-19 |
10- by 14-inch sheet |
VPAPER_11X17 |
-20 |
11- by 17-inch sheet |
VPAPER_NOTE |
-21 |
Note, 8 1/2- by 11-inches |
VPAPER_ENV_9 |
-22 |
#9 Envelope, 3 7/8- by 8 7/8-inches |
VPAPER_ENV_10 |
-23 |
#10 Envelope, 4 1/8- by 9 1/2-inches |
VPAPER_ENV_11 |
-24 |
#11 Envelope, 4 1/2- by 10 3/8-inches |
VPAPER_ENV_12 |
-25 |
#12 Envelope, 4 3/4- by 11-inches |
VPAPER_ENV_14 |
-26 |
#14 Envelope, 5- by 11 1/2-inches |
VPAPER_ENV_DL |
-27 |
DL Envelope, 110- by 220-millimeters |
VPAPER_ENV_C5 |
-28 |
C5 Envelope, 162- by 229-millimeters |
VPAPER_ENV_C3 |
-29 |
C3 Envelope, 324- by 458-millimeters |
VPAPER_ENV_C4 |
-30 |
C4 Envelope, 229- by 324-millimeters |
VPAPER_ENV_C6 |
-31 |
C6 Envelope, 114- by 162-millimeters |
VPAPER_ENV_C65 |
-32 |
C65 Envelope, 114- by 229-millimeters |
VPAPER_ENV_B4 |
-33 |
B4 Envelope, 250- by 353-millimeters |
VPAPER_ENV_B5 |
-34 |
B5 Envelope, 176- by 250-millimeters |
VPAPER_ENV_B6 |
-35 |
B6 Envelope, 176- by 125-millimeters |
VPAPER_ENV_ITALY |
-36 |
Italy Envelope, 110- by 230-millimeters |
VPAPER_ENV_MONARCH |
-37 |
Monarch Envelope, 3 7/8- by 7 ½-inches |
VPAPER_ENV_PERSONAL |
-38 |
6 3/4 Envelope, 3 5/8- by 6 1/2-inches |
VPAPER_FANFOLD_US |
-39 |
US Std Fanfold, 14 7/8- by 11-inches |
VPAPER_FANFOLD_STD_GERMAN |
-40 |
German Std Fanfold, 8 1/2- by 12-inches |
VPAPER_FANFOLD_LGL_GERMAN |
-41 |
German Legal Fanfold, 8 1/2- by 13-inches |
VPAPER_ISO_B4 |
-42 |
B4 (ISO) 250 x 353 mm |
VPAPER_JAPANESE_POSTCARD |
-43 |
Japanese Postcard 100 x 148 mm |
VPAPER_9X11 |
-44 |
9 x 11 in |
VPAPER_10X11 |
-45 |
10 x 11 in |
VPAPER_15X11 |
-46 |
15 x 11 in |
VPAPER_ENV_INVITE |
-47 |
Envelope Invite 220 x 220 mm |
VPAPER_RESERVED_48 |
-48 |
RESERVED--DO NOT USE |
VPAPER_RESERVED_49 |
-49 |
RESERVED--DO NOT USE |
VPAPER_LETTER_EXTRA |
-50 |
Letter Extra 9 \275 x 12 in |
VPAPER_LEGAL_EXTRA |
-51 |
Legal Extra 9 \275 x 15 in |
VPAPER_TABLOID_EXTRA |
-52 |
Tabloid Extra 11.69 x 18 in |
VPAPER_A4_EXTRA |
-53 |
A4 Extra 9.27 x 12.69 in |
VPAPER_LETTER_TRANSVERSE |
-54 |
Letter Transverse 8 \275 x 11 in |
VPAPER_A4_TRANSVERSE |
-55 |
A4 Transverse 210 x 297 mm |
VPAPER_LETTER_EXTRA_TRANSVERSE |
-56 |
Letter Extra Transverse 9\275 x 12 in |
VPAPER_A_PLUS |
-57 |
SuperA/SuperA/A4 227 x 356 mm |
VPAPER_B_PLUS |
-58 |
SuperB/SuperB/A3 305 x 487 mm |
VPAPER_LETTER_PLUS |
-59 |
Letter Plus 8.5 x 12.69 in |
VPAPER_A4_PLUS |
-60 |
A4 Plus 210 x 330 mm |
VPAPER_A5_TRANSVERSE |
-61 |
A5 Transverse 148 x 210 mm |
VPAPER_B5_TRANSVERSE |
-62 |
B5 (JIS) Transverse 182 x 257 mm |
VPAPER_A3_EXTRA |
-63 |
A3 Extra 322 x 445 mm |
VPAPER_A5_EXTRA |
-64 |
A5 Extra 174 x 235 mm |
VPAPER_B5_EXTRA |
-65 |
B5 (ISO) Extra 201 x 276 mm |
VPAPER_A2 |
-66 |
A2 420 x 594 mm |
VPAPER_A3_TRANSVERSE |
-67 |
A3 Transverse 297 x 420 mm |
VPAPER_A3_EXTRA_TRANSVERSE |
-68 |
A3 Extra Transverse 322 x 445 mm |
|
|
|
Windows 2000 or Higher: |
|
|
VPAPER_DBL_JAPANESE_POSTCARD |
-69 |
Japanese Double Postcard 200 x 148 mm |
VPAPER_A6 |
-70 |
A6 105 x 148 mm |
VPAPER_JENV_KAKU2 |
-71 |
Japanese Envelope Kaku #2 |
VPAPER_JENV_KAKU3 |
-72 |
Japanese Envelope Kaku #3 |
VPAPER_JENV_CHOU3 |
-73 |
Japanese Envelope Chou #3 |
VPAPER_JENV_CHOU4 |
-74 |
Japanese Envelope Chou #4 |
VPAPER_LETTER_ROTATED |
-75 |
Letter Rotated 11 x 8 1/2 in |
VPAPER_A3_ROTATED |
-76 |
A3 Rotated 420 x 297 mm |
VPAPER_A4_ROTATED |
-77 |
A4 Rotated 297 x 210 mm |
VPAPER_A5_ROTATED |
-78 |
A5 Rotated 210 x 148 mm |
VPAPER_B4_JIS_ROTATED |
-79 |
B4 (JIS) Rotated 364 x 257 mm |
VPAPER_B5_JIS_ROTATED |
-80 |
B5 (JIS) Rotated 257 x 182 mm |
VPAPER_JAPANESE_POSTCARD_ROTATED |
-81 |
Japanese Postcard Rotated 148 x 100 mm |
VPAPER_DBL_JAPANESE_POSTCARD_ROTATED |
-82 |
Double Japanese Postcard Rotated 148 x 200mm |
VPAPER_A6_ROTATED |
-83 |
A6 Rotated 148 x 105 mm |
VPAPER_JENV_KAKU2_ROTATED |
-84 |
Japanese Envelope Kaku #2 Rotated |
VPAPER_JENV_KAKU3_ROTATED -85 |
-85 |
Japanese Envelope Kaku #3 Rotated |
VPAPER_JENV_CHOU3_ROTATED |
-86 |
Japanese Envelope Chou #3 Rotated |
VPAPER_JENV_CHOU4_ROTATED |
-87 |
Japanese Envelope Chou #4 Rotated |
VPAPER_B6_JIS |
-88 |
B6 (JIS) 128 x 182 mm |
VPAPER_B6_JIS_ROTATED |
-89 |
B6 (JIS) Rotated 182 x 128 mm |
VPAPER_12X11 |
-90 |
12 x 11 in |
VPAPER_JENV_YOU4 |
-91 |
Japanese Envelope You #4 |
VPAPER_JENV_YOU4_ROTATED |
-92 |
Japanese Envelope You #4 Rotated |
VPAPER_P16K |
-93 |
PRC 16K 146 x 215 mm |
VPAPER_P32K |
-94 |
PRC 32K 97 x 151 mm |
VPAPER_P32KBIG |
-95 |
PRC 32K(Big) 97 x 151 mm |
VPAPER_PENV_1 |
-96 |
PRC Envelope #1 102 x 165 mm |
VPAPER_PENV_2 |
-97 |
PRC Envelope #2 102 x 176 mm |
VPAPER_PENV_3 |
-98 |
PRC Envelope #3 125 x 176 mm |
VPAPER_PENV_4 |
-99 |
PRC Envelope #4 110 x 208 mm |
VPAPER_PENV_5 |
-100 |
PRC Envelope #5 110 x 220 mm |
VPAPER_PENV_6 |
-101 |
PRC Envelope #6 120 x 230 mm |
VPAPER_PENV_7 |
-102 |
PRC Envelope #7 160 x 230 mm |
VPAPER_PENV_8 |
-103 |
PRC Envelope #8 120 x 309 mm |
VPAPER_PENV_9 |
-104 |
PRC Envelope #9 229 x 324 mm |
VPAPER_PENV_10 |
-105 |
PRC Envelope #10 324 x 458 mm |
VPAPER_P16K_ROTATED |
-106 |
PRC 16K Rotated |
VPAPER_P32K_ROTATED |
-107 |
PRC 32K Rotated |
VPAPER_P32KBIG_ROTATED |
-108 |
PRC 32K(Big) Rotated |
VPAPER_PENV_1_ROTATED |
-109 |
PRC Envelope #1 Rotated 165 x 102 mm |
VPAPER_PENV_2_ROTATED |
-110 |
PRC Envelope #2 Rotated 176 x 102 mm |
VPAPER_PENV_3_ROTATED |
-111 |
PRC Envelope #3 Rotated 176 x 125 mm |
VPAPER_PENV_4_ROTATED |
-112 |
PRC Envelope #4 Rotated 208 x 110 mm |
VPAPER_PENV_5_ROTATED |
-113 |
PRC Envelope #5 Rotated 220 x 110 mm |
VPAPER_PENV_6_ROTATED |
-114 |
PRC Envelope #6 Rotated 230 x 120 mm |
VPAPER_PENV_7_ROTATED |
-115 |
PRC Envelope #7 Rotated 230 x 160 mm |
VPAPER_PENV_8_ROTATED |
-116 |
PRC Envelope #8 Rotated 309 x 120 mm |
VPAPER_PENV_9_ROTATED |
-117 |
PRC Envelope #9 Rotated 324 x 229 mm |
VPAPER_PENV_10_ROTATED |
-118 |
PRC Envelope #10 Rotated 458 x 324 mm |