Seshat
Fixing files
Repair a print file with every fix Seshat decided on, or with the fixes you name, and hand back the print-ready PDF.
What a fix is for
A check says what is wrong. A fix makes a new file where it is right: bleed added, the size brought to the order, colours in CMYK, fonts embedded. The original stays as it was, so you can always go back to it.
Layers (optional content, such as a spot varnish or a die line on a layer of its own) are kept by every fix, so a fixed file has the same layers, switched on or off as they were.
A fix works on a kept file, by its file_id. The file comes from a check, or from upload when you run your own check. Several fixes go in one call, in a sensible order, as one charge.
From check to print-ready file
- Check the file. Send the file and the order with
check; keep thefile_id. See Checking files. - Ask what must be asked. For each finding with the decision
ask, let the customer pick one of itsoptions. - Fix. Send
'auto'for every fix Seshat decided on, or the list of fixes, including what the customer chose. - Show the proof.
previewthe fixed file'sfile_idso the customer sees what will be printed. - Download. Fetch the fixed file and store it with the order.
use Rekhu\Core\Rekhu;
$seshat = Rekhu::seshat()->for($user);
$check = $seshat->check($request->file('artwork'), $order);
$fixed = $seshat->fix($check['file_id'], 'auto', $order);
$proof = $seshat->preview($fixed['file_id']);
$seshat->downloadTo($fixed['file_id'], storage_path('app/print/'.$fixed['name']));
const seshat = rekhu.seshat({ user });
const check = await seshat.check(buffer, { name: 'flyer.pdf', order });
const fixed = await seshat.fix(check.file_id, 'auto', order);
const proof = await seshat.preview(fixed.file_id);
await seshat.downloadTo(fixed.file_id, `storage/print/${fixed.name}`);
download() gives the bytes (a string in PHP, a Buffer in Node.js). downloadTo() writes the file straight to a path, without holding it in memory: use it for large files.
Fixes "auto"
'auto' applies every fix Seshat decided on in the check: each finding with the decision fix, each once. It never makes a choice that belongs to the customer: a finding with the decision ask is left alone until you name the fix.
$fixed = Rekhu::seshat()->fix($fileId, 'auto', $order);
const fixed = await seshat.fix(fileId, 'auto', order);
Send the same order as in the check: the fixes work to it (the bleed, the size, the profile).
Fixes by name
Name the fixes as a list. Each entry is a fix with its own fields, such as option:
$fixed = Rekhu::seshat()->fix($fileId, [
['fix' => 'scale_to_size', 'option' => 'fill'],
['fix' => 'add_bleed'],
['fix' => 'convert_cmyk'],
], $order);
const fixed = await seshat.fix(fileId, [
{ fix: 'scale_to_size', option: 'fill' },
{ fix: 'add_bleed' },
{ fix: 'convert_cmyk' },
], order);
The fixes the check decides on most:
| Fix | What it does | Options |
|---|---|---|
set_trim_box |
sets the trim box at the ordered size, in a file that already has bleed | |
add_bleed |
adds bleed by mirroring the page edges, and sets the trim box; bleed the file already has is kept A bleed the boxes give but the design leaves empty is filled the same way. | |
scale_to_size |
brings the page to the ordered size | scale (same shape), fit (all of it, white edges), fill (cropped, covering the bleed too) |
convert_cmyk |
converts RGB, Lab and spot colours to CMYK exactly as the separations would print them; CMYK made for the same printing condition keeps its exact values; RGB black (0, 0, 0) goes on the black plate only, so small text stays sharp | |
embed_fonts |
puts in fonts the file uses without carrying them | lookalike |
picture_to_pdf |
makes a picture into a print PDF at the ordered size; a picture sent with any other fix gets it first, as fill |
fill, fit |
registration_to_black |
puts page content drawn in the registration colour (All) on the black plate, as GWG 2015 asks; crop marks and other marks beyond the trim keep it | |
white_knockout |
takes overprint off white text and shapes (CMYK 0/0/0/0, grey or RGB white), whether they vanish now or only further on; each knocks out on its own, everything else keeps its overprint | |
reduce_ink |
brings total ink under the limit while colours keep their look: black prints the grey that cyan, magenta and yellow make together (grey component replacement), through the file's own print profile. This covers colours, process colours in DeviceN, gradients and CMYK pictures. The answer says how far colours moved (colour_change_de; about 2 is where most people start to see a difference). method: lower keeps the earlier way (cyan, magenta and yellow lowered, black kept). Content in the registration colour becomes black. Spot inks are not counted, as the GWG specification measures total ink. The answer says under_limit, or partly with the places (remaining) where separate objects overprint each other above the limit |
limit, method |
fix_rich_black |
sets large areas of four-colour black to C60 M40 Y40 K100, which dries | |
set_overprint |
sets cut, crease, perforation, varnish and foil to overprint | |
add_cut_contour |
draws a cut line around the shape of the artwork, in the spot colour CutContour | offset_mm, name |
add_barcode |
places a QR code, EAN-13 or Code 128 in 100 % black | type, value, page, x_mm, y_mm, size_mm |
clean_cut_lines |
takes out cut lines drawn twice and closes ones that stop just short | |
add_grommets |
grommet marks for a banner, at every corner and along every edge | spacing_mm, offset_mm, diameter_mm |
Whether a fix changed something
Every entry in applied has changed: true when the fix changed what the file prints, false when the file needed nothing from it. Seshat compares what the file prints before and after each fix: pages and their boxes, drawings, pictures, colours, fonts, printed annotations, layers, and the PDF/X identification with its print profile. A file that is only written differently counts as unchanged. Fixes that work through a rewrite of the whole file (flattening, outlining, lower resolution, embedding fonts, clean-up) do not run at all when there is nothing for them to do. Tell a customer something was fixed only when changed is true. A fix that changed nothing is not charged.
How long a fix takes
A fix repairs the file and checks it again, so the answer says what is left. When the same file was checked with the same order in the hour before (check, look, fix), Seshat uses that check instead of reading the file again. Seshat keeps only the check's answer for that hour, on its own server, never the file.
How Seshat converts colours
convert_cmyk and convert_profile give a file that prints as the original's separations do, also where objects overprint. Seshat converts every colour itself:
- The profile: the file's own output intent, the press it was made for. A
profilein the order, or the option ofconvert_profile, says another one. - CMYK stays exact when it was made for the same printing condition, even through another maker's profile (FOGRA39 by Adobe or by the ECI). CMYK made for another printing condition is converted, as PDF/X asks.
- RGB, Lab and other profiles go through the profile with each object's own rendering intent: perceptual, relative colorimetric, saturation or absolute.
- Spot colours become their CMYK plate laid over the CMYK plates as inks mix on press. A spot colour that overprints adds to what is below; one that knocks out replaces it. Its colour comes from its own definition in the file.
- Overprint keeps its meaning. Process inks in DeviceN, overprint mode, white that must not vanish, and RGB colours that knock out every ink all print as before.
- Kept as they are: the registration colour, technical colours (cut, crease, white, varnish, foil), and every spot colour the order allows.
A file with something Seshat cannot convert exactly is converted the way it was before 1.8.1, and the answer says so in converted_by and why.
Every other fix (print profiles, PDF/X, black text, spot colours, pages, crop marks, imposition, thin lines, text as outlines) is in Every task, with examples. codes() lists every fix with the options it takes.
An unknown fix or option is refused with InvalidRequest, listing the allowed ones. Nothing runs and nothing is charged.
What comes back
| Field | |
|---|---|
file_id |
the new, fixed file, kept for a day |
from_file_id |
the file it was made from |
name, bytes |
the new file's name and size |
applied |
every change made, also a side effect, with side_effect_of |
resolved |
the finding codes the file no longer has |
check |
the check of the fixed file, against the same order |
applied names everything, so your app can tell the customer what changed. When the colour conversion also embedded fonts, that is in applied too. A font is never swapped without a word; see Fonts and templates.
Your own check, Seshat's fixes
An app with its own preflight can skip Seshat's check. Send the file with upload (free) and ask for the fixes your check found:
$file = Rekhu::seshat()->upload($request->file('artwork'));
$fixed = Rekhu::seshat()->fix($file['file_id'], [['fix' => 'add_bleed'], ['fix' => 'convert_cmyk']], $order);
const file = await seshat.upload(buffer, { name: 'flyer.pdf' });
const fixed = await seshat.fix(file.file_id, [{ fix: 'add_bleed' }, { fix: 'convert_cmyk' }], order);
Pictures too small
With the ai_enhance module on, a picture below the order's resolution gets the fix upscale_ai in its finding. It upscales the pictures inside the PDF, in place, and applied says how many, from which ppi and to which. It works on files up to 350 MB.
$fixed = Rekhu::seshat()->fix($fileId, [['fix' => 'upscale_ai']], $order);
const fixed = await seshat.fix(fileId, [{ fix: 'upscale_ai' }], order);
What is charged
- Per fix made (
seshat_fix): each fix that changed the file, at most 5 per fixed file;fixes_chargedin the answer says how many. The check of the fixed file that comes with the answer is included. - A file fixed without being checked first is also charged as a checked file, once.
upscale_aiis charged on its own line, as an upscale, not as a fix.- A fix with nothing to do is free: when what was asked is not in the file, the answer says so in
noteand no fix is charged. - A refused call is free: an unknown fix, an unknown option, a font not in the library.
meta.usage in the answer has one line per charged item. The prices are in your account; see Credit and usage.
Tip: every charged call carries an idempotency key. When the connection drops and the package sends the fix again, Rekhu answers the first result again (
meta.replayed) and charges nothing.
Next
- Large files: files up to 10 GB, with progress and resume.
- Fonts and templates: missing fonts, new text and a copy per row.