Ai file loses color profile after processing.

Post Reply
PdFUser5000
Member
Posts: 81
Joined: Fri Jun 12, 2020 11:23 am

Ai file loses color profile after processing.

Post by PdFUser5000 » Tue Jan 19, 2021 2:22 pm

I have an illustrator element which makes PDFs from ai files. After this process the ai file loses it's color profile. what can cause this?
In the element i use a script for the Command part, and Illustrator in the Save as option.

freddyp
Advanced member
Posts: 607
Joined: Thu Feb 09, 2012 3:53 pm

Re: Ai file loses color profile after processing.

Post by freddyp » Tue Jan 19, 2021 5:08 pm

There is an Illustrator save option that determines whether or not the ICC profile should be included and the default is "false". That probably explains why saving as Illustrator loses it.

This being said, you should not save the PDF with a script for the Command property, but just with the standard "Save as" functionality to save it as PDF. If you also want to keep the Illustrator file and continue with it in the flow, then simply send the AI file both to the configurator and to another folder that continues in the flow.

PdFUser5000
Member
Posts: 81
Joined: Fri Jun 12, 2020 11:23 am

Re: Ai file loses color profile after processing.

Post by PdFUser5000 » Wed Jan 20, 2021 7:47 am

freddyp wrote:
Tue Jan 19, 2021 5:08 pm
There is an Illustrator save option that determines whether or not the ICC profile should be included and the default is "false". That probably explains why saving as Illustrator loses it.

This being said, you should not save the PDF with a script for the Command property, but just with the standard "Save as" functionality to save it as PDF. If you also want to keep the Illustrator file and continue with it in the flow, then simply send the AI file both to the configurator and to another folder that continues in the flow.
We cannot use Save as to make PDFs because of our printing software's settings. I can use my PDF making script in the Save as option of the Illustrator element. But doing it this way i get no output from the element which i need to measure the time spent on making PDFs.
There is an option to get only a log as the output from the Illustrator element. Is it possible to create this log with a script? What are the requirements for this log file format?

//Edit: found a somewhat solution. Since after the pdf making i only need the illustrator file for it's metadata, i save it as a pdf in the element with the smallest size. from there i can extract the metadata to my following processes.

freddyp
Advanced member
Posts: 607
Joined: Thu Feb 09, 2012 3:53 pm

Re: Ai file loses color profile after processing.

Post by freddyp » Wed Jan 20, 2021 9:12 am

We cannot use Save as to make PDFs because of our printing software's settings
I do not understand that one. Are you referring to a specific custom PDF preset you have to use? In that case add it to the AI on Switch and choose it from the list.

You can of course add your script to the "Save as" property. That is certainly more logical than adding it to "Command". From your script you cannot control the Log output of the element. If you want to create your own log file with a timing on how long the script ran, how many images there are in the file, what the document's ICC profile is, etc. I suggest you save the PDF and your own log file in $outfolder, add the paths to the array $outfiles and set $jobfolder to the name you want for the job folder in Switch. Once you have the job folder in Switch you could do an XML pickup (if your log file is an XML) or you could dismantle it.

Read more here: https://www.enfocus.com/manuals/UserGui ... tions.html

PdFUser5000
Member
Posts: 81
Joined: Fri Jun 12, 2020 11:23 am

Re: Ai file loses color profile after processing.

Post by PdFUser5000 » Mon Jan 25, 2021 12:18 pm

freddyp wrote:
Wed Jan 20, 2021 9:12 am
We cannot use Save as to make PDFs because of our printing software's settings
I do not understand that one. Are you referring to a specific custom PDF preset you have to use? In that case add it to the AI on Switch and choose it from the list.

You can of course add your script to the "Save as" property. That is certainly more logical than adding it to "Command". From your script you cannot control the Log output of the element. If you want to create your own log file with a timing on how long the script ran, how many images there are in the file, what the document's ICC profile is, etc. I suggest you save the PDF and your own log file in $outfolder, add the paths to the array $outfiles and set $jobfolder to the name you want for the job folder in Switch. Once you have the job folder in Switch you could do an XML pickup (if your log file is an XML) or you could dismantle it.

Read more here: https://www.enfocus.com/manuals/UserGui ... tions.html
We are using Adobe PDF printer to make pdfs from the ai file. This requires some extra steps to get the PDFs with metadata, but it's manageable. I just need the illustrator element to not save the file at all, because on some occasions the file is very big and it takes a lot of time. But i also need the file to move through the element so that i can measure the time spent on making PDFs. Saving the ai as a pdf with the smallest file size preset seems to be the best solution at the moment. I will try, if we can make the illustrator element close the file without saving with a script.

freddyp
Advanced member
Posts: 607
Joined: Thu Feb 09, 2012 3:53 pm

Re: Ai file loses color profile after processing.

Post by freddyp » Mon Jan 25, 2021 1:59 pm

Code: Select all

$doc.close( SaveOptions.DONOTSAVECHANGES );

flussidicaio
Newbie
Posts: 19
Joined: Thu May 03, 2018 6:07 pm

Re: Ai file loses color profile after processing.

Post by flussidicaio » Thu Feb 25, 2021 12:56 am

freddyp wrote:
Mon Jan 25, 2021 1:59 pm

Code: Select all

$doc.close( SaveOptions.DONOTSAVECHANGES );
HI,
I have the same need
I used "$doc.close(SaveOption.DONOTSAVECHANGES)" in the "Save as" script but does not work.
this is my script:

Code: Select all

var $outfiles= [];
var $jobfolder = $arg1

	try {
		
		$doc.close(SaveOptions.DONOTSAVECHANGES)
		$outfiles.push($outfolder + '/' + $doc);
	}
	catch(theError) {
		$doc.close(SaveOptions.DONOTSAVECHANGES);
		$error = theError.description;
		
	}
the error returned is:
C:\ProgramData\Enfocus\Switch\13.1\scripted-plugins\com.enfocus.AdobeIllustrator\Illustrator_SaveAsPDF.vbs(42, 26) Adobe Illustrator: Error 45: Object is invalid. Line: 280 -> $doc.close(SaveOptions.DONOTSAVECHANGES)
what am I doing wrong?

freddyp
Advanced member
Posts: 607
Joined: Thu Feb 09, 2012 3:53 pm

Re: Ai file loses color profile after processing.

Post by freddyp » Thu Feb 25, 2021 8:43 am

It is the SaveOptions variable that is not defined. Add the line:

Code: Select all

 var SaveOptions = new IllustratorSaveOptions();

flussidicaio
Newbie
Posts: 19
Joined: Thu May 03, 2018 6:07 pm

Re: Ai file loses color profile after processing.

Post by flussidicaio » Thu Feb 25, 2021 11:01 pm

freddyp wrote:
Thu Feb 25, 2021 8:43 am
It is the SaveOptions variable that is not defined. Add the line:

Code: Select all

 var SaveOptions = new IllustratorSaveOptions();
Does not work... the same error return.. :cry:

freddyp
Advanced member
Posts: 607
Joined: Thu Feb 09, 2012 3:53 pm

Re: Ai file loses color profile after processing.

Post by freddyp » Fri Feb 26, 2021 1:35 pm

I finally tried it :D

When using a script for the "Save as" property Switch closes $doc without saving any changes after your script has run, IF $doc is not null. So when you close the document in your script there is no active document anymore and $doc is invalid but not null, so you should make sure to set $doc to null. But hey, Switch already does what you want to do, so you literally have to do nothing: just use an empty script file.

I think this qualifies for the epithet "Easiest script ever!" :lol:

flussidicaio
Newbie
Posts: 19
Joined: Thu May 03, 2018 6:07 pm

Re: Ai file loses color profile after processing.

Post by flussidicaio » Sat Feb 27, 2021 5:26 pm

freddyp wrote:
Fri Feb 26, 2021 1:35 pm
...just use an empty script file.
I think this qualifies for the epithet "Easiest script ever!" :lol:
:shock: an empty script?! too hard for me I couldn't get it

PLEASE look at my tests, i tried different cases:

1) SWITCH PROPERTY ARE:
a) open: automatic
b) command: none
c) save as: empty script
in this test illustrator starts, opens the document and closes it without save, BUT the file does NOT move through connection, remains in the input folder
the LOG is:
Job processing successfully completed!
2) SWITCH PROPERTY ARE:
a) open: automatic
b) command: script (export artboards in separate PDFs)
c) save as: empty script
in this case command script is successful: artboards move through connection....
the LOG is:
Job _00T2L_FolderArtBoards was placed in folder Folder 2
Nothing about illustrator file. Illustrator file DISAPPEARS!

3) SWITCH PROPERTY ARE:
a) open: automatic
b) command: script (export artboards in separate PDFs)
c) save as: this script:
var $doc = app.activeDocument;
var $outfiles = [];
var $jobfolder = $arg2

$outfiles.push ($outfolder+'/'+$doc);
in this case illustrator file move to problem job.
the LOG is:
Cannot send job: path 'C:/Users/switch.PRINTABLE/AppData/Roaming/Enfocus/Switch Server/temp/6/ScriptElement/34/71/[Document _00T2M_T2800New_SX.ai]' does not exist
then....
I chose 2, with a workaround: the flow copies illustrator file before illustrator element.

I suggest adding in the save as property "close without save". It would be very useful because often adobe files can be very big and saving takes a long time

freddyp
Advanced member
Posts: 607
Joined: Thu Feb 09, 2012 3:53 pm

Re: Ai file loses color profile after processing.

Post by freddyp » Mon Mar 01, 2021 8:38 am

The empty script worked for me, but it is certainly more logical to add the line:

Code: Select all

$outfiles = [$infile];
//or if you already have other paths on the $outfiles array:
$outfiles.push($infile);
to tell Switch that the input file is actually (one of) the output file(s).

A remark about

Code: Select all

var $doc = app.activeDocument;
$doc is app.activeDocument, so it is not necessary.

And about:

Code: Select all

$outfiles.push ($outfolder+'/'+$doc);
The array $outfiles should contain paths as strings. $doc is not a string, but an object. $doc.name is what you need.

flussidicaio
Newbie
Posts: 19
Joined: Thu May 03, 2018 6:07 pm

Re: Ai file loses color profile after processing.

Post by flussidicaio » Wed Mar 17, 2021 4:01 pm

Code: Select all

$outfiles.push($infile);
Yesss, this line is what I need....
it was easy to see it now :oops:
Tank you!!

PdFUser5000
Member
Posts: 81
Joined: Fri Jun 12, 2020 11:23 am

Re: Ai file loses color profile after processing.

Post by PdFUser5000 » Mon Mar 29, 2021 1:13 pm

freddyp wrote:
Mon Mar 01, 2021 8:38 am
The empty script worked for me, but it is certainly more logical to add the line:

Code: Select all

$outfiles = [$infile];
//or if you already have other paths on the $outfiles array:
$outfiles.push($infile);
to tell Switch that the input file is actually (one of) the output file(s).
This also worked for me, thanks!

Post Reply