Page 1 of 1

Access Denied error TiffSaveMultiPageToFile

Posted: Tue Feb 25, 2014 6:51 pm
by Dabi123
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.


Code: Select all

iLImageID = fromGdImaging.TiffCreateMultiPageFromFile(sender.DocName);
iRImageID = toGdImaging.TiffCreateMultiPageFromFile(receiver.DocName);
for(int pgNo=0; pgNo < selectedIndex.Count ; pgNo++)
    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);
                      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);
                       toGdImaging.TiffInsertPageFromFile(iRImageID, itemDestIdx, tempFile);
  toGdImaging.TiffSaveMultiPageToFile(iRImageID, receiver.DocName, TiffCompression.TiffCompressionCCITT4);
  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);
 fromGdImaging.TiffSaveMultiPageToFile(iLImageID, sender.DocName, TiffCompression.TiffCompressionCCITT4);
 if (fromGdImagingCopy.TiffGetPageCount(iLImageID) == 0)

Re: Access Denied error TiffSaveMultiPageToFile

Posted: Thu Feb 27, 2014 11:28 pm
by Dabi123
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".