[CS5 - JS] Convert InDesign colors to Hex

Hi,
I assembled the following functions in order to convert InDesign colors to theyr hex value.
I tested it with some colors but RGB conversion is not working as expected.
function colorToHex(color, tint){
    switch(color.space){
        case ColorSpace.CMYK:
        return cmykToHex((color.colorValue[0] * tint) / 100, (color.colorValue[1] * tint) / 100, (color.colorValue[2] * tint) / 100, (color.colorValue[3] * tint) / 100);
            break;
        case ColorSpace.RGB:
        return cp_RgbToHex((color.colorValue[0] * tint) / 100, (color.colorValue[1] * tint) / 100, (color.colorValue[2] * tint) / 100);
            break;
        default:
        return "";
            break;
function cmykToHex(c, m, y, k){
    c = c/100;
    m = m/100;
    y = y/100;
    k = k/100;
    var R = (1 - (c * (1 - k) + k)) * 255;
    var G = (1 - (m * (1 - k) + k)) * 255;
    var B = (1 - (y * (1 - k) + k)) * 255;
    return rgbToHex(R, G, B);
function rgbToHex(R, G, B){
    return "#" + nToHex(R) + nToHex(G) + nToHex(B);
function nToHex(N){
    if (N == 0 || isNaN(N)){
        return "00";
    N = Math.max(0,N);
    N = Math.min(N,255);
    N = Math.round(N);
    return "0123456789ABCDEF".charAt((N-N%16)/16) + "0123456789ABCDEF".charAt(N%16);
Do you see something wrong?
Thanks!

What I meant to say was "InDesign uses an advanced internal system". There is simply no way you could do the same with Javascript.
But to use InDesign's color conversion, all you have to do is
If you want to get the 'good' RGB value, let InDesign convert the color from CMYK to RGB for you by changing the ColorSpace property of the swatch.

Similar Messages

  • Hi how to convert Indesign CS5 file to Indesign CS4 version

    Hi Iam Rajesh
    Hi how to convert Indesign CS5 file to Indesign CS4 version, please tell me
    thanks
    best regards
    Rajesh

    Try this:
    http://ajarproductions.com/pages/products/in5/
    Bob

  • Batch Convert InDesign Files to PDF: Acrobat 9 Pro Opens CS3

    A question came up in the InDesign forum about batch converting InDesign files. I've never really needed to do it but I was aware of the batch convert command. The OP reported errors so I tried it myself and while it worked, for some reason Acrobat 9 Pro is opening InDesign CS3 even though I have CS4 and CS5 installed.
    I can't seem to find any way to change the default for INDD files. I tried launching ID CS5 first, but Acrobat still launched ID CS3. If I double click an INDD file in Windows Explorer, it opens in CS5 so the operating system has the default correct.
    Any ideas?
    Thanks,
    Bob

    Thanks,
    I just found that out, too.
    What I'd like to find out is how to fix this.
    Bob

  • Convert Indesign file to editable Powerpoint presentation?

    I know I can save an indesign file to a pdf and convert to powerpoint from there, but not everything translates. Drop shadows, some dingbats, and some text formatting do not translate, so I have to edit within powerpoint.
    I read about a plugin called ID2Office v2.0. Has anyone heard of it or used it?
    Thanks!

    Hello
    I represent Recosoft. We make ID2Office (http://www.recosoft.com/products/id2office). This exports/converts InDesign CS5-CC 2014 files to PowerPoint, Word and Keynote formats. You can view the Youtube video I've posted below how it converts the file:

  • Open CS5 documents in InDesign CC

    When opening InDesign CS5 files in InDesign CC it is opening up as "converted" and forcing us to "Save As". Is there an easy way to forcibly overwrite the document instead of save as?
    We're having the same problem with InDesign server scripts failing because if ID server CC opens a CS5 file it will not forcibly save as CC and will throw an error.
    This is a problem for us because we need do not want our users manually going in and trying to find the right path to save their documents as they're all stored on a network share.

    Simply try saving with the same name. It will effectively over-write your file as you want. The "[converted]" I find this to be a courtesy to let you know at a glance that you're working on an older version document. As far as the path issue, I can't answer that, as I use a third party program which, with a single keystroke, takes me to the original folder the files resides in. It's called Default Folder, and I've found it indispensable since 1999. Try it, you'll love it. It's from St. Claire Software.
    Cheers!
    -Mikey

  • Converted spot colors is different...

    When converted spot colors to cmyk the breakdown is different in CS6
    In CS3, Cs4, Cs5, CS5.5 and my pantone spot color book converted to cmyk all match.

    PMS 187 Inside my Pantone Book c-0 m-100 y-79 k-20
    If you want the older Pantone CMYK simulations, copy the PANTONE solid to process.acb file from and older version of ID and put it in your Presets>Swatch Libraries folder and use that library.
    PMS 187 Color Bridge CS6 c-7 m-84 y-56 k-16
    Looks like you are in Color Bridge Uncoated—the coated simulation is 7|100|82|26
    PMS 187 Inside CS6 c-22.3 m-100 y-88.93 k-14.68
    This is a color managed conversion from the solid Lab values to CMYK and is dependant on your document's CMYK profile. If you change your document's CMYK profile you will get a different conversion.

  • How to use a grayscale color model in converting a colored image

    how to convert a colored image into grayscale using :
    ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
    int bits[] = new int[] {8};
    ColorModel cm = new ComponentColorModel(cs, bits, false, false,
    Transparency.OPAQUE,
    DataBuffer.TYPE_BYTE);
    please only this method , i don't need the "bandcombine" method cause i need to know that i have exact 256 grayscale colors, thanx in advance.

    I went into mail preferences in the first place. I found the fonts and colors and picked the color I want but it doesn;t seem to be sticking?

  • Problem with PDF 1.3-Export: Photoshop-Files with transparency over InDesign colored objects

    Hello!
    I'm using InDesign CS6.
    I'v finished now a layout for a folder, and I put a photoshop-image with transparency over a InDesign-rectangle which I have filled with a cmyk-color in yellow.
    When I export a PDF with the Settings "PDF X-3:2002" (with PDF-Standard 1.3) the Photoshop-image shows uggley jagged edges at the border to the InDesign-colored background. However, the Photoshop-images which are over another bitmap-image (as background), this images don't show this annoying edges.
    When I export to PDF-Standard 1.4 the problem doesn't occor, however my printing-service requests PDF 1.3.
    I know, the workaround for this problem is, to replace the yellow background-color with an bitmap-file with the same color, but is there any other option to get a correct result without this more time-consuming image trick?
    I think it has to do with the transparency reduction which is necessary if using PDF 1.3. When I examine the PDF-File in Illustrator, this edges occurs mostly at the borders from the tiles in which the image is cut during the transparency reduction process. Although, if I open the rendered PDF in Photoshop this jagged edeges are visible, so it is definitly a render error.
    I would be glad if someone of you has a solution for this problem, in the attachment is an image which illustrate the problem.
    Best wishes

    Find another printer.
    End of problem. It really saddens me to think that these Luddites are
    still in business making no effort to move into the 21st century.
    Bob

  • How convert a color pdf to black and white pdf...? new acrobat in creative cloud cs6

    how convert a color pdf to black and white pdf...? new acrobat in creative cloud cs6

    Print Production << where is this in XI...?

  • 'Convert CMYK Colors to RGB' still runs havoc in 9! (Plus a PDF version problem)

    This post is to warn people about severe issues, and how to avoid them. Issues with the CMYK color setting in FM9.x have been reported here earlier, such as:
    http://forums.adobe.com/message/1237696#1237696
    http://forums.adobe.com/message/1237852#1237852
    http://forums.adobe.com/message/1237165#1237165
    However, I do not think this issue has been warned about anywhere near as much as it should have. And, as usual, Adobe is silent (they should have a big poster on their site warning about this issue! And they have even claimed that patches have "solved" the issues with CMYK).
    Just recently, while experimenting with FM9 again, I had extreme problems, which, at first, seemed totally unrelated to this CMYK setting. But after having struggled extremely hard for many many many hours, I finally found out. Now is the time to inform others:
    First a note about versions: FrameMaker 9.0p237, Acrobat Distiller 9.1, XP SP2
    It looks perfectly okay on screen in FrameMaker, exactly as in FM8. But when saved as pdf, several things are "corrupted". Examples: no kerning after the letter 'T', such as the word 'Text'. Dotted leader for a right aligned tab disappears. Some objects from the master pages, such as a logo, become enclosed in a rectangle (a border of the frame/object), but it only happens on *some* body pages, whereas other body pages using the same master page are ok!!? Equations are formatted differently from the way they should, with the wrong font for number, etcetera.
    Solutions:
    1. When 'Save as PDF...', untick 'Convert CMYK Colors to RGB' in PDF Setup. Same setting is in the file's 'Format > Document > PDF Setup...'
    A drawback with this method is that, as of Acrobat Distiller v9, it does not seem to respect the pdf version specified in the PDF job Options! I get PDF 1.6 with this method, despite my job option specifies version 1.5. (This happens also with FrameMaker 8 if Acrobat is v9.) So you *have* to optimize it in Acrobat in order to get a web friendly PDF (PDF 1.4 or 1.5).
    or
    2. Print to 'Adobe PDF'.
    In this latter case, you can set the same 'PDF Setup' settings under the button 'Setup...', EXCEPT that there is no tick box for 'Convert CMYK Colors to RGB', and it does not matter what setting you have chosen in the file's 'Format > Document > PDF Setup...', it will be RGB conversion in any case. Make sure that after you exit the setting, the tick box for 'Print to File' is NOT ticked! This method respects the pdf version specified in the PDF job Options! I get PDF 1.5, which is what my job option specifies.
    (For some reason, Acrobat/Reader does not render these two PDFs exactly the same, except in extreme magnification! Maybe it has to do with the different PDF versions of the files.)
    In either case, the solution actually solves ALL problems I listed! Despite it seems to have absolutely nothing whatsoever to do with colors! Some day in the distant future, CMYK might actually work! But, for myself, I would prefer a proper color management instead...
    Best Regards,
      /Harald

    Oops!! Not until now I discover that under 'Solutions' I happened to write 'untick' where it should be 'tick'! I.e, colors SHOULD be converted to RGB in order to circumvent the problems! I.e it runs havoc in v9 when CMYK colors are NOT converted to RGB! Don't know how I came to write the opposite, but probably I started out by describing the situation where the problems are seen rather than describing how to avoid them.
    Equally strange is that nobody corrected me, but perhaps the mistake was so obvious? (But whether you see problems or not might depend on what fonts you use. So, under certain special circumstances, CMYK might actually work without these reported problems.)
    I am also a bit surprised that others haven't reported the issue that the PDF version set in PDF job Options isn't respected when using 'Save As PDF' and Acrobat 9? (Or maybe someone has, but I have missed it.)

  • Convert a color pdf to BW

       How do I convert a color PDF to black and white?
    I am using Adobe Acrobat X version 10.1.7.
    Is there an easy way to do this?

    As I said, I have not had much success that way either. Pro had the preflight conversion to Grayscale. Since you have Std, you may have to simply use separate graphic tools to convert to Grayscale and then recreate the PDF. If it is a scanned PDF, then you could simply save to a TIFF, use a graphic package to convert to grayscale (I use Irfanview for this type of simple task) and then move the TIFFs back into a PDF. If you have a mix of graphics and text, you may have to deal with a bit more. If the print converts the text, but not the graphics, you might try extracting the graphics (bitmaps I hope) under the tools menu. Convert those graphics to grayscale and then replace the color images with the new ones. (work on a copy of your PDF just in case something does not work)

  • How convert a color PDF File to black & white (gray scale...no color)

    How convert a color PDF File to black & white (gray scale...no color)??? creative cloud cs6... Acrobat etc

    Hi, just wanted to add my 2¢
    I've been in publishing over 25 years and live in Acrobat for making my final files. Currently with a newspaper.
    This is what we do:
    • Tool Panes > Print Production Window
    • Select CONVERT COLORS
    • Midway down under OUTPUT INTENT, check Convert Colors to Output Intent
    • In the associated drop down menu, I choose (because I'm printing on newsprint) DOT GAIN 20% – If you're working on better stock, choose a lower dot gain percentage.
    • Click OK – this will convert the file
    • Save
    Note: this affects the file you're working with. Make sure that you use this method on a COPY if you want to retain the original color version.
    I think if you compare my method to the Preflight method, you'll see a tighter contrast and better blacks. I've always felt the Preflight method left continuous tones a little muddy.
    Now if there was only a way to add that to ACTIONS...!

  • FM10 Crashes when Convert CMYK colors to RGB selected

    Hi folks,
    I have searched for info on this issue and found a couple of items but I'm still having problems doing what I need to do.
    First off, FM 10 version is 10.0.2.419. PC is Dell E6420 laptop, Win 7 SP1, 8GB RAM, big hard drive. No existing Adobe software before installing TCS 3.0 from local files (copied from DVD).
    At first I could not create a pdf (using File > Save as PDF) at all on this system (my old XP system still works fine with TCS 3.0). Instant crash and error messages (Internal error 10024, 7687848, 7688138, 10076935.). After reading the discussions, I cleared the check box for Convert CMYK colors to RGB, which allowed me to create the pdf. However, my colors are washed out completely. So I need to be able to select this check box without the crash.
    Any suggestions?
    Thanks!

    (1)     Although FrameMaker 10 is a 32-bit application, there was no issue with it running under Windows 7 64-bit. You certainly don't need to run it under any XP mode!!!!
    (2)     There were any number of save as PDF bugs in FrameMaker 10 that were fixed in various updates, but typically they were associated with when one didn't check that convert CMYK to RGB option (that uses the native Windows GDI for PostScript creation).
    (3)     Rather than printing to File and distilling, try printing directly to the Adobe PDF PostScript printer driver instance.
              - Dov

  • Convert document color mode to Pantone/Spot

    I have a document in which i have 2 layers, each layer contains shapes. one layer is supposed to be Pantone 293, the other layer is Pantone 296. right now, the colors are in RGB. I saved as is, then saved as PDF and the printer whom im sending this to, said the PDF printed out in 4 plates (CMYK) and i need only 2 plates, hence, i need the document to be in a spot color mode. How can i do this? How do i convert the colors i used in the shapes now to spot colors in CS3 version?

    First I recommend changing the document to CMYK mode.
    Here is the traditional fix: Window: Swatch Libraries: Color Books: Then select a Pantone Solid library. Show the Find field and type in your numbers. Double click the color chip to add it to your Swatch panel.
    In the Swatch panel: Add Used Colors. To replace the global colors you are using currently, click on the Pantone swatch first, then the current swatch and select "Merge Swatches."
    If you have lots of different shades of colors, you will have to create tints of the two spot colors.
    Check your results using Window: Separations Preview to make certain you don't have CMYK being used. If your document is RGB, you will not be able to utilize Separations Preview (that's why I suggested the mode change)
    You can also use Edit: Edit Colors: Recolor Artwork to make global color changes. But this is a somewhat complex dialog and takes getting used to. I recommend familiarizing yourself with this tool before using it in live production.

  • Convertion from Char to Hex

    Hi Experts,
    I have a requirement to convert char type to Hex type.
    I have two structures. one is Character type and other is hex type like below.
    data: v_hex(300) type h,
            v_char(300) type c.
    When we move v_char(300) to v_char(300), it is working fine in 4.6 system.
    But it is giving unicode error in ECC 6.0. So i have changed the statement to v_hex = v_char.
    There is no syntax error but it is not converting the same.
    Please post your replies. Thanks in advance.

    REPORT  ZSRK_039                                .
    DATA: V_HEX(300) TYPE X,
          V_CHAR(300) TYPE C.
    V_CHAR = 'Test'.
    PERFORM CHAR_TO_HEX_CONV USING V_CHAR
                             CHANGING V_HEX.
    WRITE : / V_HEX.
    *&      Form  CHAR_TO_HEX_CONV
          text
         -->P_V_CHAR  text
         <--P_V_HEX  text
    FORM CHAR_TO_HEX_CONV  USING    CH TYPE C
                           CHANGING CH1 TYPE X.
      FIELD-SYMBOLS : <FS_TR> TYPE X.
      ASSIGN CH TO <FS_TR> CASTING TYPE X .
      CH1 = <FS_TR>.
    ENDFORM.                    " CHAR_TO_HEX_CONV

Maybe you are looking for

  • Mass maintainance of material master

    Dear Gurus, We want to maintain some missing field on the MRP views of the material masters for all materials(FERT, HALB AND ROH). Pls what T-CODE or how can we maintain this since the materials are up to 10,000 in all. Thanks

  • CATS ESS Applying check only for release  Action....

    Hi all , I have one requirement for applying some chceks at the time of releasing  time sheet items . Currently I have applied the validation checks in a user exit ZXCATU03 . But here if am applying the check its working for all levels .... Like for

  • Plant adress change in enterprise structure .

    Hi All,         During print preview of purchase order in delivery address only plant name is coming which it is taking from the delivery address maintained in Item detail of PO .This address is fetched from the plant address maintained in SPRO-> ent

  • Photoshop CC Window- Extensions Menu Greyed Out

    This is Windows 8.1 In Photoshop CC the Window->Extensions Menu is greyed out. I have installed Adobe Extension Manager CC and installed Adobe Exchange 1.1.0. When running photoshop CS6 the Windows->Extensions Menu is visible. Also in Mac OSX 10.9 Ph

  • My poof of smoke is not working

    hi when i try to delete an icon with the poof of smoke it does not do it it just goes straight to the dock again