Print Page | Close Window

crop marks

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3220
Printed Date: 01 Apr 26 at 10:20PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: crop marks
Posted By: pdfer
Subject: crop marks
Date Posted: 30 Nov 15 at 10:31PM
New Debenu user here.

I've been publishing books using PDF files for some years now, but the latest twist my publisher is throwing at me (after personnel changes there) is that they want me to add crop marks to my master files. In the past, I've presented the master files without margins or crop marks, and they did whatever they needed. Now, it seems, with the personnel changes, they've forgotten how... and I never knew how...because I didn't need to know.

So lets say I generate a page of data 180mm × 110mm in image size. I want to add a margin of 9mm fore edge and 11mm gutter, and 9mm top and bottom. I further want to add enough space for crop marks... is there a standard somewhere for the distance from the trim edge where the crop mark should start, how long it should be, what line weight, etc.?

And so where would I start to do this as I create my PDF file?  Some pages will be full-page graphics (no bleed required, though), others text, if the handling should be different.



Replies:
Posted By: martin.weigl
Date Posted: 23 Feb 16 at 12:26PM
Don't know if it's still interesting for you, but I had the same problem in here - adding a trimbox and cropmarks after the content has been drawn before.
 
My solution (C#):
Let' suppose, the variable trimBoxInches holds the width of the trim box
 
iterate through the pages, add a new page for every page and capture the (first) page (which removes it, so the next page is always the first):

IDictionary<int, int> pageIds = new Dictionary<int, int>();

int nrOfPages = this.Library.PageCount();
for (int page = 1; page <= nrOfPages; page++)
{
  this.Library.NewPage();
  this.Library.SelectPage(1);
  int pageId = this.Library.CapturePage(1);
  pageIds.Add(page, pageId);
}
Afterwards you can calculate the new dimensions of your pages and resize them:
double pageWidth = this.Library.PageWidth();
double pageHeight = this.Library.PageHeight();
double newPageWidth = pageWidth + 2 * trimBoxInches;
double newPageHeight = pageHeight + 2 * trimBoxInches;
 
this.Library.SetPageDimensions(newPageWidth, newPageHeight);
 
After this the captured pages can be redrawn again:
foreach (KeyValuePair<int, int> entry in pageIds)
{
  int pageNr = entry.Key;
  int pageId = entry.Value;
  this.Library.SelectPage(pageNr);
  this.Library.DrawCapturedPage(pageId, trimBoxInches, trimBoxInches + pageHeight, pageWidth, pageHeight);
 
  double trimBoxLength = trimBoxInches; // eventually you want to make the lines a little bit shorter here
  // prepare drawing
  this.Library.SetLineColorCMYK(0, 0, 0, 1);
  this.Library.SetLineWidth(...); // set the width of your cropmarks here
  // bottom left corner
  this.Library.DrawLine(0, trimBoxInches, trimBoxLength, trimBoxInches);
  this.Library.DrawLine(trimBoxInches, 0, trimBoxInches, trimBoxLength);
  // bottom right corner
  this.Library.DrawLine(newPageWidth, trimBoxInches, newPageWidth - trimBoxLength, trimBoxInches);
  this.Library.DrawLine(newPageWidth - trimBoxInches, 0, newPageWidth - trimBoxInches, trimBoxLength);
  // top right corner
  this.Library.DrawLine(newPageWidth, newPageHeight - trimBoxInches, newPageWidth - trimBoxLength, newPageHeight - trimBoxInches);
  this.Library.DrawLine(newPageWidth - trimBoxInches, newPageHeight, newPageWidth - trimBoxInches, newPageHeight - trimBoxLength);
  // top left corner
  this.Library.DrawLine(0, newPageHeight - trimBoxInches, trimBoxLength, newPageHeight - trimBoxInches);
  this.Library.DrawLine(trimBoxInches, newPageHeight, trimBoxInches, newPageHeight - trimBoxLength);
}
 
 
And, of course, you want to add a trimbox for the print office:
this.Library.SetPageBox(4, trimBoxInches, trimBoxInches, pageWidth, pageHeight);

Hth,
Martin


Posted By: martin.weigl
Date Posted: 23 Feb 16 at 12:31PM

Add: "this.Library." is the reference you normally find as "QP.". Guess you might already have figured that out Smile




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk