Question
Some documents were rotated when they shouldn't.
How to rotate documents based on portrait layout or depending on text orientation?
Answer
To achieve this it's required to add the additional script to Workflow of DocumentProcessing type:
Use the following code to rotate depending on resolution:
for(int i=0;i<Document.Pages.Count;i++ )
if(Document.Pages[i].Picture.Height < Document.Pages[i].Picture.Width){
IEditablePictureObject editablePicture = Document.Pages[i].Picture.CreateEditableCopy();
editablePicture.Rotate(90);
Document.Pages[i].ReplaceImage(editablePicture);
}
Or this one to rotate the image depending on English text orientation:
for(int i=0;i<Document.Pages.Count;i++ ) { IEditablePictureObject editablePicture = Document.Pages[i].Picture.CreateEditableCopy(); int page_rotation = Document.Pages[i].Picture.DetectPageOrientation("English"); editablePicture.Rotate(page_rotation*(-1)); Document.Pages[i].ReplaceImage(editablePicture); }
Comments
2 comments
yong_lee7015
But for me , I can't find the script functions in work flow stage . it is related to my version?
yong_lee7015
I found it,it works ,thanks
Please sign in to leave a comment.