Skip to main content
November 24, 2016
Question

Release all object to clear memory

  • November 24, 2016
  • 0 replies
  • 489 views

Hello All,

I am using below code (c# .Net) to rotate a page in pdf file and save it

        AcroAVDoc sourceDocument;

        AcroAVPageView pageView;

        AcroPDPage page;

        AcroPDDoc pdfDoc;

 

  sourceDocument.OpenInWindowEx(imageFile,

                                                 this.pdfViewer.Handle.ToInt32(),

                                                 (int)Acrobat.AVOpenParams.AV_EXTERNAL_VIEW,

                                                 1,

                                                 0,

                                                 (short)Acrobat.PDViewMode.PDUseNone,

                                                 (short)Acrobat.AVZoomType.AVZoomFitPage,

                                                 100,

                                                 1,

                                                 1

                                               );

  pageView = sourceDocument.GetAVPageView();

  page = pageView.GetPage();

  short degree = (short)(page.GetRotate() + 90);

   page.SetRotate(degree >= 360 ? (short)(((degree / 90) - 4) * 90) : degree);

  pdfDoc = sourceDocument.GetPDDoc();

  pdfDoc.Save((short)Acrobat.PDSaveFlags.PDSaveFull, imageFile);

  pdfDoc.Close();

And it is working fine.

but now I need to release all objects of acrobat as I need to move this file to another location

but I am not able to do this as is it showing file is already open in another process

I tried some code like below to release object memory

                        sourceDocument.ClearSelection();

                        sourceDocument.Close(1);

                        pdfDoc.Close();

  But it is not working I think AcroPDPage object memory is not releasing properly and still I can see a background task of acrobat in task manager

  please tell me how we can release all objects memory using c#

This topic has been closed for replies.