Using compound page folios

Using compound page folios, you can create complex printable documents from existing folios. This example shows you how to use the printing classes to create a printable document folio from an animation view.

In this example, you create a brochure with four frames from an animation and three pages of text. The animation view is an animation graphic about 4 x 5 inches in size. The text is contained in a large view of four page-size inner views.The four animation images appear on one page. Figure 101 shows the finished brochure. The first page is the 4-up composite and the remaining pages are from the text.


  1. Create a view for the animation and a view for the text.
    The animation view is an animation graphic about 4 x 5 inches in size. The text is contained in a large view of four page-sized inner views.
    This example assumes TView derives from MGraphic.
      TView*  demoView;
      TView*  textView;
  2. Create a printer.
    Ultimately, the system will provide a printer, but for now you must create one.
        TPrinter    printer(TPrinter::kSystemPrinter);
  3. Create a page description for the view.
    Since you want something other than a standard printer page, construct a page description from TStandardPageDescription.
      // kCustom is a TToken& used to identify the custom page description
      TStandardPageDescription    demoPage(kCustom,TGRect(TGPoint(0,0),TGPoint(298,370)));
      demoPage.SetPrintableRect(TGRect(TGPoint(5,5),TGPoint(293,365)));
  4. Use the page description to create a folio page.
    The physical size of the page description is slightly larger than the view, and its printable rectangle is the view. Use a TBookPageFolio to represent the page folio.
      TBookPageFolio      demoTiledPageFolio(demoPage,demoView);
  5. Create a standard 8.5 x 11 inch page description for the text view.
    The text consists of several internal views in a standard 8.5 x 11 inch format. Assume there are four page-size views separated by a 0.5-inch gap within the text view. You use the following page description to construct the views. TPageDescription::kUSLetter is a page size defined in the TPageDescription class. The TToken& kStandard is an identifier that you attach to the description.
      TStandardPageDescription    textPage(kStandard, TPageDescription::kUSLetter);
  6. Use TBookPageFolio to create the text folio pages.
    This example folio says to use no partial pages, no upper left offset, and no lower right offset. The gap is (0,0.5) or a half-inch vertical separation. By default, the active area used for pagination is the physical area.
      TBookPageFolio  demoTextPages(textPage,textView,
                  TRUE,TGPoint::kOrigin,TGPoint::kOrigin,TGPoint(0,0.5));
  7. Create a compound page folio to combine the two folios into one document folio.
    The compound page folio is initially empty.
      TCompoundPageFolio* animationFolio = new TCompoundPageFolio;
  8. Make four pages of the animation.
    You add the pages to the compound folio.
      animationFolio->AddFolio(&demoTiledPageFolio);
      animationFolio->AddFolio(&demoTiledPageFolio);
      animationFolio->AddFolio(&demoTiledPageFolio);
      animationFolio->AddFolio(&demoTiledPageFolio);
  9. Use a 4-up compositor to put all of these pages on a single page.
      TNUpCompositor*     fourUp = new TNUpCompositor(TULongPair(2,2));
  10. Create a class for the compositor that takes a compositor and folio to create a page iterator. TCompositedFolio is not provided by the system.
      TCompositedFolio    fourUpFolio(fourUp,animationFolio);
  11. Combine these pages and the text to make another compound
    document folio.
      TCompoundPageFolio  brochureFolio;
      brochureFolio.AddFolio(&fourUpFolio);
      brochureFolio.AddFolio(&demoTextPages);
  12. Print the compound folio.
    Assume that you do not want the second page of text for this particular printing. Use TStandardPageRange to make a page range and an iterator that uses the range. The second page of text corresponds to the third page of the document (Page two if you count from zero).
      TStandardPageRange*     pageRange = new TStandardPageRange;
  13. Set the range to exclude the second page of text.
      pageRange->Not(2);
  14. Create the page iterator using the range.
      TPageIterator*  demoIterator = brochureFolio.CreatePageIterator(pageRange);
  15. Create a print job description from the printer.
      TPrintJobDescription    demoJob(printer.CreateJobDescription());
  16. Print the folio and clean up.
      demoIterator->Print(demoJob);
      
      delete  demoIterator;

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker