Skip to content

Add bleed support to page layout - #6357

Merged
laurmaedje merged 12 commits into
typst:mainfrom
gabriel-araujjo:feat-page-bleed
May 26, 2026
Merged

laurmaedje merged 12 commits into
typst:mainfrom
gabriel-araujjo:feat-page-bleed

Conversation

@gabriel-araujjo

@gabriel-araujjo gabriel-araujjo commented May 31, 2025 •

Copy link
Copy Markdown
Contributor

This PR adds the bleed option suggested in issue #3131. I have used the existing Margin struct.

@gabriel-araujjo
gabriel-araujjo force-pushed the feat-page-bleed branch 2 times, most recently from 0fb1248 to 61d51bc Compare May 31, 2025 02:52
@laurmaedje laurmaedje added layout Related to the layout category, which is about composing, positioning, etc. pdf Related to PDF export or PDF embedding. interface PRs that add to or change Typst's user-facing interface as opposed to internals or docs changes. labels Jun 4, 2025
@gabriel-araujjo
gabriel-araujjo force-pushed the feat-page-bleed branch 2 times, most recently from 1a094ce to 097a823 Compare June 9, 2025 17:02
@gabriel-araujjo

Copy link
Copy Markdown
Contributor Author

Is there anything blocking this PR from being merged that I can address?

@laurmaedje

Copy link
Copy Markdown
Member

@gabriel-araujjo Nothing to do on your end, I just didn't get to reviewing this yet.

@gabriel-araujjo
gabriel-araujjo force-pushed the feat-page-bleed branch 2 times, most recently from 5f0c5e5 to 1660f63 Compare June 26, 2025 02:06
@laurmaedje
laurmaedje requested a review from reknih July 28, 2025 13:18
@laurmaedje

Copy link
Copy Markdown
Member

From an initial look:

  • It seems a bit inconvenient that the background does not fill the bleed area by default. This means creating a proper bleed-aware background effectively forces you to create a document with overflowing background. Maybe the bleed area should be included in the size used for background and foreground?

  • I think PNG and SVG export should probably not be affected by this as the extra bleed area is only there before trimming during printing, so the canonical final page does not contain the bleed areas

Comment thread crates/typst-pdf/src/convert.rs Resolved
Comment thread crates/typst-library/src/layout/page.rs Resolved
@baptiste

baptiste commented Jul 28, 2025 •

Copy link
Copy Markdown

My 2 cents:

  • I agree that, for me, background and foreground should default to filling the whole area (bleed included). A very common situation – when one cares about bleed at all – is to have fill or images in the background that shouldn't be surrounded by a white border when the paper is cut, and it's natural to say image(width:100%,height:100%) for that to happen, rather than having to compute what 100% + bleed means. And for the foreground, it's a natural placeholder for crop marks and alignment marks etc. that also live in that bleed/trim area.
  • Perhaps it is worth thinking of complementing paper size options with standard untrimmed paper stocks? E.g.,
// Untrimmed paper stock
#let A0U = (880mm , 1230mm)
#let A1U = (625mm , 880mm)
#let A2U = (450mm , 625mm)
#let A3U = (330mm , 450mm)
#let A4U = (240mm , 330mm)
 
// Corresponding trimmed size
#let A0T = (841mm , 1189mm)
#let A1T = (594mm , 841mm)
#let A2T = (420mm , 594mm)
#let A3T = (297mm , 420mm)
#let A4T = (210mm , 297mm)

where perhaps the corresponding bleed might default to the difference? (so that a user selecting set page(paper = "A4U") wouldn't need to worry about doing the calculation, the page content would automatically be set to A4T)

  • While exporting SVG or png probably doesn't need the bleed area to show, it would be useful for the preview on the app to have a toggle to show/hide the bleed area (if nothing else, to preview elements such as the crop marks, registration marks, etc. which might be custom made by the user).

@gabriel-araujjo
gabriel-araujjo force-pushed the feat-page-bleed branch 2 times, most recently from 2430d05 to e25ac84 Compare July 28, 2025 23:46
@gabriel-araujjo

Copy link
Copy Markdown
Contributor Author
  • It seems a bit inconvenient that the background does not fill the bleed area by default. This means creating a proper bleed-aware background effectively forces you to create a document with overflowing background. Maybe the bleed area should be included in the size used for background and foreground?

Indeed, it would be more convenient if the page background and foreground took the bleed into account. I’ve pushed a change to make that happen.

At first, I understood that changes to the bleed size were not supposed to affect any content.

@gabriel-araujjo

Copy link
Copy Markdown
Contributor Author
// Untrimmed paper stock
#let A0U = (880mm , 1230mm)
#let A1U = (625mm , 880mm)
#let A2U = (450mm , 625mm)
#let A3U = (330mm , 450mm)
#let A4U = (240mm , 330mm)
 
// Corresponding trimmed size
#let A0T = (841mm , 1189mm)
#let A1T = (594mm , 841mm)
#let A2T = (420mm , 594mm)
#let A3T = (297mm , 420mm)
#let A4T = (210mm , 297mm)

I don’t have much knowledge about paper sizes. Could we open a separate issue for this and address it in a different PR?

@laurmaedje laurmaedje added the waiting-on-author Pull request waits on author label Aug 7, 2025
@terefang

terefang commented Oct 7, 2025 •

Copy link
Copy Markdown

if someone does implement this i would suggest implementing the full complement of PDF *Boxes

image

aside from the MediaBox that would be CropBox, BleedBox, TrimBox, and ArtBox. (ISO 32000-2:2020(E) – 14.11.2.1 Page boundaries | General)

maybe the ArtBox is of less importance than the otherones.

@laurmaedje

Copy link
Copy Markdown
Member

I don't remember all of the context anymore, but I remember looking into this a bit and I think they don't all really make sense for us. This warrants further discussion and should not block this PR in my opinion.

@terefang

terefang commented Oct 8, 2025

Copy link
Copy Markdown

This warrants further discussion and should not block this PR in my opinion.

IMHO this PR satisfies more than the 20:80 rule ... about 90% of printservices i know would accept it.

thumbs up !

@jan-Kulpas

Copy link
Copy Markdown

I'm not sure yet as I don't have much experience printing but I think TrimBox and BleedBox mentioned above might be needed for the PDF file to work properly with professional printing software?

@laurmaedje
laurmaedje added this pull request to the merge queue May 26, 2026
@laurmaedje

Copy link
Copy Markdown
Member

Thank you! Good to see this finally land, it's been a while in the making. :D

Merged via the queue into typst:main with commit 90df9e6 May 26, 2026
11 of 27 checks passed
ParaN3xus added a commit to ParaN3xus/typstyle that referenced this pull request Jun 9, 2026
ParaN3xus added a commit to ParaN3xus/typstyle that referenced this pull request Jun 9, 2026
ParaN3xus added a commit to ParaN3xus/tinymist that referenced this pull request Jun 9, 2026
ParaN3xus added a commit to ParaN3xus/tinymist that referenced this pull request Jun 9, 2026
ParaN3xus added a commit to ParaN3xus/tinymist that referenced this pull request Jun 9, 2026
ParaN3xus added a commit to ParaN3xus/tinymist that referenced this pull request Jun 9, 2026
ParaN3xus added a commit to ParaN3xus/tinymist that referenced this pull request Jun 10, 2026
ParaN3xus added a commit to ParaN3xus/tinymist that referenced this pull request Jun 10, 2026
Myriad-Dreamin pushed a commit to Myriad-Dreamin/tinymist that referenced this pull request Jun 13, 2026
Myriad-Dreamin pushed a commit to Myriad-Dreamin/tinymist that referenced this pull request Jun 13, 2026
Myriad-Dreamin pushed a commit to Myriad-Dreamin/tinymist that referenced this pull request Jun 13, 2026
Myriad-Dreamin pushed a commit to Myriad-Dreamin/tinymist that referenced this pull request Jun 13, 2026
Myriad-Dreamin pushed a commit to Myriad-Dreamin/tinymist that referenced this pull request Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

interface PRs that add to or change Typst's user-facing interface as opposed to internals or docs changes. layout Related to the layout category, which is about composing, positioning, etc. pdf Related to PDF export or PDF embedding. waiting-on-review This PR is waiting to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants