Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watermark (foreground image) is always left-aligned on landscape pages #2528

Closed
nlyubova-psee opened this issue Jun 13, 2024 · 6 comments
Closed
Assignees
Milestone

Comments

@nlyubova-psee
Copy link

Hello,
it seems like Watermark (foreground image) is always left-aligned on landscape pages.

@mojavelinux
Copy link
Member

The size, fit, and position of the foreground (watermark) image is controlled using the pdfwidth, fit, and position attributes on the image macro in the value of the page-foreground-image attribute. For example:

:page-foreground-image: image:watermark[pdfwidth=1in,fit=none,position=top center]

By default, a foreground image is automatically scaled to fit the bounds of the page (i.e., fit=contain) and centered (i.e., position=center).

You can learn more about how these attributes work on the following page: https://docs.asciidoctor.org/pdf-converter/latest/background-images/

I'll update that page to clarify that the size, fit, and position apply to foreground images as well.

@mojavelinux
Copy link
Member

In the future, please direct questions about usage to the project chat first at https://chat.asciidoctor.org.

@mojavelinux mojavelinux added this to the support milestone Jun 13, 2024
@nlyubova-psee
Copy link
Author

nlyubova-psee commented Jun 14, 2024

Ok, Sorry for my request here and Thank you for your answer!
Indeed, the documentation says it should be centered by default, but it was not. I'll try the attributes.

@mojavelinux
Copy link
Member

mojavelinux commented Jun 14, 2024 via email

@nlyubova-psee
Copy link
Author

nlyubova-psee commented Jun 14, 2024

maybe I am doing something wrong.
It works fine for portrait pages but not for landscape pages.

Here is an example
[page-layout=landscape]
<<<

== Possible issues

Here is an example of a landscape image.

[page-layout=portrait]
<<<

image
image

test.zip

@mojavelinux
Copy link
Member

The fact that the layout is being changed back and forth in the document is very important context that was missing from your original report. Your terse report could be interpreted that the watermark was not being centered when the whole document was in landscape. It's always helpful be clear how you are using the feature, and that means providing a reproducible example up front.

You're correct that when you switch the layout, the foreground image is not positioned correctly on pages with a layout which is different from the layout on the first page. That's because the foreground image is being added using a single stamp and that stamp is static.

In order to correct this behavior, there needs to be a foreground image stamp per layout. That's not too difficult, so I will implement it.

@mojavelinux mojavelinux reopened this Jun 14, 2024
@mojavelinux mojavelinux self-assigned this Jun 14, 2024
@mojavelinux mojavelinux modified the milestones: support, v2.3.x Jun 14, 2024
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants