}else{
width=desktopPane.getWidth();
height=desktopPane.getHeight();
}
PdfPageData pageData = decode_pdf.getPdfPageData();
int cw,ch,raw_rotation=0;
if (decode_pdf.getDisplayView()==Display.FACING)
raw_rotation=pageData.getRotation(commonValues.getCurrentPage());
boolean isRotated = (rotation+raw_rotation)%180==90;
PageOffsets offsets = (PageOffsets)decode_pdf.getExternalHandler(Options.CurrentOffset);
switch(decode_pdf.getDisplayView()) {
case Display.CONTINUOUS_FACING:
if (isRotated) {
cw = offsets.getMaxH()*2;
ch = offsets.getMaxW();
}else{
cw = offsets.getMaxW()*2;
ch = offsets.getMaxH();
}
break;
case Display.CONTINUOUS:
if (isRotated) {
cw = offsets.getMaxH();
ch = offsets.getMaxW();
}else{
cw = offsets.getMaxW();
ch = offsets.getMaxH();
}
break;
case Display.FACING:
int leftPage;
if (currentCommands.getPages().getSeparateCover()) {
leftPage = (commonValues.getCurrentPage()/2)*2;
if (commonValues.getPageCount() == 2)
leftPage = 1;
} else {
leftPage = commonValues.getCurrentPage();
if ((leftPage & 1)==0)
leftPage--;
}
if (isRotated) {
cw = pageData.getCropBoxHeight(leftPage);
//if first or last page double the width, otherwise add other page width
if (leftPage+1 > commonValues.getPageCount() || leftPage == 1)
cw = cw * 2;
else
cw += pageData.getCropBoxHeight(leftPage+1);
ch = pageData.getCropBoxWidth(leftPage);
if (leftPage+1 <= commonValues.getPageCount() && ch < pageData.getCropBoxWidth(leftPage+1))
ch = pageData.getCropBoxWidth(leftPage+1);
}else{
cw = pageData.getCropBoxWidth(leftPage);
//if first or last page double the width, otherwise add other page width
if (leftPage+1 > commonValues.getPageCount())
cw = cw * 2;
else
cw += pageData.getCropBoxWidth(leftPage+1);
ch = pageData.getCropBoxHeight(leftPage);
if (leftPage+1 <= commonValues.getPageCount() && ch < pageData.getCropBoxHeight(leftPage+1))
ch = pageData.getCropBoxHeight(leftPage+1);
}
break;
default:
if (isRotated) {
cw = pageData.getCropBoxHeight(commonValues.getCurrentPage());
ch = pageData.getCropBoxWidth(commonValues.getCurrentPage());
}else{
cw = pageData.getCropBoxWidth(commonValues.getCurrentPage());
ch = pageData.getCropBoxHeight(commonValues.getCurrentPage());
}
}
//Add space at the bottom for pageFlow
if (decode_pdf.getDisplayView()==Display.PAGEFLOW)