Quantcast
Viewing all articles
Browse latest Browse all 3131

Rotation of image generated by pdf

   Hi Team,

I am rotating a pdf document page but if I rotate for the first time by 90 it works fine. next time if I rotate the same page by 90 it should get rotated by 180 because it was already at 90 rotation but it does not rotate.below is my code.

PageCollection pageCollection = pdfDocument.getPages();

// Rotate the page if necessary

for (WipDocumentPage wipDocumentPage : wipDocument

.getDocumentPages()) {

int rotationCount = Collections.frequency(

wipDocumentPage.getPageActions(),

"rotate");

log.debug("going to rotate pages " + rotationCount);

if (rotationCount > 3) {

rotationCount -= 4;

}

if (rotationCount == 1) {

pageCollection.get_Item(wipDocumentPage.getPageNumber())

.setRotate(com.aspose.pdf.Rotation.

on90);

}

if (rotationCount == 2) {

pageCollection.get_Item(wipDocumentPage.getPageNumber())

.setRotate(com.aspose.pdf.Rotation.

on180);

}

if (rotationCount == 3) {

pageCollection.get_Item(wipDocumentPage.getPageNumber())

.setRotate(com.aspose.pdf.Rotation.

on270);

}

}

 

I am attaching the test file.

Can you please help.


Viewing all articles
Browse latest Browse all 3131

Trending Articles