Setting the physical
page size
You can use the constants defined in TPageDescription to set standard page sizes.
// Create a page description with a custom page size
TStandardPageDescription pageDescription(kCustom,
TGRect(TGPoint(0,0),TGPoint(298.370)));
//Change the physical rectangle to tabloid size (11 x 17)
pageDescription.SetPhysicalRect(TPageDescription::kTabloid); Setting the printable rectangle
// Create a page description for a legal-size page
TStandardPageDescription pageDescription(kLegal, TPageDescription::kUSLegal);
//Set the printable rectangle to be inset .5" from the edge of the page
pageDescription.SetPrintableRect(
TGRect(TPageDescription::kUSLegal)
.Inset(TGPoint(0.5, 0.5)));
Setting the active
rectangle
// Create a page description for a legal-size page
TStandardPageDescription pageDescription(kLegal, TPageDescription::kUSLegal);
/// Set the active rectangle to be the printable rectangle
pageDescription.SetActiveRectChoice(TPageDescription::ePrintableRect);
Setting page
orientation
To set the page orientation to landscape, call TStandardPageDescription::SetWide on your page description.
// Create a page description for a legal-size page
TStandardPageDescription pageDescription(kLegal, TPageDescription::kUSLegal);
// Set the page orientation to portrait
sample.SetNarrow();
// Set the page orientation to landscape
pageDescription.SetWide();
Setting the print
media
// Create a page description for a legal-size page
TStandardPageDescription pageDescription(kLegal, TPageDescription::kUSLegal);
// Get a TPrintMedia* from a page description for legal-size paper, legalDescription
TMediaType* legalPaper = legalDescription.GetPrintMedia;
//Set the print media
pageDescription.AdoptMedia(legalPaper);
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.