Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, April 2, 2008 11:33:19 PM(UTC)
Mario_Ponti

Groups: Registered
Posts: 6


Hi, I want to ask same question about saving pages into a multipage Tiff. I want to make a code that can insert a whole multipage tiff into another multipage tiff. But the problem is, the addon file page that inserted to  source (main) file are always the first page of the addon file. Could u please help me to find where my mistake(s) is ?

Thanks before :)


here is my source code


   LEADDlgFile1->DlgFileFlags= 0;
   LEADDlgFile1->DialogTitle= "Open A File for Insert";
   LEADDlgFile1->PreviewEnabled= true;
   LEADDlgFile1->LoadPasses= 0;
   LEADDlgFile1->LoadRotated= true;
   LEADDlgFile1->LoadCompressed= false;
   LEADDlgFile1->FileName= "";
   LEADDlgFile1->DlgFlags= DLG_OPEN_LOADBITMAP +
                           DLG_OPEN_SHOW_PROGRESSIVE +
                           DLG_OPEN_SHOW_MULTIPAGE +
                           DLG_OPEN_SHOW_LOADROTATED +
                           DLG_OPEN_SHOW_LOADCOMPRESSED +
                           DLG_OPEN_SHOW_FILEINFO +
                           DLG_OPEN_USEFILESTAMP +
                           DLG_OPEN_SHOW_PREVIEW;

   LEADDlgFile1->LEADImage= LEADImage2;
   L_INT nRet= LEADDlgFile1->ShowOpenDlg (this);
   if(nRet    {
      Application->MessageBox ("Error In Method ", "Error ", MB_OK);
      return;
   }
   if(nRet == SUCCESS_DLG_CANCEL)
      return;

   Screen->Cursor=crHourGlass;

   LEADImage1->GetFileInfo(ImageFilename,100000);

   LEADImage2->SavePage= ItemSelectedIndex + 1;

   totalPage = LEADImage1->InfoTotalPages;

   if (totalPage > 1)
      {
         LEADImage1->Load(LEADDlgFile1->FileName, 0, 1, totalPage);

         for (i=totalPage; i > 0; i--)
         {
            LEADImage1->GetFileInfo(LEADDlgFile1->FileName,i);

            LEADImage2->Save(ImageFilename,
                             LEADImage1->InfoFormat,
                             LEADImage2->BitmapBits,
                             GetProperQualityFactor(LEADImage1->InfoFormat),SAVE_INSERT);
         }
      }
      else
      {
         try
         {
            LEADImage2->Save(ImageFilename,
                             LEADImage1->InfoFormat,
                             LEADImage2->BitmapBits,
                             GetProperQualityFactor(LEADImage1->InfoFormat),SAVE_INSERT);
         }
         catch (ELEADImageError* e)
         {
            AnsiString msg="Save Result = " + IntToStr(LEADImage2->Error);
            Application->MessageBox (msg.c_str (),(char *)"Error ",MB_OK);

            Screen->Cursor=crDefault;
            return;
         }
      }

   Screen->Cursor=crDefault;

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, April 3, 2008 5:47:25 AM(UTC)

Yasir Alani  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)


If you want to add pages to the end of the file you should
use the SAVE_APPEND flag instead of the SAVE_INSERT flag that you are using in your code.


 


If this is not what you mean, please give me more details.

 
#3 Posted : Thursday, April 3, 2008 4:48:56 PM(UTC)
Mario_Ponti

Groups: Registered
Posts: 6


I want to insert the pages in the middle of the multiple page, not at the end of the file.

For example :
* I have a main file that consist of three pages, page 1, 2 & 3.
* and I have an add-on file, that consist of 4 pages, that I want to insert into the main file. The page is A, B, C & D.

The problem is, when I insert the add-on file to the main file, the page that inserted is only the page A (for 4 times).

So, when I want to insert the add-on file on the page 2 of the main file, the result will become :
1, A, A, A, A, 2, 3

the result that I want is 1, A, B, C, D, 2, 3. Can u help me ?


Thank before :)
 
#4 Posted : Thursday, April 3, 2008 9:52:29 PM(UTC)
Mario_Ponti

Groups: Registered
Posts: 6


Hi, I've found the solution



         for (i=totalPage; i > 0; i--)
         {
            temp_bitmap->Load(LEADDlgFile1->FileName, 0, i, 1);

            LEADImage2->InsertBitmapListItem(ItemSelectedIndex+1, temp_bitmap->Bitmap);

            LEADImage2->Save(ImageFilename,
                             temp_bitmap->InfoFormat,
                             LEADImage2->BitmapBits,
                             GetProperQualityFactor(temp_bitmap->InfoFormat),SAVE_INSERT);
         }

 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.091 seconds.