Comments (3)
The CMYK values seems to be in percentage going from 1 to 100.The values that the method expects are from 0..255 encoded to hex.To get what you want take each value, multiply by 255 and divide by 100. take the integer part and convert to hex.Then it should work OK.
As for illustrator, i do not know. maybe illustrator cannot render pdf text. I think the problem may be with illustrator, and not with the pdf.
Gal.
Date: Sun, 17 May 2015 13:44:43 -0700
From: [email protected]
To: [email protected]
Subject: [HummusJS] CMYK Colors + Illustrator edit function (#38)
Hey there, first of thank for the library!
I'm trying to add a Text an existing pdf! in CMYK (C:83 M:33 Y:74 K:17) - which is the same color as the ring in the existing pdf. When I try to add a text it somehow doesn't get the color right
Any ideas why that? Also another question? Why isn't the text visible when I open the file in Illustrator (osx, CS6) while in acrobat reader it shows up?
var hummus = require('hummus');
var pdfWriter = hummus.createWriterToModify('./input.pdf',{modifiedFilePath:'./output.pdf'});
var pageModifier = new hummus.PDFPageModifier(pdfWriter,0);
pageModifier.startContext().getContext()
.writeText('Test Text', 10, 10, {
font: pdfWriter.getFontForFile('./tradegothicltstdbd2.ttf'),
size: 12,
colorspace: 'cmyk',
color: 0x83337417 // C:83 M:33 Y:74 K:17
});
pageModifier.endContext().writePage();
pdfWriter.end();
—
Reply to this email directly or view it on GitHub.
from hummusjs.
Great, thanks for your help, I kind of got 0xD354BC2B
which seems like it is the same color. For the illustrator stuff: I figured out it depends on the input format. I switched to PDF/X-3
format. Now a can't edit the text (doesn't recognize the font) but it gets displayed.
Btw. it would really be great if the CMYK / RGB color would just except the 0-100 and 0-255 values and not not the hex values - or (since nobody likes breaking change): add a color and color conversion tool something like hummus.color('cmyk', '83337417')
which converts to the right color in hex. Or you could just add a article to the wiki about how colors work :)
Thanks again
from hummusjs.
i'll start with a better explanation in the wiki area, then later when i have more mindspace ill add something. thanks.
from hummusjs.
Related Issues (20)
- Is there a way to put an image inside a cell in the tables?
- Error library v1.0.109 HOT 1
- Text replace
- Annotation modification
- Remove or replace some text in PDF file
- Build failed after upgrading node from 14.x to 15.x (docker - ubuntu) HOT 1
- unable to append to page, make sure source file exists at merge
- How to remove Rectangle using position?
- Spelling Error: "parhaps" HOT 2
- Last commit has broken the instalation on CentOS7 HOT 6
- Invalid PDF input causes `SIGSEGV` crash HOT 15
- unable to append page, make sure it's fine HOT 2
- whitesource scan issues caused by minimist 0.0.8 HOT 1
- @galkahana @filmerjarred
- How to save the splitted pdf to another directory
- TypeError: Unable to create PDF file, make sure that output file target is available
- Build failed with v1.0.115 with node v12 HOT 2
- Typing correction HOT 1
- TypeError: Unable to write page when calling writePage HOT 5
- Delete object from pdf HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hummusjs.