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

Supporting Spot Colors #62

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Supporting Spot Colors #62

wants to merge 15 commits into from

Conversation

ziaenezhad
Copy link
Contributor

@ziaenezhad ziaenezhad commented Dec 12, 2017

Supporting Spot Colors:
562a3a6

@alafr
Copy link
Owner

alafr commented Dec 12, 2017

I will consider merging this, when and if it gets supported in the official PDFKit repository...
There are conflicts mostly because of the different indentation in your file (you will have to remove the 'formatting' commits - but no need to hurry, merging in PDFKit can take quite a long time)

@ziaenezhad
Copy link
Contributor Author

Hi @alafr ,
seems that the writer of PDFKit does not maintain the repo any more. i suggest you to pull spot colors into your fork. is it possible?

source.js Outdated
group.resources.data.ColorSpace = (function() {
var output = {};
var i = 1;
for (var item in doc.spotColors) {
Copy link
Owner

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);
Copy link
Owner

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?

@alafr
Copy link
Owner

alafr commented Feb 7, 2018

Hi,
I commented some changes (mostly in the PDFKit part) that could me made to make the code cleaner and more similar to the existing PDFKit code.
Are the spotColors anything more than CMYK which is already supported by PDFKit and SVG-to-PDFKit?

@ziaenezhad
Copy link
Contributor Author

ziaenezhad commented Feb 8, 2018

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.
using my codes we can set fill of a path or rect to those values:

<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);

@kimmobrunfeldt
Copy link

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:

    "pdfkit": "git://github.com/alvarcarto/pdfkit.git#build",
    "svg-to-pdfkit": "git://github.com/alvarcarto/SVG-to-PDFKit.git#feature/spot-colors",

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

Successfully merging this pull request may close these issues.

3 participants