Skip to content

Commit 792b87c

Browse files
committed
PDFBOX-5660: simplify code, as suggested by copilot
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1933110 13f79535-47bb-0310-9956-ffa450edef68
1 parent 10f16df commit 792b87c

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPageable.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,18 @@ public PageFormat getPageFormat(int pageIndex)
187187
//
188188
// As a workaround, we normalise all Page(s) to be portrait, then flag them as landscape in
189189
// the PageFormat.
190-
Paper paper;
190+
Paper paper = new Paper();
191191
boolean isLandscape;
192192
if (mediaBox.getWidth() > mediaBox.getHeight())
193193
{
194194
// rotate
195-
paper = new Paper();
196195
paper.setSize(mediaBox.getHeight(), mediaBox.getWidth());
197196
paper.setImageableArea(cropBox.getLowerLeftY(), cropBox.getLowerLeftX(),
198197
cropBox.getHeight(), cropBox.getWidth());
199198
isLandscape = true;
200199
}
201200
else
202201
{
203-
paper = new Paper();
204202
paper.setSize(mediaBox.getWidth(), mediaBox.getHeight());
205203
paper.setImageableArea(cropBox.getLowerLeftX(), cropBox.getLowerLeftY(),
206204
cropBox.getWidth(), cropBox.getHeight());

0 commit comments

Comments
 (0)