Access Denied error TiffSaveMultiPageToFile

Some other discussions. Feel free to post anything here !
Post Reply
Dabi123
Posts: 22
Joined: Mon Apr 28, 2008 9:28 pm

Access Denied error TiffSaveMultiPageToFile

Post by Dabi123 » Tue Feb 25, 2014 6:51 pm

Hello, Sorry for the double posting but I submitted a post in the wrong thread. So I am reposting it here.
I am trying to manipulate files (rip pages from one file to another).
I have a form, and have 2 panes with each pane having a thumbnail and a gdviewer object.
I am dragging selected thumbnails from the left pane and dropping it onto the right thumbnail hoping that the pages will be deleted from the left and inserted into the right pane.
It seems to work fne, but when I want to save the file, I get an accessDenied error and the changes are not getting saved. Can you please suggest / provide an example of how to go about it.
I want to overwrite the files with the changes.

Regards,

Code: Select all

iLImageID = fromGdImaging.TiffCreateMultiPageFromFile(sender.DocName);
iRImageID = toGdImaging.TiffCreateMultiPageFromFile(receiver.DocName);
for(int pgNo=0; pgNo < selectedIndex.Count ; pgNo++)
{
    fromGdImaging.TagsSetPreserve(true);
    fromGdImaging.TiffSelectPage(iLImageID, (int)selectedIndex[pgNo]+1);
      for (int tagNo = 1; tagNo <= fromGdImaging.TagCount(iLImageID); tagNo++)
        {
                  if (fromGdImaging.TagGetName(iLImageID, tagNo).Contains("ImageDescription"))
                                exifTag = fromGdImaging.TagGetValueString(iLImageID, tagNo);
        }
        if (!string.IsNullOrEmpty(exifTag))
                 iPageIDL = Helper.GetExifTagPageID(exifTag);
        bool bValidPageID = DB.IsValidPageID(IEGlobal.DocsConnString, iPageIDL);
        if (!bValidPageID || receiver.DocID > 0)
                     iPageIDR = DB.SetPageMetadata(IEGlobal.DocsConnString, receiver.DocID, receiver.DocName, UserName);
        else
                      iPageIDR = iPageIDL;
        exifTag = Helper.FormExifTag(exifTag, iPageIDR);
        fromGdImaging.TagSetValueString(iLImageID, Tags.TagImageDescription, TagType.TagTypeASCII, exifTag);  
        fromGdImaging.SaveAsTIFF(iLImageID, tempFile, TiffCompression.TiffCompressionCCITT4);
        if (!System.IO.File.Exists(receiver.DocName) || toGdImaging.TiffGetPageCount(iRImageID) == 0)
                       iRImageID = toGdImaging.TiffCreateMultiPageFromFile(tempFile);
        else
                       toGdImaging.TiffInsertPageFromFile(iRImageID, itemDestIdx, tempFile);
  }
  toGdImaging.TiffSaveMultiPageToFile(iRImageID, receiver.DocName, TiffCompression.TiffCompressionCCITT4);
  toGdImaging.ReleaseGdPictureImage(iRImageID); 
  int idx;
  int[] sortedIndex = (int[])selectedIndex.ToArray(typeof(int));
  int[] reverseSort = (from element in sortedIndex orderby element descending select element).ToArray();
  for (int pgNo = 0; pgNo < reverseSort.Length; pgNo++)
  {
                    idx = (int)selectedIndex[pgNo];
                     if (fromThumb.GetItemSelectState(idx))
                    {
                           fromGdImaging.TiffDeletePage(iLImageID, (int)selectedIndex[pgNo] + 1);
                           fromThumb.RemoveItem(idx);
                    }
 }
 fromGdImaging.TiffSaveMultiPageToFile(iLImageID, sender.DocName, TiffCompression.TiffCompressionCCITT4);
 if (fromGdImagingCopy.TiffGetPageCount(iLImageID) == 0)
 {
                    fromGdImaging.ReleaseGdPictureImage(iLImageID);
                    System.IO.File.Delete(sender.DocName);
 }
 else
                    fromGdImaging.ReleaseGdPictureImage(iLImageID);

Dabi123
Posts: 22
Joined: Mon Apr 28, 2008 9:28 pm

Re: Access Denied error TiffSaveMultiPageToFile

Post by Dabi123 » Thu Feb 27, 2014 11:28 pm

How do you save the changes to a file? I manipulate the file (delete pages, reorder them etc) and then would like to save the changes. When I use the command TiffSaveMultiPageToFile it errors out saying "Access Denied".

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest