-
Notifications
You must be signed in to change notification settings - Fork 116
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
Supporting Spot Colors #62
base: master
Are you sure you want to change the base?
Conversation
I will consider merging this, when and if it gets supported in the official PDFKit repository... |
Hi @alafr , |
source.js
Outdated
group.resources.data.ColorSpace = (function() { | ||
var output = {}; | ||
var i = 1; | ||
for (var item in doc.spotColors) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this should be done in PDFKit.
Here it would be only:
if (Object.keys(doc.page.color_spaces).length) { group.resources.data.ColorSpace = doc.page.color_spaces; }
I commented some ideas how to do it on your pdfkit fork.
source.js
Outdated
@@ -2303,7 +2316,7 @@ var SVGtoPDF = function(doc, svg, x, y, options) { | |||
} | |||
if (fill || stroke) { | |||
if (fill) { | |||
docFillColor.apply(doc, fill); | |||
docFillColor.apply(doc, typeof fill === 'string' ? [fill] : fill); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why support only fill and not stroke?
Hi, |
Yes, they are custom named CMYK colors, which are using in printing special layers, for example emboss UV printing, etc. which deals directly with the printer. <path fill="RDG_GLOSS" d="M90,0L50,40L10,0H0l50,50l50-50H90z M80,0H70L50,20L30,0H20l30,30L80,0z M60,0H40l10,10L60,0z M0,100h10l40-40l40,40h10 L50,50L0,100z M20,100h10l20-20l20,20h10L50,70L20,100z M40,100h20L50,90L40,100z M100,90V80L70,50l30-30V10L60,50L100,90z M100,70 V60L90,50l10-10V30L80,50L100,70z M0,10v10l30,30L0,80v10l40-40L0,10z M0,30v10l10,10L0,60v10l20-20L0,30z"></path> the color should register before: doc.addSpotColor('RDG_GLOSS', 50, 25, 25, 0); |
Adding support for spot colors as values for strokes
Hi, I extracted this feature to our own fork: https://github.com/alvarcarto/SVG-to-PDFKit/. The implementation was re-done, adding the latest commits from master branch as well. Comparison here: https://github.com/alafr/SVG-to-PDFKit/compare/master...alvarcarto:feature/spot-colors?expand=1 You can use the spot colors by adding to your package.json:
|
Supporting Spot Colors:
562a3a6