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

new rule: minimum margins #8

Open
yob opened this issue Feb 19, 2012 · 6 comments
Open

new rule: minimum margins #8

yob opened this issue Feb 19, 2012 · 6 comments
Labels

Comments

@yob
Copy link
Owner

yob commented Feb 19, 2012

This is the opposite of the minimum bleed rule - there must be X distance between a specified PageBox and content.

@tomtaylor
Copy link
Contributor

I was looking at doing some work on this rule. One of our requirements is that it we only warn customers if the object in the margins will actually appear in printing. So not if it's white, or transparent, or invisible somehow.

With text and vectors we can check the colour when stroked/filled, but presumably with images, we'd need to render it and check whether the intersecting area contained any non-white/alpha pixels.

Do you have any thoughts about this approach? Am I missing something obvious?

@yob
Copy link
Owner Author

yob commented May 15, 2013

Your approach sounds reasonable. I think it's more or less what I'd try - I've just put it off because it sounds hard 😄

@tomtaylor
Copy link
Contributor

I've actually ended up going for a slightly different solution, which feels a bit dirty, but works well. We just render the PDF to a series of CMYK bitmaps, and then check whether any of the pixels in the margin area have any values > 0.

On 15 May 2013, at 13:33, James Healy [email protected] wrote:

Your approach sounds reasonable. I think it's more or less what I'd try - I've just put it off because it sounds hard


Reply to this email directly or view it on GitHub.

@tomtaylor
Copy link
Contributor

I'm happy to share this code, but at the moment it doesn't integrate into preflight - it's run as supplementary check. If you think something like that might be worth including, I'm happy to do some work to fit it in somehow, or release it as an extension or something.

On 15 May 2013, at 13:41, Tom Taylor [email protected] wrote:

I've actually ended up going for a slightly different solution, which feels a bit dirty, but works well. We just render the PDF to a series of CMYK bitmaps, and then check whether any of the pixels in the margin area have any values > 0.

On 15 May 2013, at 13:33, James Healy [email protected] wrote:

Your approach sounds reasonable. I think it's more or less what I'd try - I've just put it off because it sounds hard


Reply to this email directly or view it on GitHub.

@yob
Copy link
Owner Author

yob commented May 18, 2013

How do you render the page to a bitmap? If it's pure ruby I'd be happy to find a way to integrate it. If it involves shelling out or a C extension I think I'd prefer to leave it out.

@tomtaylor
Copy link
Contributor

RMagick I'm afraid. It's not really ideal, but it seemed like the best way to do it considering the complexity of the alternatives. The RMagick bit would be easy to swap out, if there's a Ruby only library that made sense.

It's all available at: https://github.com/newspaperclub/pdf_margins

On 18 May 2013, at 07:46, James Healy [email protected] wrote:

How do you render the page to a bitmap? If it's pure ruby I'd be happy to find a way to integrate it. If it involves shelling out or a C extension I think I'd prefer to leave it out.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants