JBIG2SaveFlags example for C++ Builder

void __fastcall TForm1::Button1Click(TObject *Sender) 
{
   int nRet; 

   LEADImage1->JBIG2SaveFlags = FLAG_JBIG2_TPON; 
   LEADImage1->JBIG2TemplateType = 2; 
   LEADImage1->JBIG2GBATX1 = 3; 
   LEADImage1->JBIG2GBATY1 = -1; 
   LEADImage1->JBIG2GBATX2 = -3; 
   LEADImage1->JBIG2GBATY2 = -1; 
   LEADImage1->JBIG2GBATX3 = 2; 
   LEADImage1->JBIG2GBATY3 = -2; 
   LEADImage1->JBIG2GBATX4 = -2; 
   LEADImage1->JBIG2GBATY4 = -2; 

   nRet= LEADImage1->Save ("c:\\Output.jb2", FILE_JBIG2, 24, 2, SAVE_OVERWRITE); 
   if(nRet == SUCCESS) 
      ShowMessage("Saved Successfully");
   else
      ShowMessage("Error Saving: " + IntToStr(nRet)); 
}