Example usage for java.awt.print PageFormat getOrientation

List of usage examples for java.awt.print PageFormat getOrientation

Introduction

In this page you can find the example usage for java.awt.print PageFormat getOrientation.

Prototype

public int getOrientation() 

Source Link

Document

Returns the orientation of this PageFormat .

Usage

From source file:be.fedict.eidviewer.gui.printing.IDPrintout.java

public int print(Graphics graphics, PageFormat pageFormat, int pageNumber) throws PrinterException {
    // we only support printing all in one single page
    if (pageNumber > 0)
        return Printable.NO_SUCH_PAGE;

    logger.finest(new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("width", pageFormat.getWidth()).append("height", pageFormat.getHeight())
            .append("imageableWidth", pageFormat.getImageableWidth())
            .append("imageableHeight", pageFormat.getImageableHeight())
            .append("imageableX", pageFormat.getImageableX()).append("imageableY", pageFormat.getImageableY())
            .append("orientation", pageFormat.getOrientation())
            .append("paper.width", pageFormat.getPaper().getWidth())
            .append("paper.height", pageFormat.getPaper().getHeight())
            .append("paper.imageableWidth", pageFormat.getPaper().getImageableWidth())
            .append("paper.imageableHeight", pageFormat.getPaper().getImageableHeight())
            .append("paper.imageableX", pageFormat.getPaper().getImageableX())
            .append("paper.imageableY", pageFormat.getPaper().getImageableY()).toString());

    logger.finest(new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("clip.width", graphics.getClipBounds().width)
            .append("clip.height", graphics.getClipBounds().height).append("clip.x", graphics.getClipBounds().x)
            .append("clip.y", graphics.getClipBounds().y).toString());

    // translate graphics2D with origin at top left first imageable location
    Graphics2D graphics2D = (Graphics2D) graphics;
    graphics2D.translate(pageFormat.getImageableX(), pageFormat.getImageableY());

    // keep imageable width and height as variables for clarity (we use them often)
    float imageableWidth = (float) pageFormat.getImageableWidth();
    float imageableHeight = (float) pageFormat.getImageableHeight();

    // Coat of Arms images are stored at approx 36 DPI, scale 1/2 to get to Java default of 72DPI
    AffineTransform coatOfArmsTransform = new AffineTransform();
    coatOfArmsTransform.scale(0.5, 0.5);

    // photo images are stored at approx 36 DPI, scale 1/2 to get to Java default of 72DPI
    AffineTransform photoTransform = new AffineTransform();
    photoTransform.scale(0.5, 0.5);/*  w w  w  . j a va2 s  .c  om*/
    photoTransform.translate((imageableWidth * 2) - (photo.getWidth(this)), 0);

    // make sure foreground is black, and draw coat of Arms and photo at the top of the page
    // using the transforms to scale them to 72DPI.
    graphics2D.setColor(Color.BLACK);
    graphics2D.drawImage(coatOfArms, coatOfArmsTransform, null);
    graphics2D.drawImage(photo, photoTransform, null);

    // calculate some sizes that need to take into account the scaling of the graphics, to avoid dragging
    // those non-intuitive "/2" further along in the code.
    float headerHeight = (float) (coatOfArms.getHeight(this)) / 2;
    float coatOfArmsWidth = (float) (coatOfArms.getWidth(this)) / 2;
    float photoWidth = (float) (photo.getWidth(this)) / 2;
    float headerSpaceBetweenImages = imageableWidth
            - (coatOfArmsWidth + photoWidth + (SPACE_BETWEEN_ITEMS * 2));

    logger.finest(new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("headerHeight", headerHeight)
            .append("coatOfArmsWidth", coatOfArmsWidth).append("photoWidth", photoWidth)
            .append("headerSpaceBetweenImages", headerSpaceBetweenImages).toString());

    // get localised strings for card type. We'll take a new line every time a ";" is found in the resource
    String[] cardTypeStr = (bundle.getString("type_" + this.identity.getDocumentType().toString())
            .toUpperCase()).split(";");

    // if a "mention" is present, append it so it appears below the card type string, between brackets

    if (identity.getSpecialOrganisation() != SpecialOrganisation.UNSPECIFIED) {
        String mention = TextFormatHelper.getSpecialOrganisationString(bundle,
                identity.getSpecialOrganisation());
        if (mention != null && !mention.isEmpty()) {
            String[] cardTypeWithMention = new String[cardTypeStr.length + 1];
            System.arraycopy(cardTypeStr, 0, cardTypeWithMention, 0, cardTypeStr.length);
            cardTypeWithMention[cardTypeStr.length] = "(" + mention + ")";
            cardTypeStr = cardTypeWithMention;
        }
    }

    // iterate from MAXIMAL_FONT_SIZE, calculating how much space would be required to fit the card type strings
    // stop when a font size is found where they all fit the space between the graphics in an orderly manner
    boolean sizeFound = false;
    int fontSize;
    for (fontSize = TITLE_MAXIMAL_FONT_SIZE; (fontSize >= MINIMAL_FONT_SIZE) && (!sizeFound); fontSize--) // count down slowly until we find one that fits nicely
    {
        logger.log(Level.FINE, "fontSize=" + fontSize + " sizeFound=" + sizeFound);
        graphics2D.setFont(new Font(FONT, Font.PLAIN, fontSize));
        sizeFound = (ImageUtilities.getTotalStringWidth(graphics2D, cardTypeStr) < headerSpaceBetweenImages)
                && (ImageUtilities.getTotalStringHeight(graphics2D, cardTypeStr) < headerHeight);
    }

    // unless with extremely small papers, a size should always have been found.
    // draw the card type strings, centered, between the images at the top of the page
    if (sizeFound) {
        graphics2D.setFont(new Font(FONT, Font.PLAIN, fontSize + 1));
        float cardTypeHeight = cardTypeStr.length * ImageUtilities.getStringHeight(graphics2D);
        float cardTypeBaseLine = ((headerHeight - cardTypeHeight) / 2) + ImageUtilities.getAscent(graphics2D);
        float cardTypeLineHeight = ImageUtilities.getStringHeight(graphics2D);

        logger.finest(new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("cardTypeHeight", cardTypeHeight).append("cardTypeBaseLine", cardTypeBaseLine)
                .append("cardTypeLineHeight", cardTypeLineHeight).toString());

        for (int i = 0; i < cardTypeStr.length; i++) {
            float left = (coatOfArmsWidth + SPACE_BETWEEN_ITEMS
                    + (headerSpaceBetweenImages - ImageUtilities.getStringWidth(graphics2D, cardTypeStr[i]))
                            / 2);
            float leading = (float) cardTypeLineHeight * i;
            graphics2D.drawString(cardTypeStr[i], left, cardTypeBaseLine + leading);
        }
    }

    // populate idAttributes with all the information from identity and address
    // as well as date printed and some separators
    List<IdentityAttribute> idAttributes = populateAttributeList();

    // draw a horizontal line just below the header (images + card type titles)
    graphics2D.drawLine(0, (int) headerHeight, (int) imageableWidth, (int) headerHeight);

    // calculate how much space is left between the header and the bottom of the imageable area

    headerHeight += 32; // take some distance from header

    float imageableDataHeight = imageableHeight - headerHeight;
    float totalDataWidth = 0, totalDataHeight = 0;
    float labelWidth, widestLabelWidth = 0;
    float valueWidth, widestValueWidth = 0;

    // iterate from MAXIMAL_FONT_SIZE, calculating how much space would be required to fit the information in idAttributes into
    // the space between the header and the bottom of the imageable area
    // stop when a font size is found where it all fits in an orderly manner
    sizeFound = false;
    for (fontSize = MAXIMAL_FONT_SIZE; (fontSize >= MINIMAL_FONT_SIZE) && (!sizeFound); fontSize--) // count down slowly until we find one that fits nicely
    {
        logger.log(Level.FINE, "fontSize=" + fontSize + " sizeFound=" + sizeFound);
        graphics2D.setFont(new Font(FONT, Font.PLAIN, fontSize));

        widestLabelWidth = 0;
        widestValueWidth = 0;

        for (IdentityAttribute attribute : idAttributes) {
            if (attribute == SEPARATOR)
                continue;

            labelWidth = ImageUtilities.getStringWidth(graphics2D, attribute.getLabel());
            valueWidth = ImageUtilities.getStringWidth(graphics2D, attribute.getValue());
            if (labelWidth > widestLabelWidth)
                widestLabelWidth = labelWidth;
            if (valueWidth > widestValueWidth)
                widestValueWidth = valueWidth;
        }

        totalDataWidth = widestLabelWidth + SPACE_BETWEEN_ITEMS + widestValueWidth;
        totalDataHeight = ImageUtilities.getStringHeight(graphics2D)
                + (ImageUtilities.getStringHeight(graphics2D) * idAttributes.size());

        if ((totalDataWidth < imageableWidth) && (totalDataHeight < imageableDataHeight))
            sizeFound = true;
    }

    logger.finest(new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("widestLabelWidth", widestLabelWidth).append("widestValueWidth", widestValueWidth)
            .append("totalDataWidth", totalDataWidth).append("totalDataHeight", totalDataHeight).toString());

    // unless with extremely small papers, a size should always have been found.
    // draw the identity, addess and date printed information, in 2 columns, centered inside the
    // space between the header and the bottom of the imageable area
    if (sizeFound) {
        graphics2D.setFont(new Font(FONT, Font.PLAIN, fontSize));
        float labelsLeft = (imageableWidth - totalDataWidth) / 2;
        float valuesLeft = labelsLeft + widestLabelWidth + SPACE_BETWEEN_ITEMS;
        float dataLineHeight = ImageUtilities.getStringHeight(graphics2D);
        float dataTop = dataLineHeight + headerHeight + ((imageableDataHeight - totalDataHeight) / 2);
        float lineNumber = 0;

        logger.finest(new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("labelsLeft", labelsLeft)
                .append("valuesLeft", valuesLeft).append("dataLineHeight", dataLineHeight)
                .append("dataTop", dataTop).toString());

        for (IdentityAttribute attribute : idAttributes) {
            if (attribute != SEPARATOR) // data
            {
                graphics2D.setColor(attribute.isRelevant() ? Color.BLACK : Color.LIGHT_GRAY);
                graphics2D.drawString(attribute.getLabel(), labelsLeft,
                        dataTop + (lineNumber * dataLineHeight));
                graphics2D.drawString(attribute.getValue(), valuesLeft,
                        dataTop + (lineNumber * dataLineHeight));
            } else // separator
            {
                int y = (int) (((dataTop + (lineNumber * dataLineHeight) + (dataLineHeight / 2)))
                        - ImageUtilities.getAscent(graphics2D));
                graphics2D.setColor(Color.BLACK);
                graphics2D.drawLine((int) labelsLeft, y, (int) (labelsLeft + totalDataWidth), y);
            }
            lineNumber++;
        }
    }

    // tell Java printing that all this makes for a page worth printing :-)
    return Printable.PAGE_EXISTS;
}

From source file:PageFormatFactory.java

/**
 * Tests, whether the given two page format objects are equal.
 *
 * @param pf1 the first page format that should be compared.
 * @param pf2 the second page format that should be compared.
 * @return true, if both page formats are equal, false otherwise.
 *///from   w w  w. j ava 2 s  .  c  o  m
public static boolean isEqual(final PageFormat pf1, final PageFormat pf2) {
    if (pf1 == pf2) {
        return true;
    }
    if (pf1 == null || pf2 == null) {
        return false;
    }

    if (pf1.getOrientation() != pf2.getOrientation()) {
        return false;
    }
    final Paper p1 = pf1.getPaper();
    final Paper p2 = pf2.getPaper();

    if (p1.getWidth() != p2.getWidth()) {
        return false;
    }
    if (p1.getHeight() != p2.getHeight()) {
        return false;
    }
    if (p1.getImageableX() != p2.getImageableX()) {
        return false;
    }
    if (p1.getImageableY() != p2.getImageableY()) {
        return false;
    }
    if (p1.getImageableWidth() != p2.getImageableWidth()) {
        return false;
    }
    if (p1.getImageableHeight() != p2.getImageableHeight()) {
        return false;
    }
    return true;
}

From source file:PageFormatFactory.java

/**
 * Resolves a page format, so that the result can be serialized.
 *
 * @param format the page format that should be prepared for serialisation.
 * @return the prepared page format data.
 * @deprecated This functionality is part of JCommon-Serializer
 *///from  ww  w  .j  a va2  s .  c  o m
public Object[] resolvePageFormat(final PageFormat format) {
    final Integer orientation = new Integer(format.getOrientation());
    final Paper p = format.getPaper();
    final float[] fdim = new float[] { (float) p.getWidth(), (float) p.getHeight() };
    final float[] rect = new float[] { (float) p.getImageableX(), (float) p.getImageableY(),
            (float) p.getImageableWidth(), (float) p.getImageableHeight() };
    return new Object[] { orientation, fdim, rect };
}

From source file:org.pentaho.reporting.engine.classic.core.modules.parser.bundle.layout.PageDefinitionReadHandler.java

/**
 * Handles the page format.//ww  w.  j a v a 2  s .  c om
 *
 * @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;
}

From source file:org.pentaho.reporting.engine.classic.core.modules.parser.ext.readhandlers.PageReadHandler.java

/**
 * Handles the page format.//from   w  ww .  j  a v a2 s  .  co m
 *
 * @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;
}

From source file:org.pentaho.reporting.engine.classic.core.modules.parser.simple.readhandlers.JFreeReportReadHandler.java

/**
 * Starts parsing.//from w w  w  . j  ava  2 s  .  co  m
 *
 * @param attrs
 *          the attributes.
 * @throws org.xml.sax.SAXException
 *           if there is a parsing error.
 * @noinspection SuspiciousNameCombination
 */
protected void startParsing(final PropertyAttributes attrs) throws SAXException {
    RootXmlReadHandler rootHandler = getRootHandler();
    final Object maybeReport = rootHandler.getHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME);
    final MasterReport report;
    if (maybeReport instanceof MasterReport == false) {
        // replace it ..
        report = new MasterReport();
        report.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.SOURCE, rootHandler.getSource());
    } else {
        report = (MasterReport) maybeReport;
    }

    final int groupCount = report.getGroupCount();
    for (int i = 0; i < groupCount; i++) {
        final Group g = report.getGroup(i);
        if (g instanceof RelationalGroup) {
            groupList.add((RelationalGroup) g);
        } else {
            throw new ParseException("The existing report contains non-default groups. "
                    + "This parser cannot handle such a construct.");
        }
    }

    final RootXmlReadHandler parser = rootHandler;
    if (ReportParserUtil.isIncluded(parser) == false) {
        final String query = attrs.getValue(getUri(), "query");
        if (query != null) {
            report.setQuery(query);
        }

        final String name = attrs.getValue(getUri(), JFreeReportReadHandler.NAME_ATT);
        if (name != null) {
            report.setName(name);
        }

        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, attrs);

        defTopMargin = ParserUtil.parseFloat(attrs.getValue(getUri(), JFreeReportReadHandler.TOPMARGIN_ATT),
                defTopMargin);
        defBottomMargin = ParserUtil
                .parseFloat(attrs.getValue(getUri(), JFreeReportReadHandler.BOTTOMMARGIN_ATT), defBottomMargin);
        defLeftMargin = ParserUtil.parseFloat(attrs.getValue(getUri(), JFreeReportReadHandler.LEFTMARGIN_ATT),
                defLeftMargin);
        defRightMargin = ParserUtil.parseFloat(attrs.getValue(getUri(), JFreeReportReadHandler.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:
            throw new IllegalStateException("Unexpected paper orientation.");
        }

        final int pageSpan = ParserUtil.parseInt(attrs.getValue(getUri(), JFreeReportReadHandler.PAGESPAN_ATT),
                1);

        format.setPaper(p);
        report.setPageDefinition(new SimplePageDefinition(format, pageSpan, 1));
    }
    if (rootHandler.getHelperObject(ReportParserUtil.HELPER_OBJ_LEGACY_STYLES) instanceof HashMap == false) {
        rootHandler.setHelperObject(ReportParserUtil.HELPER_OBJ_LEGACY_STYLES,
                new HashMap<String, ElementStyleSheet>());
    }
    rootHandler.setHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME, report);

    final String useMinChunkWidth = attrs.getValue(getUri(), "use-min-chunkwidth");
    if (useMinChunkWidth != null) {
        report.getStyle().setStyleProperty(ElementStyleKeys.USE_MIN_CHUNKWIDTH,
                ReportParserUtil.parseBoolean(useMinChunkWidth, getLocator()));
    }

    report.setCompatibilityLevel(ClassicEngineBoot.computeVersionId(3, 8, 0));
    this.report = report;
}

From source file:org.pentaho.reporting.engine.classic.core.util.PageFormatFactory.java

public static String printPageFormat(final PageFormat pf) {
    StringBuffer b = new StringBuffer();
    b.append("PageFormat={width=");
    b.append(pf.getWidth());//from  ww  w .j a va 2  s  .c o  m
    b.append(", height=");
    b.append(pf.getHeight());
    b.append(", imageableX=");
    b.append(pf.getImageableX());
    b.append(", imageableY=");
    b.append(pf.getImageableY());
    b.append(", imageableWidth=");
    b.append(pf.getImageableWidth());
    b.append(", imageableHeight=");
    b.append(pf.getImageableHeight());
    b.append(", orientation=").append(pf.getOrientation());
    b.append(", paper=");
    b.append(printPaper(pf.getPaper()));
    b.append("}");
    return b.toString();
}

From source file:org.pentaho.reporting.engine.classic.extensions.modules.java14print.Java14PrintUtil.java

/**
 * This method replaces the media definition from the given attribute set with the one found in the report itself.
 * <p/>/* w w w .  j a  va 2  s .c o m*/
 * If no JobName is set, a default jobname will be assigned.
 *
 * @param attributes
 * @param report
 * @return
 */
public static PrintRequestAttributeSet copyConfiguration(PrintRequestAttributeSet attributes,
        final MasterReport report) {
    if (attributes == null) {
        attributes = new HashPrintRequestAttributeSet();
    }

    // for now, be lazy, assume that the first page is the reference
    final PageDefinition pdef = report.getPageDefinition();
    final PageFormat format = pdef.getPageFormat(0);
    final Paper paper = format.getPaper();

    final Media media = MediaSize.findMedia((float) (paper.getWidth() / POINTS_PER_INCH),
            (float) (paper.getHeight() / POINTS_PER_INCH), Size2DSyntax.INCH);
    attributes.add(media);

    final MediaPrintableArea printableArea = new MediaPrintableArea(
            (float) (paper.getImageableX() / POINTS_PER_INCH),
            (float) (paper.getImageableY() / POINTS_PER_INCH),
            (float) (paper.getImageableWidth() / POINTS_PER_INCH),
            (float) (paper.getImageableHeight() / POINTS_PER_INCH), Size2DSyntax.INCH);

    attributes.add(printableArea);
    attributes.add(mapOrientation(format.getOrientation()));

    return attributes;
}