00001 #include "NOPackage.h" 00002 #include "NOFontVector.h" 00003 #include "NOPage.h" 00004 #include "NOString.h" 00005 00006 using namespace NiXPSObjects; 00007 00008 void createPage(const UTF8Char *pFontIn, const UTF8Char *pXPSOut) 00009 { 00010 // new destination document 00011 NOPackage *lPackage=NOPackage::createPackage(true); 00012 00013 // create a new page in the destination doc 00014 NOPage lPage=lPackage->getDocument(0).createPage(); 00015 00016 // create fixed page 00017 NOXFixedPage lContent=lPage.createFixedPage(); 00018 lContent.intialize(300,500); 00019 00020 // create a canvas 00021 NOXCanvas lCanvas=lContent.createCanvas(0); 00022 lCanvas.intialize(); 00023 00024 // now, add a font file 00025 NOFont lFont=lPage.addFont(pFontIn); 00026 00027 // create a glyphs section in the canvas 00028 NOXGlyphs lGlyphs=lCanvas.createGlyphs(0); 00029 00030 // initialize this glyphs sections 00031 // font size: 10 00032 // position: x:50 y:50 00033 lGlyphs.intialize(10.,NOString(UTF8String("/")+lFont.getPartName()), 50., 50.); 00034 00035 // set the color of the text 00036 lGlyphs.setFill(NOString("#FF0000FF")); 00037 00038 // add the text 00039 lGlyphs.setUnicodeString(NOString("NiXPS Library is fantastic !!")); 00040 00041 // write out and close 00042 lPackage->writePackageToFile(pXPSOut); 00043 NOPackage::destroyPackage(lPackage); 00044 }