Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Preflight Pre-Press

Contributor ,
Sep 29, 2015 Sep 29, 2015

Olá a todos,

Estamos escrevendo um Script para Preflight de Pre-Press e estamos com dificuldades para inserir alguns ítens.

É possível verificar overprint em branco, preto composto e cor spot em objeto?

Abaixo segue o que conseguimos até o momento.

Agradeço a ajuda!

// Turn debugging mesages on or off

var debugThisScript = false;

var xdebugThisScript = false;

var scriptVersion = "0.1";

// find active document

var theDoc = app.activeDocument;

// Arrays to hold details on the problem elements we find.

var badBlackType = new Array();

var badBlackIndex = 0;

var badOverprintType = new Array();

var badOverprintIndex = 0;

var badFillColorType = new Array();

var badFillColorIndex = 0;

// Keep track if we are accidentally in RGB color mode

var badColorMode = 0;

// Check document color space

if ( theDoc.documentColorSpace == DocumentColorSpace.CMYK ) {

  //all good

  debugln( "Document color space is CMYK." )

} else {

  debugln( "Document color space is RGB." )

  badColorMode = 1;

}

var dlg;

// Loop thru all text frames in document

for ( var i = 0; i < theDoc.textFrames.length; i ++ ) {

  var item = theDoc.textFrames;

  debugln( "Starting processing of text frame # " + i );

  debugln( "  Name:         " + item.name );

  debugln( "  Type:         " + item.typename );

  debugln( "  Parent name:  " + item.parent.name );

  debugln( "  Parent type:  " + item.parent.typename );

  //debugln( "  Contents:     " + item.contents );

  if ( item.typename == 'TextFrame' ) {

  

       debugln( '' );

  var badType = "";

  

    //for ( var ci = 0; ci < item.characters.length; ci++ ) {

    //}

  

    var inBadBlackType = false;

  var inBadOverprintType = false;

  var inBadFillColorType = false;

  

    for ( var j = 0; j < item.textRanges.length; j++ ) {

  

    var tr = item.textRanges;

  

    // xdebugln( 'text range is ' + tr.contents );

           

           

            var fillColor;

            try {

                xdebugln( tr.contents + ' ' + inBadFillColorType + ' ' + badFillColorIndex);

     fillColor = tr.characterAttributes.fillColor;

                if ( inBadFillColorType ) {

                   xdebugln ( '--------- i am here --------- ' );

                  inBadFillColorType = false;

                  badFillColorIndex++;

                 }

            } catch ( e ) {

              if ( ! inBadFillColorType ) {

    inBadFillColorType = true;

    badFillColorType[ badFillColorIndex ] = new Object();

    badFillColorType.contents = "";

    }

  

    if ( typeof( badFillColorType[badFillColorIndex].contents )=="undefined" ) {

    badFillColorType[badFillColorIndex].contents = tr.contents;

    } else {

    badFillColorType[badFillColorIndex].contents += tr.contents; 

    }

  

                continue;

            }

    //var fillColor = tr.characterAttributes.fillColor;

  

  

    var c = undefined;

    var m = undefined;

    var y = undefined;

    var k = undefined;

  

  

    // we have CMYK type.

    if ( fillColor.typename == "CMYKColor" ) {

    c = fillColor.cyan;

    m = fillColor.magenta;

    y = fillColor.yellow;

    k = fillColor.black;

  

    } else if ( fillColor.typename == "SpotColor" ) {

  

    var theSpot = fillColor.spot;

  

    if ( theSpot.color.typename == "CMYKColor" ) {

    c = theSpot.color.cyan;

    m = theSpot.color.magenta;

  y = theSpot.color.yellow;

    k = theSpot.color.black;

  

      }

    }  else if ( fillColor.typename == "GrayColor" ) {

    c = 0; m = 0; y = 0;

    k = fillColor.gray;

    }

  

    // Check for bad type

    if ( k > 60 && c+m+y > 0 ) {

    if ( ! inBadBlackType ) {

    inBadBlackType = true;

    badBlackType[ badBlackIndex ] = new Object();

    badBlackType.contents = "";

    }

    if ( typeof( badBlackType[badBlackIndex].contents )=="undefined" ) {

    badBlackType[badBlackIndex].contents = tr.contents;

    } else {

    badBlackType[badBlackIndex].contents += tr.contents; 

    }

  badBlackType[badBlackIndex].cmyk     = "" + c + " " + m + " " + y + " " + k;

  inBadBlackType = true;

    } else {

    if ( inBadBlackType == true ) {

    inBadBlackType = false;

    badBlackIndex++;

    }

    }

 

    // Check for overprint white type.

    if ( ( c + m + y + k ) == 0  && tr.characterAttributes.overprintFill ) {

    if ( ! inBadOverprintType ) {

    inBadOverprintType = true;

    badOverprintType[ badOverprintIndex ] = new Object();

    badOverprintType.contents = "";

    }

    if ( typeof( badOverprintType[badOverprintIndex].contents )=="undefined" ) {

    badOverprintType[badOverprintIndex].contents = tr.contents;

    } else {

    badOverprintType[badOverprintIndex].contents += tr.contents; 

    }

  badOverprintType[badOverprintIndex].cmyk     = "" + c + " " + m + " " + y + " " + k;

  inbadOverprintType = true;

    } else {

    if ( inBadOverprintType == true ) {

    inBadOverprintType = false;

    badOverprintIndex++;

    } 

    }

  

  

  

    debugln( "--> " + tr.contents + " is " + fillColor.typename + " " + c + " " + m + " " + y + " " + k );

  

  

  

  

    }

  

    // out of textframe. reset inFlag. increment index by 1 if still in;

    if ( inBadBlackType ) {

    badBlackIndex++;

    }

    // out of textframe. reset inFlag. increment index by 1 if still in;

    if ( inBadOverprintType ) {

    badOverprintIndex++;

    }

  

    if ( inBadFillColorType ) {

    badFillColorIndex++;

    }

  

  

  

    

      //item.contents = mapData[dataType][ key ].text;

  //item.textRange.characterAttributes.fillColor = getColorfromString( mapData[dataType][ key ].fillCMYK );

    

    }

}

var numProblems = badColorMode + badBlackType.length + badOverprintType.length + badFillColorType.length;

var resultsMsg = "";

if ( numProblems > 0 ) {

  resultsMsg +=  "Lista de problemas apresentados \"" + theDoc.name + "\"\n";

  resultsMsg +=  '\n';

  if ( badColorMode ) {

  alertMsg += "\nSeu documento está em RGB, converta para CMYK.\n"

  resultsMsg +=  'SEU DOCUMENTO ESTÁ EM RGB, CONVERTA PARA CMYK\n';

  resultsMsg +=  '==================================================================\n';

  resultsMsg +=  "File>Document Color Mode>CMYK Color.\n";

  resultsMsg +=  '\n';

  }

  if ( badBlackType.length  ) {

  alertMsg += "\nYour document has " +  badBlackType.length + " pieces of 4-color black type."

  resultsMsg +=  'PRETO COMPOSTO!!\n';

  resultsMsg +=  '================================================\n';

  for ( var i=0; i<badBlackType.length; i++ ) {

  debugln("");

  debugln("-------------------------");

  debugln("Bad 4-color black type")

  debugln( badBlackType.contents );

  debugln( badBlackType.cmyk );

  resultsMsg += badBlackType.contents + "\n";

  }

  resultsMsg +=  '\n';

  }

  if ( badFillColorType.length  ) {

  alertMsg += "\nYour document has " +  badFillColorType.length + " pieces of type with invalid CMYK specs."

  resultsMsg +=  'BRANCO COM OVERPRINT EM FONTE\n';

  resultsMsg +=  '(Verifique seu documento!)\n';

  resultsMsg +=  '================================================\n';

  for ( var i=0; i<badFillColorType.length; i++ ) {

  debugln("");

  debugln("-------------------------");

  debugln(" type")

  debugln( badFillColorType.contents );

  debugln( badFillColorType.cmyk );

  resultsMsg += badFillColorType.contents + "\n";

  }

  resultsMsg +=  '\n';

  }

  if ( badOverprintType.length  ) {

  alertMsg += "\nYour document has " +  badOverprintType.length + " pieces of overprinting white type."

  resultsMsg +=  'BRANCO COM OVERPRINT EM FONTE\n';

  resultsMsg +=  '================================================\n';

  for ( var i=0; i<badOverprintType.length; i++ ) {

  debugln("");

  debugln("-------------------------");

  debugln("Overprinting white type")

  debugln( badOverprintType.contents );

  resultsMsg += badOverprintType.contents + "\n";

  }

  resultsMsg += '\n';

  }

} else {

  resultsMsg = 'Seu documento está OK.';

}

displayAlert( resultsMsg );

function displayAlert( msg ) {

  dlg = new Window('dialog', 'Preflight Scriba');

  var msgPnl = dlg.add('panel', undefined, 'Preflight Scriba');

  msgPnl.orientation = 'row';

  msgPnl.report = msgPnl.add('edittext', undefined, msg,{multiline:true});

  msgPnl.report.preferredSize = [600,400];

  var btnPnl = dlg.add('group', undefined, '');

  btnPnl.orientation = 'row'

  btnPnl.cancelBtn = btnPnl.add('button', undefined, 'Cancel', {name:'cancel'});

  btnPnl.cancelBtn.onClick = function() { dlg.close() };

  dlg.show();

}

app.redraw();

function getCMYKfromString( s ) {

      var cmyk      = s.split( "," );

    

      var color     = new CMYKColor();

      color.cyan    = cmyk[0];

      color.magenta = cmyk[1];

  color.yellow  = cmyk[2];

  color.black   = cmyk[3];

  return color;

}

function getColorfromString( s ) {

  var colorType = '';

  var colorData = '';

  if ( s.match( ":" ) ) {

  var colorParts = s.split( ':' );

  colorType = colorParts[0];

  colorData = colorParts[1];

  } else {

  colorType = 'CMYK';

  colorData = s;

  }

  var color;

  debugln( '    --> Color type: '  + colorType ) ;

  debugln( '    --> Color data: '  + colorData ) ;

  if ( colorType == 'CMYK' ) {

    var cmyk      = s.split( "," );

    

      color     = new CMYKColor();

      color.cyan    = cmyk[0];

      color.magenta = cmyk[1];

  color.yellow  = cmyk[2];

  color.black   = cmyk[3];

  } else if ( colorType == 'Swatch' ) {

  try {

  if ( theDoc.swatches[colorData] ) {

  var swatch = theDoc.swatches[colorData];

  color = swatch.color;

  }

  } catch (e) {

  alert( "The swatch " + colorData + " doesn’t exist" );

  }

  }

  return color;

}

true;

//////////////////////////////////////////

// Functions start here

function getNewName(sourceDoc, destFolder) {

  var docName = sourceDoc.name;

  var ext = '.jpg'; // new extension for pdf file

  var newName = "";

  // if name has no dot (and hence no extension,

  // just append the extension

  if (docName.indexOf('.') < 0) {

  newName = docName + ext;

  } else {

  var dot = docName.lastIndexOf('.');

  newName += docName.substring(0, dot);

  newName += ext;

  }

  newName = newName.replace( / /g, '-' );

  // Create a file object to save the pdf

  saveInFile = new File( destFolder + '/' + newName );

  return saveInFile;

}

function debugln ( s ) {

  if ( debugThisScript ) {

  $.writeln( s );

  }

}

function xdebugln ( s ) {

  if ( xdebugThisScript ) {

  $.writeln( s );

  }

}

TOPICS
Scripting
2.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Oct 01, 2015 Oct 01, 2015

Olá amigo, segue abaixo o script que escrevi para os Pretos Compostos e os Brancos Overprints, ele irá remover em tempo de execução e então notificará as alterações feitas!

Para trabalhar com todos os objetos existentes no documento use a propriedade pageItems[ ].

Agora quanto a sua dúvida em relação a cor spot não entendi bem o que deseja fazer.

Abraço.

function preflight(){ 

    if(app.documents.length == 0){return}; 

var totalItens = app.activeDocument.pageItems.length;

var totalPretoCompost

...
Translate
Adobe
Contributor ,
Sep 29, 2015 Sep 29, 2015

Boa noite LeoMari, interessante eu trabalho em uma gráfica e já trabalhei com Preflight e Pre-press por aqui, enfim, em vez de eu interpretar todo o código que já criou acho melhor você me dizer qual é o objetivo do seu projeto, "fazer isso ou aquilo e tal", e o que está tendo problemas em fazer, espero poder ajudar de alguma forma, talvez algumas coisas eu já tenha desenvolvido e sejam úteis.

Certamente seu projeto também me será útil.

Abraço.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 30, 2015 Sep 30, 2015

Olá Vinícius, trabalho em uma editora onde temos vários ilustradores externos e estamos querendo padronizar as questões técnicas das imagens que recebemos (Vetor). Criamos uma action (se quiser dar uma olhada, envio pra você) pra aplicar overprint em preto 100% e remover quando aplicado em branco mas nem sempre é usada. A idéia é ter um preflight que acusa os problemas do arquivo, assim podemos dar um retorno mais rápido para o ilustrador. Trabalhamos com o preflight do Indesign mas nem todas as máquinas possuem o Indesign, por isso a ideia de fazer no Illustrator.

No script que estamos desenvolvendo ele avalia se o arquivo está em RGB, se há preto nas 4 cores, overprint em branco e cor spot mas funciona apenas em fonte, queremos avaliar objeto também.

Obrigado pela atenção.

Abraço!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 30, 2015 Sep 30, 2015

Olá agradeço se puder enviar sua action, quanto as leituras dos objetos acredito que seja possível fazer sim, só uma dúvida se conseguirmos identificar os problemas não seria melhor já corrigi-los em tempo de execução ou alguns casos existem excessões? Enfim, estarei dando uma olhada no seu script e te dou um retorno assim que possível.

Abraço.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 30, 2015 Sep 30, 2015

Seria ótimo corrigir durante a execução mas ai já é muito pra mim.. Preciso da ajuda de quem entende..rs

Se puder divulgar seu e-mail, envio a action pra vc conferir. Acho que da pra transforma-la em um script..

Abraço!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Oct 01, 2015 Oct 01, 2015

LeoMari wrote:    We are writing the script ... Below is what we have Achieved so far.

??? Credit: mericson on Oct 10, 2013

illustrator-scripts/Preflight.jsx at master · mericson/illustrator-scripts · GitHub

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 01, 2015 Oct 01, 2015

Peguei boa parte de outro lugar W_J_T e estamos adaptando para nossa realidade. O correto então seria "Estamos adaptando e escrevendo...". De qualquer maneira, crédito seja dado ao Mericson caso seja ele o autor do original..

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 01, 2015 Oct 01, 2015

Olá amigo, segue abaixo o script que escrevi para os Pretos Compostos e os Brancos Overprints, ele irá remover em tempo de execução e então notificará as alterações feitas!

Para trabalhar com todos os objetos existentes no documento use a propriedade pageItems[ ].

Agora quanto a sua dúvida em relação a cor spot não entendi bem o que deseja fazer.

Abraço.

function preflight(){ 

    if(app.documents.length == 0){return}; 

var totalItens = app.activeDocument.pageItems.length;

var totalPretoComposto = 0;

var totalBrancoOverprint = 0;

var items = app.activeDocument.pageItems;

//cria preto 100%

var preto = new CMYKColor;

preto.cyan = 0;

preto.magenta = 0;

preto.yellow = 0;

preto.black = 100;

//loop em todos os itens existentes no documento, transforma todos vetores preto composto em preto 100%

for (i = 0; i < totalItens; i++){

    if(items.typename == 'PathItem'){

        //preto composto vetores preenchimento

        if ((items.fillColor.cyan + items.fillColor.magenta + items.fillColor.yellow > 0)  && items.fillColor.black == 100){

            items.fillColor = preto;

            totalPretoComposto++;

        };

        //preto composto vetores contorno       

        if ((items.strokeColor.cyan + items.strokeColor.magenta + items.strokeColor.yellow > 0)  && items.strokeColor.black == 100){

            items.strokeColor = preto;

            totalPretoComposto++;

        };

   

        //remove overprint em branco preenchimento

        if (items.fillColor.cyan == 0 && items.fillColor.magenta == 0 && items.fillColor.yellow == 0 && items.fillColor.black == 0){

            if (items.fillOverprint == true){

            items.fillOverprint = false;

            totalBrancoOverprint++;

            };

        };

        //remove overprint em branco contorno

        if (items.strokeColor.cyan == 0 && items.strokeColor.magenta == 0 && items.strokeColor.yellow == 0 && items.strokeColor.black == 0){

            if (items.strokeOverprint == true){

            items.strokeOverprint = false;

            totalBrancoOverprint++;

            };

        };

   

    };

    if(items.typename == 'TextFrame'){

        for ( var j = 0; j < items.textRanges.length; j++ ) { 

            //preto composto textos preenchimento    

            if ((items.textRanges.fillColor.cyan + items.textRanges.fillColor.magenta + items.textRanges.fillColor.yellow > 0) && items.textRanges.fillColor.black == 100){

                items.textRanges.fillColor = preto;

                totalPretoComposto++;

            };

            //preto composto textos contorno           

            if ((items.textRanges.strokeColor.cyan + items.textRanges.strokeColor.magenta + items.textRanges.strokeColor.yellow > 0) && items.textRanges.strokeColor.black == 100){

                items.textRanges.strokeColor = preto;

                totalPretoComposto++;

            };

            //remove overprint de branco textos preenchimento

            if (items.textRanges.fillColor.cyan == 0 && items.textRanges.fillColor.magenta == 0 && items.textRanges.fillColor.yellow == 0 && items.textRanges.fillColor.black == 0){

                if (items.textRanges.characterAttributes.overprintFill == true){

                    items.textRanges.characterAttributes.overprintFill = false;

                    totalBrancoOverprint++;

                };

            };

            //remove overprint de branco textos contorno       

            if (items.textRanges.strokeColor.cyan == 0 && items.textRanges.strokeColor.magenta == 0 && items.textRanges.strokeColor.yellow == 0 && items.textRanges.strokeColor.black == 0){

                if (items.textRanges.characterAttributes.overprintStroke == true){

                    items.textRanges.characterAttributes.overprintStroke = false;

                    totalBrancoOverprint++;

                };

            };

        };

       

    };

   

};

//resultados

alert('\n' + totalPretoComposto + ' = Item(s) com preto composto transformados em preto 100%.' + '\n' + totalBrancoOverprint + ' = Item(s) com branco overprint.');

};

preflight ();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 01, 2015 Oct 01, 2015

Muito bom Vinicius, incorporei seu script no que postei acima e estou escrevendo pra colocar overprint em todos os pretos 100%.

Além do preto com overprint, também vou precisar colocar em uma cor spot que é a cor resposta para o professor, a diferença do livro do aluno para o do professor é uma cor Spot que imprimimos pro professor e desligamos para o aluno. Essa cor tem que estar com overprint por que se a resposta estiver encima de algum fundo, vai preservar o espaço daquela cor e dar a resposta ao aluno.

Mais uma vez obrigado pela ajuda!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 01, 2015 Oct 01, 2015

Obrigado, é bom poder ajudar rs, boa sorte com seu desenvolvimento, qualquer dúvida, vá postando aqui que tentamos te ajudar, para o preto sempre overprint duplique as partes do codigo onde remove o overprint do branco e edite desta forma:

        if (items.strokeColor.cyan == 0 && items.strokeColor.magenta == 0 && items.strokeColor.yellow == 0 && items.strokeColor.black == 100){

            if (items.strokeOverprint == false){

            items.strokeOverprint = true;

            };

        };

A cor spot já existe e tudo que estiver nessa cor pretende deixar overprint? Estarei fazendo uns testes e se conseguir te aviso blz?

Abraço.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 01, 2015 Oct 01, 2015

Maravilha.. a cor spot pode existir ou não, se existir deverá estar em oveprint.. Normalmente chamamos de CorProf em spot, magenta 100%.

Mais uma vez obrigado!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 02, 2015 Oct 02, 2015

Funcinou Vinicius, consegui aplicar overprint em todos os pretos 100%. Agora estou tentando resolver a cor spot..

Valeu!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 02, 2015 Oct 02, 2015

Fiz uma mudança no Script. Tirei a parte que remove o overprint do branco e coloquei no início algumas linhas pra remover todos os overprints. Assim, no final ele coloca só no preto..

Está ficando bacana, falta só aplicar over na minha cor spot..rs

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 03, 2015 Oct 03, 2015

Isso ae Leo, parabéns fico feliz em saber que está alcançando seus objetivos. Em tempo, mesmo esquema das demais coisas, segue o padrão para a CorProf:

        if (items.fillColor.typename == 'SpotColor'){

            if (items.fillColor.spot.name == 'CorProf'){ 

                items.fillOverprint = true; 

                totalCorProfOverprint++;

            }; 

        };

Se tiver mais dúvidas manda aqui, ou vá criando outros tópicos para respondermos, ficarei feliz se vc puder compartilhar o resultado final conosco.

Se preferir, vbaptistacg@gmail.com

Até mais, abraço!

-Vinícius

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 23, 2018 Nov 23, 2018

Hi Vinicius Baptista

Your Script has worked good. But I need to select overprinted white text and objects. kindly help me to do this script.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 26, 2018 Nov 26, 2018

Hi kalaimanis71535121​ how are you?

If you want to select all white overprint(s) objects after running the script, you must simply insert this ( .selected = true; ) at each true condition like this....

        if (items.fillColor.cyan == 0 && items.fillColor.magenta == 0 && items.fillColor.yellow == 0 && items.fillColor.black == 0){ 

            if (items.fillOverprint == true){ 

            items.fillOverprint = false;

            totalBrancoOverprint++;

               //This way...

            items.selected = true;

            }; 

        }; 

Try and let me know if work...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 26, 2018 Nov 26, 2018
LATEST

Yes, it is working good.

thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines