Crop marks using Chemistry

Post here questions and problems related to editing and publishing DITA content.
horisonten
Posts: 19
Joined: Thu Nov 30, 2023 12:45 pm

Crop marks using Chemistry

Post by horisonten »

Hello, is there an easy way of adding crop marks to the PDF when using the built in PDF transformation?
If I were to use Prince I could add this to my CSS:

Code: Select all

@media print {
  @page {
    marks: crop cross;
  }
}
But is there something like this that I can use with Chemistry?
julien_lacour
Posts: 498
Joined: Wed Oct 16, 2019 3:47 pm

Re: Crop marks using Chemistry

Post by julien_lacour »

Hello,

Currently Oxygen PDF Chemistry doesn't support crop marks display in PDF, I added a feature request in our tracking system.
When it will be available, I will post on this topic.

Regards,
Julien
horisonten
Posts: 19
Joined: Thu Nov 30, 2023 12:45 pm

Re: Crop marks using Chemistry

Post by horisonten »

julien_lacour wrote: Fri Jan 26, 2024 10:56 am Hello,

Currently Oxygen PDF Chemistry doesn't support crop marks display in PDF, I added a feature request in our tracking system.
When it will be available, I will post on this topic.

Regards,
Julien
All right! Thanks for adding it to the wish list.

Is there a workaround meanwhile?
Can I "inject" a snippet of XEP into the transformation for example?
As seen in this topic: post6339.html?hilit=crop%20marks#p6339
julien_lacour
Posts: 498
Joined: Wed Oct 16, 2019 3:47 pm

Re: Crop marks using Chemistry

Post by julien_lacour »

Hello,

A workaround for this could be to use an SVG file as background for the whole PDF, I already did an example:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" width="8.5in" height="11in" viewBox="0 0 85 110">
    <!-- 
        The viewbox is based on the US-LETTER size with 1in margins except 1in = 10 for the viewport.
    -->
    <style type="text/css">
        .line { fill:none; stroke:black; stroke-width:0.1 }
        .circle { fill:none; stroke:black; stroke-width:0.1 }
    </style>
    <g id="cut-marks">
        <!-- TOP-LEFT-CORNER -->
        <polyline class="line" points="4,10 9,10"/>
        <polyline class="line" points="10,4 10,9"/>

        <!-- TOP-RIGHT-CORNER -->
        <polyline class="line" points="76,10 81,10"/>
        <polyline class="line" points="75,4 75,9"/>

        <!-- BOTTOM-LEFT-CORNER -->
        <polyline class="line" points="4,100 9,100"/>
        <polyline class="line" points="10,101 10,106"/>

        <!-- BOTTOM-RIGHT-CORNER -->
        <polyline class="line" points="76,100 81,100"/>
        <polyline class="line" points="75,106 75,101"/>
    </g>
    <g id="registration-marks">
        <!-- TOP-LEFT-CORNER -->
        <polyline class="line" points="3,5 6,5"/>
        <polyline class="line" points="4.5,3.5 4.5,6.5"/>
        <circle class="circle" cx="4.5" cy="5" r="1.3"/>
        <circle cx="4.5" cy="5" r="0.8"/>

        <!-- TOP-RIGHT-CORNER -->
        <polyline class="line" points="79,5 82,5"/>
        <polyline class="line" points="80.5,3.5 80.5,6.5"/>
        <circle class="circle" cx="80.5" cy="5" r="1.3"/>
        <circle cx="80.5" cy="5" r="0.8"/>

        <!-- BOTTOM-LEFT-CORNER -->
        <polyline class="line" points="3,105 6,105"/>
        <polyline class="line" points="4.5,103.5 4.5,106.5"/>
        <circle class="circle" cx="4.5" cy="105" r="1.3"/>
        <circle cx="4.5" cy="105" r="0.8"/>

        <!-- BOTTOM-RIGHT-CORNER -->
        <polyline class="line" points="79,105 82,105"/>
        <polyline class="line" points="80.5,103.5 80.5,106.5"/>
        <circle class="circle" cx="80.5" cy="105" r="1.3"/>
        <circle cx="80.5" cy="105" r="0.8"/>
    </g>
</svg>
This example works for US-LETTER size but you can basically adapt it to other page size by changing the coordinates.
You can also use any other unit instead of inches, centimeters or millimeters should work as well.

Once you have the correct SVG, you just need to declare it as background-image for all pages:

Code: Select all

@page {
  background-image: url("file:/path/to/marks.svg");
  background-repeat: no-repeat;
}
And you will obtain something similar to this:
marks.png
marks.png (131.62 KiB) Viewed 661 times
Regards,
Julien
horisonten
Posts: 19
Joined: Thu Nov 30, 2023 12:45 pm

Re: Crop marks using Chemistry

Post by horisonten »

Thanks for the suggestion! That should suffice for now :D
julien_lacour
Posts: 498
Joined: Wed Oct 16, 2019 3:47 pm

Re: Crop marks using Chemistry

Post by julien_lacour »

Hello,

Starting with Oxygen 26.1 (already available on our website) it is possible to control the marks display from the CSS.
For more information you can check the Page Boundaries topic from our user guide.

Regards,
Julien
InspectorSpacetime
Posts: 38
Joined: Thu Jul 29, 2021 12:02 pm

Re: Crop marks using Chemistry

Post by InspectorSpacetime »

Hi,

The crop marks are a great feature, thanks for that!

However, I'm trying to wrap my head around how to properly use them with page margins. Correct me if I'm wrong, but by default the crop marks would cut the page margin boxes out, like in the image below (no crop values declared, so the default media-box is used):
crop.png
crop.png (12.51 KiB) Viewed 185 times
So if I want to include the margin boxes in the finished cut, the bleed value should be the same as the page margins, which results in this:
crop2.png
crop2.png (13.59 KiB) Viewed 185 times
Or am I not getting something?

And is there any difference between using bleed or -oxy-crop-offset?
julien_lacour
Posts: 498
Joined: Wed Oct 16, 2019 3:47 pm

Re: Crop marks using Chemistry

Post by julien_lacour »

Hello,

You're right, by default the crop marks will cut the margins out and you're right again if you want to include the margin boxes in the finished cut, the bleed or -oxy-crop-offset value should be the same as the page margins.

Regarding bleed vs -oxy-crop-offset, when using media-box (default) you can use any of the properties.
If you change the -oxy-crop-box value or use both properties, the behavior is as follows:
Note: If only one of the properties is present, its value will be used. If both are set, then:
  • If the crop box is set to media-box (default), the bigger value will be used.
  • If the crop box is set to bleed-box, only the bleed value will be used.
  • If the crop box is set to trim-box (finished page), no value will be used.
This note is taken from the Page Boundaries topic I linked in my previous post.

Regards,
Julien
Post Reply