<commit_before>[[ch-rotation]]
= Rotation of contents


Objects that are output with `<PlaceObject>` can be rotated.
For this purpose, there is the attribute `rotate`, which expects an angle (in degrees), whereas positive values cause a clockwise rotation.

[source, xml,indent=0]
-------------------------------------------------------------------------------
    <PlaceObject rotate="10">
      <Image file="_sampleb.pdf" width="3"/>
    </PlaceObject>
-------------------------------------------------------------------------------

When an object is rotated, you need to specify the point around which it should rotate.
The default setting is the upper left corner.
With the attributes `origin-x` (`left`, `center` and `right`) and `origin-y` (`top`, `center`, `bottom`) you can define the axis of rotation.
In addition to these values, numbers from 0 to 100 are also possible, the upper left corner is 0, 0 and the lower right corner is 100, 100.


[[fig-rotateimages]]
.The image is rotated by 10 degrees. A negative value would make the rotation counterclockwise.
image::rotieren.png[width=40%]

TIP: In https://github.com/speedata/examples/[examples repository on github] there is a document in the `technical` directory which shows the effect of `origin-x` and `origin-y`.

[discrete]
== Rotate images

The attribute `rotate` is available for both `<PlaceObject>` and `<Image>`. The attribute at `<Image>` can only rotate images in 90° steps. Therefore, in practice the rotation is rather controlled by `<PlaceObject>`.


[discrete]<commit_msg>D: clarify rotation in image<commit_after>[[ch-rotation]]
= Rotation of contents


Objects that are output with `<PlaceObject>` can be rotated.
For this purpose, there is the attribute `rotate`, which expects an angle (in degrees), whereas positive values cause a clockwise rotation.

[source, xml,indent=0]
-------------------------------------------------------------------------------
    <PlaceObject rotate="10">
      <Image file="_sampleb.pdf" width="3"/>
    </PlaceObject>
-------------------------------------------------------------------------------

When an object is rotated, you need to specify the point around which it should rotate.
The default setting is the upper left corner.
With the attributes `origin-x` (`left`, `center` and `right`) and `origin-y` (`top`, `center`, `bottom`) you can define the axis of rotation.
In addition to these values, numbers from 0 to 100 are also possible, the upper left corner is 0, 0 and the lower right corner is 100, 100.


[[fig-rotateimages]]
.The image is rotated by 10 degrees. A negative value would make the rotation counterclockwise.
image::rotieren.png[width=40%]

TIP: In https://github.com/speedata/examples/[examples repository on github] there is a document in the `technical` directory which shows the effect of `origin-x` and `origin-y`.

[discrete]
== Rotate images

The attribute `rotate` is available for both `<PlaceObject>` and `<Image>`. The attribute at `<Image>` can only rotate images in 90° steps. Therefore, in practice the rotation is rather controlled by `<PlaceObject>`.

Depending on what you are aiming at, rotation should be applied directly to the image `<Image>` or to the `<PlaceObject>` element.

This minimal sample shows the difference:

[source, xml,indent=0]
-------------------------------------------------------------------------------
<Layout xmlns="urn:speedata.de:2009/publisher/en"
  xmlns:sd="urn:speedata:2009/publisher/functions/en">

  <Record element="data">
    <PlaceObject rotate="-90">
      <Image file="_sampleb.pdf" width="3cm"/>
    </PlaceObject>
    <ClearPage/>
    <PlaceObject>
      <Image file="_sampleb.pdf" width="3cm"  rotate="-90"/>
    </PlaceObject>
  </Record>
</Layout>
-------------------------------------------------------------------------------

Bear in mind that this rotation might also affect to some given image dimensions.

[discrete]
{'fraction_non_alphanumeric': 0.21563136456211812, 'fraction_numerical': 0.015020366598778005, 'mean_word_length': 2.58485401459854, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 32, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7379221', 'n_tokens_mistral': 1048, 'n_tokens_neox': 958, 'n_words': 442}