下面列出了java.awt.print.PageFormat#PORTRAIT 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* This describes a <code>PageFormat</code> as a String. This is provided as
* a debugging tool, because <code>PageFormat.toString()</code> doesn't
* support this itself.
*/
public static String toString(PageFormat f) {
if (f == null)
return "null";
String orientation;
if (f.getOrientation() == PageFormat.LANDSCAPE) {
orientation = "LANDSCAPE";
} else if (f.getOrientation() == PageFormat.PORTRAIT) {
orientation = "PORTRAIT";
} else if (f.getOrientation() == PageFormat.REVERSE_LANDSCAPE) {
orientation = "REVERSE_LANDSCAPE";
} else {
orientation = "UNKNOWN";
}
return ("PageFormat[ " + f.getWidth() + "x" + f.getHeight()
+ " imageable=(" + f.getImageableX() + ", " + f.getImageableY()
+ ", " + f.getImageableWidth() + ", " + f.getImageableHeight()
+ ") orientation=" + orientation + "]");
}
/**
* Sets the orientation for this page. This also validates the imageable
* bounds of the paper.
*
* @param orientation
* must be PageFormat.LANDSCAPE or PageFormat.PORTRAIT
*/
public boolean setOrientation(int orientation) {
if (!(orientation == PageFormat.LANDSCAPE || orientation == PageFormat.PORTRAIT))
throw new IllegalArgumentException(
"orientation must be PageFormat.LANDSCAPE or PageFormat.PORTRAIT");
if (orientation == pageFormat.getOrientation())
return false;
int oldOrientation = pageFormat.getOrientation();
pageFormat.setOrientation(orientation);
firePropertyChange(PROPERTY_ORIENTATION, new Integer(oldOrientation),
new Integer(orientation));
validateImageableBounds();
return true;
}
private void copyPageFormatToFields( final PageFormat pageFormat ) {
final Paper paper = pageFormat.getPaper();
final PageFormatFactory pageFormatFactory = PageFormatFactory.getInstance();
final String formatName = pageFormatFactory.getPageFormatName( paper.getWidth(), paper.getHeight() );
pageFormatBox.setSelectedItem( formatName );
pageWidthField.setText( String.valueOf( paper.getWidth() ) );
pageHeightField.setText( String.valueOf( paper.getHeight() ) );
userDefinedPageSizeBox.setSelected( formatName == null );
preDefinedPageSizeBox.setSelected( formatName != null );
final boolean portraitMode = pageFormat.getOrientation() == PageFormat.PORTRAIT;
portraitModeBox.setSelected( portraitMode );
landscapeModeBox.setSelected( portraitMode == false );
if ( portraitMode ) {
marginLeftField.setText( String.valueOf( pageFormatFactory.getLeftBorder( paper ) ) );
marginTopField.setText( String.valueOf( pageFormatFactory.getTopBorder( paper ) ) );
marginRightField.setText( String.valueOf( pageFormatFactory.getRightBorder( paper ) ) );
marginBottomField.setText( String.valueOf( pageFormatFactory.getBottomBorder( paper ) ) );
} else {
marginTopField.setText( String.valueOf( pageFormatFactory.getLeftBorder( paper ) ) );
marginLeftField.setText( String.valueOf( pageFormatFactory.getBottomBorder( paper ) ) );
marginBottomField.setText( String.valueOf( pageFormatFactory.getRightBorder( paper ) ) );
marginRightField.setText( String.valueOf( pageFormatFactory.getTopBorder( paper ) ) );
}
}
public static void setPageFormat(String name, PageFormat pageFormat) {
Properties properties = getProperties(name);
switch (pageFormat.getOrientation()) {
case PageFormat.LANDSCAPE:
properties.setProperty(ORIENTATION, LANDSCAPE);
break;
case PageFormat.PORTRAIT:
properties.setProperty(ORIENTATION, PORTRAIT);
break;
case PageFormat.REVERSE_LANDSCAPE:
properties.setProperty(ORIENTATION, REVERSE_LANDSCAPE);
break;
default:
properties.setProperty(ORIENTATION, "EMPTY");
}
;
final Paper paper = pageFormat.getPaper();
properties.setProperty(PAPER_IMAGEABLE_HEIGHT, Double.toString(paper
.getImageableHeight()));
properties.setProperty(PAPER_IMAGEABLE_WIDTH, Double.toString(paper
.getImageableWidth()));
properties.setProperty(PAPER_IMAGEABLE_X, Double.toString(paper
.getImageableX()));
properties.setProperty(PAPER_IMAGEABLE_Y, Double.toString(paper
.getImageableY()));
properties
.setProperty(PAPER_HEIGHT, Double.toString(paper.getHeight()));
properties.setProperty(PAPER_WIDTH, Double.toString(paper.getWidth()));
}
public int getPageCount() {
int res = 0;
for (int index = 0; index < painters.length; index++) {
PIDEF0painter painter = getPainter(index);
res += painter.hPageCount;
}
if (getPageFormat().getOrientation() == PageFormat.PORTRAIT)
res = (int) Math.ceil((double) res / 2.d);
return res;
}
private void validateImageableBounds() {
Rectangle2D insetsBased;
if (getOrientation() == PageFormat.PORTRAIT) {
insetsBased = new Rectangle2D.Double(insets.left, insets.top,
getPaperWidth() - insets.left - insets.right,
getPaperHeight() - insets.top - insets.bottom);
} else {
insetsBased = new Rectangle2D.Double(insets.top, insets.left,
getPaperHeight() - insets.top - insets.bottom,
getPaperWidth() - insets.left - insets.right);
}
Rectangle2D sum = insetsBased;
setPaperImageableBounds(sum);
}
private static OrientationRequested mapOrientation( final int orientation ) {
switch ( orientation ) {
case PageFormat.LANDSCAPE:
return OrientationRequested.LANDSCAPE;
case PageFormat.REVERSE_LANDSCAPE:
return OrientationRequested.REVERSE_LANDSCAPE;
case PageFormat.PORTRAIT:
return OrientationRequested.PORTRAIT;
default:
throw new IllegalArgumentException( "The given value is no valid PageFormat orientation." );
}
}
/**
* Handles the page format.
*
* @param atts
* the attributes.
* @throws SAXException
* if a parser error occurs or the validation failed.
* @noinspection SuspiciousNameCombination
*/
private PageFormat configurePageSizeAndMargins( final Attributes atts, PageFormat format ) throws SAXException {
// (1) Grab the existing default ...
float defTopMargin = (float) format.getImageableY();
float defBottomMargin = (float) ( format.getHeight() - format.getImageableHeight() - format.getImageableY() );
float defLeftMargin = (float) format.getImageableX();
float defRightMargin = (float) ( format.getWidth() - format.getImageableWidth() - format.getImageableX() );
// (2) Now configure the new paper-size
format = configurePageSize( format, atts );
// (3) Reconfigure margins as requested
defTopMargin = ParserUtil.parseFloat( atts.getValue( getUri(), "margin-top" ), defTopMargin );
defBottomMargin = ParserUtil.parseFloat( atts.getValue( getUri(), "margin-bottom" ), defBottomMargin );
defLeftMargin = ParserUtil.parseFloat( atts.getValue( getUri(), "margin-left" ), defLeftMargin );
defRightMargin = ParserUtil.parseFloat( atts.getValue( getUri(), "margin-right" ), defRightMargin );
final Paper p = format.getPaper();
switch ( format.getOrientation() ) {
case PageFormat.PORTRAIT:
PageFormatFactory.getInstance().setBorders( p, defTopMargin, defLeftMargin, defBottomMargin, defRightMargin );
break;
case PageFormat.REVERSE_LANDSCAPE:
PageFormatFactory.getInstance().setBorders( p, defLeftMargin, defBottomMargin, defRightMargin, defTopMargin );
break;
case PageFormat.LANDSCAPE:
PageFormatFactory.getInstance().setBorders( p, defRightMargin, defTopMargin, defLeftMargin, defBottomMargin );
break;
default:
// will not happen..
throw new IllegalArgumentException( "Unexpected paper orientation." );
}
format.setPaper( p );
return format;
}
/**
* Handles the page format.
*
* @param atts
* the attributes.
* @throws SAXException
* if a parser error occurs or the validation failed.
* @noinspection SuspiciousNameCombination
*/
private void handlePageFormat( final Attributes atts ) throws SAXException {
final MasterReport report =
(MasterReport) getRootHandler().getHelperObject( ReportParserUtil.HELPER_OBJ_REPORT_NAME );
// grab the default page definition ...
PageFormat format = report.getPageDefinition().getPageFormat( 0 );
float defTopMargin = (float) format.getImageableY();
float defBottomMargin = (float) ( format.getHeight() - format.getImageableHeight() - format.getImageableY() );
float defLeftMargin = (float) format.getImageableX();
float defRightMargin = (float) ( format.getWidth() - format.getImageableWidth() - format.getImageableX() );
format = createPageFormat( format, atts );
defTopMargin = ParserUtil.parseFloat( atts.getValue( getUri(), PageReadHandler.TOPMARGIN_ATT ), defTopMargin );
defBottomMargin =
ParserUtil.parseFloat( atts.getValue( getUri(), PageReadHandler.BOTTOMMARGIN_ATT ), defBottomMargin );
defLeftMargin = ParserUtil.parseFloat( atts.getValue( getUri(), PageReadHandler.LEFTMARGIN_ATT ), defLeftMargin );
defRightMargin = ParserUtil.parseFloat( atts.getValue( getUri(), PageReadHandler.RIGHTMARGIN_ATT ), defRightMargin );
final Paper p = format.getPaper();
switch ( format.getOrientation() ) {
case PageFormat.PORTRAIT:
PageFormatFactory.getInstance().setBorders( p, defTopMargin, defLeftMargin, defBottomMargin, defRightMargin );
break;
case PageFormat.LANDSCAPE:
// right, top, left, bottom
PageFormatFactory.getInstance().setBorders( p, defRightMargin, defTopMargin, defLeftMargin, defBottomMargin );
break;
case PageFormat.REVERSE_LANDSCAPE:
PageFormatFactory.getInstance().setBorders( p, defLeftMargin, defBottomMargin, defRightMargin, defTopMargin );
break;
default:
// will not happen..
throw new IllegalArgumentException( "Unexpected paper orientation." );
}
format.setPaper( p );
pageFormat = format;
}
public static void transformSVGIntoPDF(InputStream inputStream, OutputStream outputStream) throws IOException, DocumentException {
Rectangle pageSize = PageSize.A4;
Document document = new Document(pageSize);
int orientation = PageFormat.PORTRAIT;
try {
PdfWriter writer = PdfWriter.getInstance(document, outputStream);
document.open();
double a4WidthInch = 8.26771654; // Equals 210mm
double a4HeightInch = 11.6929134; // Equals 297mm
Paper paper = new Paper();
// 72 DPI
paper.setSize((a4WidthInch * 72), (a4HeightInch * 72));
// 1 inch margins
paper.setImageableArea(72, 72, (a4WidthInch * 72 - 144), (a4HeightInch * 72 - 144));
PageFormat pageFormat = new PageFormat();
pageFormat.setPaper(paper);
pageFormat.setOrientation(orientation);
float width = ((float) pageFormat.getWidth());
float height = ((float) pageFormat.getHeight());
PdfContentByte cb = writer.getDirectContent();
PdfTemplate template = cb.createTemplate(width, height);
Graphics2D g2 = template.createGraphics(width, height);
PrintTranscoder prm = new PrintTranscoder();
TranscoderInput ti = new TranscoderInput(inputStream);
prm.transcode(ti, null);
prm.print(g2, pageFormat, 0);
g2.dispose();
ImgTemplate img = new ImgTemplate(template);
img.setWidthPercentage(100);
img.setAlignment(Image.ALIGN_CENTER);
document.add(img);
} catch (DocumentException e) {
logger.error("Error exporting Highcharts to PDF: " + e);
}
document.close();
}
private void repopulate() {
CustomPaper paper = null;
adjustingPaperSize++;
try {
double width, height;
if (printLayout.getOrientation() == PageFormat.PORTRAIT) {
width = printLayout.getPaperWidth();
height = printLayout.getPaperHeight();
} else {
width = printLayout.getPaperHeight();
height = printLayout.getPaperWidth();
}
widthSpinner.setValue(new Length(width / 72.0, Length.INCH), false);
heightSpinner.setValue(new Length(height / 72.0, Length.INCH),
false);
paperComboBox.removeAllItems();
for (int a = 0; a < CustomPaper.common.length; a++) {
if (Math.abs(width - CustomPaper.common[a].getWidth()) < 1
&& Math.abs(height - CustomPaper.common[a].getHeight()) < 1) {
paper = CustomPaper.common[a];
}
paperComboBox.addItem(CustomPaper.common[a]);
}
if (paper != null) {
paperComboBox.setSelectedItem(paper);
} else {
String s = "Custom...";
paperComboBox.addItem(s);
paperComboBox.setSelectedItem(s);
}
} finally {
adjustingPaperSize--;
}
Insets insets = printLayout.getInsets();
leftSpinner
.setValue(new Length(insets.left / 72.0, Length.INCH), false);
topSpinner.setValue(new Length(insets.top / 72.0, Length.INCH), false);
rightSpinner.setValue(new Length(insets.right / 72.0, Length.INCH),
false);
bottomSpinner.setValue(new Length(insets.bottom / 72.0, Length.INCH),
false);
paddingSpinner.setValue(new Length(
printLayout.getInnerPadding() / 72.0, Length.INCH), false);
landscapeButton
.setSelected(printLayout.getOrientation() == PageFormat.LANDSCAPE);
portraitButton
.setSelected(printLayout.getOrientation() == PageFormat.PORTRAIT);
headerCheckbox.setSelected(printLayout.isHeaderActive());
footerCheckbox.setSelected(printLayout.isFooterActive());
boolean paddingUsed = !(printLayout.getRows() == 1 && printLayout
.getColumns() == 1);
if (printLayout.isHeaderActive()
&& printLayout.getHeader().length() > 0
&& printLayout.getHeader().trim().equals("<html></html>") == false) {
paddingUsed = true;
}
if (printLayout.isFooterActive()
&& printLayout.getFooter().length() > 0
&& printLayout.getFooter().trim().equals("<html></html>") == false) {
paddingUsed = true;
}
paddingLabel.setEnabled(paddingUsed);
paddingSpinner.setEnabled(paddingUsed);
}
public CSSValue createValue( StyleKey name, LexicalUnit value ) {
if ( value.getLexicalUnitType() == LexicalUnit.SAC_IDENT ) {
String ident = value.getStringValue();
if ( ident.equalsIgnoreCase( "auto" ) ) {
return CSSAutoValue.getInstance();
}
final PageSize ps = PageSizeFactory.getInstance().getPageSizeByName( ident );
if ( ps == null ) {
return null;
}
value = value.getNextLexicalUnit();
int pageOrientation = PageFormat.PORTRAIT;
if ( value != null ) {
if ( value.getLexicalUnitType() != LexicalUnit.SAC_IDENT ) {
return null;
}
if ( value.getStringValue().equalsIgnoreCase( "landscape" ) ) {
pageOrientation = PageFormat.LANDSCAPE;
} else if ( value.getStringValue().equalsIgnoreCase( "reverse-landscape" ) ) {
pageOrientation = PageFormat.REVERSE_LANDSCAPE;
} else if ( value.getStringValue().equalsIgnoreCase( "portrait" ) ) {
pageOrientation = PageFormat.PORTRAIT;
} else {
return null;
}
}
if ( pageOrientation == PageFormat.LANDSCAPE ||
pageOrientation == PageFormat.REVERSE_LANDSCAPE ) {
return new CSSValuePair( CSSNumericValue.createPtValue( ps.getHeight() ),
CSSNumericValue.createPtValue( ps.getWidth() ) );
} else {
return new CSSValuePair( CSSNumericValue.createPtValue( ps.getWidth() ),
CSSNumericValue.createPtValue( ps.getHeight() ) );
}
} else {
final CSSNumericValue horizontalWidth = (CSSNumericValue) parseWidth( value );
if ( horizontalWidth == null ) {
return null;
}
value = value.getNextLexicalUnit();
final CSSNumericValue verticalWidth;
if ( value == null ) {
verticalWidth = horizontalWidth;
} else {
verticalWidth = (CSSNumericValue) parseWidth( value );
if ( verticalWidth == null ) {
return null;
}
}
return new CSSValuePair( horizontalWidth, verticalWidth );
}
}
/**
* Compiles a collection of page format properties.
*
* @param fmt
* the pageformat
* @param retval
* the attribute list
* @return The properties.
*/
private static AttributeList buildPageFormatProperties( final PageFormat fmt, final AttributeList retval ) {
if ( fmt == null ) {
throw new NullPointerException();
}
if ( retval == null ) {
throw new NullPointerException();
}
final Paper paper = fmt.getPaper();
final int w = (int) paper.getWidth();
final int h = (int) paper.getHeight();
final String pageDefinition = PageFormatFactory.getInstance().getPageFormatName( w, h );
if ( pageDefinition != null ) {
retval.setAttribute( BundleNamespaces.STYLE, "pageformat", pageDefinition );
} else {
retval.setAttribute( BundleNamespaces.STYLE, "width", String.valueOf( w ) );
retval.setAttribute( BundleNamespaces.STYLE, "height", String.valueOf( h ) );
}
final Insets borders = getBorders( paper );
if ( fmt.getOrientation() == PageFormat.REVERSE_LANDSCAPE ) {
retval.setAttribute( BundleNamespaces.STYLE, "orientation", "reverse-landscape" );
retval.setAttribute( BundleNamespaces.STYLE, "margin-top", String.valueOf( borders.right ) );
retval.setAttribute( BundleNamespaces.STYLE, "margin-left", String.valueOf( borders.top ) );
retval.setAttribute( BundleNamespaces.STYLE, "margin-bottom", String.valueOf( borders.left ) );
retval.setAttribute( BundleNamespaces.STYLE, "margin-right", String.valueOf( borders.bottom ) );
} else if ( fmt.getOrientation() == PageFormat.PORTRAIT ) {
retval.setAttribute( BundleNamespaces.STYLE, "orientation", "portrait" );
retval.setAttribute( BundleNamespaces.STYLE, "margin-top", String.valueOf( borders.top ) );
retval.setAttribute( BundleNamespaces.STYLE, "margin-left", String.valueOf( borders.left ) );
retval.setAttribute( BundleNamespaces.STYLE, "margin-bottom", String.valueOf( borders.bottom ) );
retval.setAttribute( BundleNamespaces.STYLE, "margin-right", String.valueOf( borders.right ) );
} else {
retval.setAttribute( BundleNamespaces.STYLE, "orientation", "landscape" );
retval.setAttribute( BundleNamespaces.STYLE, "margin-top", String.valueOf( borders.left ) );
retval.setAttribute( BundleNamespaces.STYLE, "margin-left", String.valueOf( borders.bottom ) );
retval.setAttribute( BundleNamespaces.STYLE, "margin-bottom", String.valueOf( borders.right ) );
retval.setAttribute( BundleNamespaces.STYLE, "margin-right", String.valueOf( borders.top ) );
}
return retval;
}
/**
* Compiles a collection of page format properties.
*
* @return The properties.
*/
private AttributeList buildPageFormatProperties( final PageFormat fmt ) {
final AttributeList retval = new AttributeList();
final int[] borders = getBorders( fmt.getPaper() );
if ( fmt.getOrientation() == PageFormat.LANDSCAPE ) {
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.ORIENTATION_ATT,
ReportConfigWriter.ORIENTATION_LANDSCAPE_VAL );
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.TOPMARGIN_ATT, String
.valueOf( borders[ReportConfigWriter.RIGHT_BORDER] ) );
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.LEFTMARGIN_ATT, String
.valueOf( borders[ReportConfigWriter.TOP_BORDER] ) );
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.BOTTOMMARGIN_ATT, String
.valueOf( borders[ReportConfigWriter.LEFT_BORDER] ) );
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.RIGHTMARGIN_ATT, String
.valueOf( borders[ReportConfigWriter.BOTTOM_BORDER] ) );
} else if ( fmt.getOrientation() == PageFormat.PORTRAIT ) {
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.ORIENTATION_ATT,
ReportConfigWriter.ORIENTATION_PORTRAIT_VAL );
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.TOPMARGIN_ATT, String
.valueOf( borders[ReportConfigWriter.TOP_BORDER] ) );
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.LEFTMARGIN_ATT, String
.valueOf( borders[ReportConfigWriter.LEFT_BORDER] ) );
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.BOTTOMMARGIN_ATT, String
.valueOf( borders[ReportConfigWriter.BOTTOM_BORDER] ) );
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.RIGHTMARGIN_ATT, String
.valueOf( borders[ReportConfigWriter.RIGHT_BORDER] ) );
} else {
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.ORIENTATION_ATT,
ReportConfigWriter.ORIENTATION_REVERSE_LANDSCAPE_VAL );
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.TOPMARGIN_ATT, String
.valueOf( borders[ReportConfigWriter.LEFT_BORDER] ) );
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.LEFTMARGIN_ATT, String
.valueOf( borders[ReportConfigWriter.BOTTOM_BORDER] ) );
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.BOTTOMMARGIN_ATT, String
.valueOf( borders[ReportConfigWriter.RIGHT_BORDER] ) );
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.RIGHTMARGIN_ATT, String
.valueOf( borders[ReportConfigWriter.TOP_BORDER] ) );
}
final int w = (int) fmt.getPaper().getWidth();
final int h = (int) fmt.getPaper().getHeight();
final String pageDefinition = PageFormatFactory.getInstance().getPageFormatName( w, h );
if ( pageDefinition != null ) {
retval.setAttribute( ExtParserModule.NAMESPACE, ReportConfigWriter.PAGEFORMAT_ATT, pageDefinition );
} else {
retval.setAttribute( ExtParserModule.NAMESPACE, AbstractXMLDefinitionWriter.WIDTH_ATT, String.valueOf( w ) );
retval.setAttribute( ExtParserModule.NAMESPACE, AbstractXMLDefinitionWriter.HEIGHT_ATT, String.valueOf( h ) );
}
return retval;
}
/**
* @param pageDrawable
* @param page
* @noinspection SuspiciousNameCombination
*/
public PhysicalPageDrawable( final LogicalPageDrawable pageDrawable, final PhysicalPageBox page ) {
if ( pageDrawable == null ) {
throw new NullPointerException();
}
if ( page == null ) {
throw new NullPointerException();
}
this.pageDrawable = pageDrawable;
this.globalX = page.getGlobalX();
this.globalY = page.getGlobalY();
final Paper p = new Paper();
final float marginLeft = (float) StrictGeomUtility.toExternalValue( page.getImageableX() );
final float marginRight =
(float) StrictGeomUtility.toExternalValue( page.getWidth() - page.getImageableWidth() - page.getImageableX() );
final float marginTop = (float) StrictGeomUtility.toExternalValue( page.getImageableY() );
final float marginBottom =
(float) StrictGeomUtility.toExternalValue( page.getHeight() - page.getImageableHeight() - page.getImageableY() );
switch ( page.getOrientation() ) {
case PageFormat.PORTRAIT:
p.setSize( StrictGeomUtility.toExternalValue( page.getWidth() ), StrictGeomUtility.toExternalValue( page
.getHeight() ) );
PageFormatFactory.getInstance().setBorders( p, marginTop, marginLeft, marginBottom, marginRight );
break;
case PageFormat.LANDSCAPE:
// right, top, left, bottom
p.setSize( StrictGeomUtility.toExternalValue( page.getHeight() ), StrictGeomUtility.toExternalValue( page
.getWidth() ) );
PageFormatFactory.getInstance().setBorders( p, marginRight, marginTop, marginLeft, marginBottom );
break;
case PageFormat.REVERSE_LANDSCAPE:
p.setSize( StrictGeomUtility.toExternalValue( page.getHeight() ), StrictGeomUtility.toExternalValue( page
.getWidth() ) );
PageFormatFactory.getInstance().setBorders( p, marginLeft, marginBottom, marginRight, marginTop );
break;
default:
// will not happen..
throw new IllegalArgumentException( "Unexpected page-orientation encountered." );
}
this.pageFormat = new PageFormat();
this.pageFormat.setPaper( p );
this.pageFormat.setOrientation( page.getOrientation() );
}