SaveJBIG2Flags example for Delphi

procedure TForm1.Button1Click(Sender: TObject);
var
   nRet: Integer; 
begin
   LEADImage1.UnlockSupport(L_SUPPORT_JBIG2, L_KEY_JBIG2); 

   LEADImage1.Load('c:\image1.jpg', 0, 0, 1); 

   LEADDlgFile1.DialogTitle:= 'Save a File'; 
   LEADDlgFile1.DlgFileFlags:= 0; 
   LEADDlgFile1.InitialDir:= 'C:\'; 
   LEADDlgFile1.SaveMulti:= MULTIPAGE_OPERATION_OVERWRITE; 
   LEADDlgFile1.DlgFlags:= DLG_SAVE_AUTOPROCESS +
                           DLG_SAVE_SHOW_FILEOPTIONS_PROGRESSIVE +
                           DLG_SAVE_SHOW_FILEOPTIONS_MULTIPAGE +
                           DLG_SAVE_SHOW_FILEOPTIONS_STAMP +
                           DLG_SAVE_SHOW_FILEOPTIONS_QFACTOR +
                           DLG_SAVE_SHOW_FILEOPTIONS_J2KOPTIONS +
                           DLG_SAVE_SHOW_FILEOPTIONS_BASICJ2KOPTIONS +
                           DLG_SAVE_SHOW_FILEOPTIONS_JBIG2OPTIONS; 

   LEADDlgFile1.LEADImage:= LEADImage1; 

   nRet:= LEADDlgFile1.ShowSaveDlg(Self); 
   if(nRet = SUCCESS_DLG_OK)then
   begin
      if((LEADDlgFile1.SaveFormat = FILE_JBIG2) Or
         (LEADDlgFile1.SaveFormat = FILE_RAS_PDF_JBIG2) Or
         (LEADDlgFile1.SaveFormat = FILE_TIF_JBIG2))then
      begin
         LEADImage1.JBIG2ImageGBATX1:= LEADDlgFile1.SaveJBIG2ImageGBATX1; 
         LEADImage1.JBIG2ImageGBATY1:= LEADDlgFile1.SaveJBIG2ImageGBATY1; 
         LEADImage1.JBIG2ImageGBATX2:= LEADDlgFile1.SaveJBIG2ImageGBATX2; 
         LEADImage1.JBIG2ImageGBATY2:= LEADDlgFile1.SaveJBIG2ImageGBATY2; 
         LEADImage1.JBIG2ImageGBATX3:= LEADDlgFile1.SaveJBIG2ImageGBATX3; 
         LEADImage1.JBIG2ImageGBATY3:= LEADDlgFile1.SaveJBIG2ImageGBATY3; 
         LEADImage1.JBIG2ImageGBATX4:= LEADDlgFile1.SaveJBIG2ImageGBATX4; 
         LEADImage1.JBIG2ImageGBATY4:= LEADDlgFile1.SaveJBIG2ImageGBATY4; 
         LEADImage1.JBIG2ImageTemplateType:= LEADDlgFile1.SaveJBIG2ImageTemplateType; 
         LEADImage1.JBIG2ImageFlags:= LEADDlgFile1.SaveJBIG2ImageFlags; 
         LEADImage1.JBIG2ImageQFactor:= LEADDlgFile1.SaveJBIG2ImageQFactor; 
         LEADImage1.JBIG2TextGBATX1:= LEADDlgFile1.SaveJBIG2TextGBATX1; 
         LEADImage1.JBIG2TextGBATY1:= LEADDlgFile1.SaveJBIG2TextGBATY1; 
         LEADImage1.JBIG2TextGBATX2:= LEADDlgFile1.SaveJBIG2TextGBATX2; 
         LEADImage1.JBIG2TextGBATY2:= LEADDlgFile1.SaveJBIG2TextGBATY2; 
         LEADImage1.JBIG2TextGBATX3:= LEADDlgFile1.SaveJBIG2TextGBATX3; 
         LEADImage1.JBIG2TextGBATY3:= LEADDlgFile1.SaveJBIG2TextGBATY3; 
         LEADImage1.JBIG2TextGBATX4:= LEADDlgFile1.SaveJBIG2TextGBATX4; 
         LEADImage1.JBIG2TextGBATY4:= LEADDlgFile1.SaveJBIG2TextGBATY4; 
         LEADImage1.JBIG2TextTemplateType:= LEADDlgFile1.SaveJBIG2TextTemplateType; 
         LEADImage1.JBIG2TextFlags:= LEADDlgFile1.SaveJBIG2TextFlags; 
         LEADImage1.JBIG2TextQFactor:= LEADDlgFile1.SaveJBIG2TextQFactor; 
         LEADImage1.JBIG2TextMinSymArea:= LEADDlgFile1.SaveJBIG2TextMinSymArea; 
         LEADImage1.JBIG2TextMinSymWidth:= LEADDlgFile1.SaveJBIG2TextMinSymWidth; 
         LEADImage1.JBIG2TextMinSymHeight:= LEADDlgFile1.SaveJBIG2TextMinSymHeight; 
         LEADImage1.JBIG2TextMaxSymArea:= LEADDlgFile1.SaveJBIG2TextMaxSymArea; 
         LEADImage1.JBIG2TextMaxSymWidth:= LEADDlgFile1.SaveJBIG2TextMaxSymWidth; 
         LEADImage1.JBIG2TextMaxSymHeight:= LEADDlgFile1.SaveJBIG2TextMaxSymHeight; 
         LEADImage1.JBIG2TextDifThreshold:= LEADDlgFile1.SaveJBIG2TextDifThreshold; 
         LEADImage1.JBIG2YResolution:= LEADDlgFile1.SaveJBIG2YResolution; 
         LEADImage1.JBIG2XResolution:= LEADDlgFile1.SaveJBIG2XResolution; 
         LEADImage1.JBIG2Flags:= LEADDlgFile1.SaveJBIG2Flags; 

         LEADImage1.Save(LEADDlgFile1.FileName, 
                         LEADDlgFile1.SaveFormat, 
                         1, 
                         0, 
                         0); 
      end; 
   end; 
end;