Copy link to clipboard
Copied
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#
Have something to add?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now