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

return to unrasterized state

Participant ,
May 20, 2016 May 20, 2016

Copy link to clipboard

Copied

Still in the process of writing a script to use variable data to save out print files and have come across having to rasterize one of the variable text fields.  Without using the obvious undo(); cause that doesn't work within a loop,  is there a way to return to an un-rasterized state? Any ideas are welcome.

TOPICS
Scripting

Views

1.0K

Translate

Translate

Report

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

Enthusiast , May 22, 2016 May 22, 2016

How can that make file larger if you delete it when finished?

Any way, you sure can use undo() within you for loop, simply add one line: app.redraw(), then app.undo(). Try this:

var t = activeDocument.textFrames.add();

t.contents = "welcome back!"

app.redraw();

for (var i = 1; i < 6; i++) {

    t.contents = "Hello, here comes " + i;

    app.redraw();

    alert(t.contents);

    app.undo();

    alert(t.contents);

};

app.undo();

Votes

Translate

Translate
Adobe
Valorous Hero ,
May 20, 2016 May 20, 2016

Copy link to clipboard

Copied

Can you elaborate more on the exact scenario where rasterizing is required?

Are you open to instead use the Rasterize Effect, which provides benefits of rasterizing while also retaining your base art?

Votes

Translate

Translate

Report

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
Participant ,
May 20, 2016 May 20, 2016

Copy link to clipboard

Copied

As the variable changes the text, each text area needs to be rasterized due to complicated fills (Camo, Carbon Fill etc).  Then un-rasterize to change to the next variable in line.  Make sense? I am using this with the last script you had helped me with.  Which I still owe you for. Thanks again.

Votes

Translate

Translate

Report

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
Enthusiast ,
May 20, 2016 May 20, 2016

Copy link to clipboard

Copied

Why not duplicate the text item and delete it when finish?

Votes

Translate

Translate

Report

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
Participant ,
May 21, 2016 May 21, 2016

Copy link to clipboard

Copied

Duplicating will only make the file larger.  I would rather keep the original element intact.

Votes

Translate

Translate

Report

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
Enthusiast ,
May 22, 2016 May 22, 2016

Copy link to clipboard

Copied

How can that make file larger if you delete it when finished?

Any way, you sure can use undo() within you for loop, simply add one line: app.redraw(), then app.undo(). Try this:

var t = activeDocument.textFrames.add();

t.contents = "welcome back!"

app.redraw();

for (var i = 1; i < 6; i++) {

    t.contents = "Hello, here comes " + i;

    app.redraw();

    alert(t.contents);

    app.undo();

    alert(t.contents);

};

app.undo();

Votes

Translate

Translate

Report

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
Participant ,
May 22, 2016 May 22, 2016

Copy link to clipboard

Copied

The text already has a repetitive fill in it, then to duplicate and rasterize another on top of it would make it a much larger file.  Make sense.

Anyhoo. i will try the above to see if I can get the desired result.  Thanks for the help M.

Votes

Translate

Translate

Report

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
Community Expert ,
May 23, 2016 May 23, 2016

Copy link to clipboard

Copied

If i understand correctly, moluapple is suggesting that you delete the duplicate when you're done, ergo, the file size does not change.

if you have:

var art = (the vector art you want to rasterize)

var artCopy = art.duplicate();

artCopy.rasterize() // this is not the right syntax. i don't use rasterization in my workflow so i haven't learned it yet, but you get the point.

doFunctionOnRasterizedArt(param1,param2)

artCopy.remove();

This way you can do whatever function you need to do on the rasterized art, then delete it when you're finished and there's no need to unrasterize.

Votes

Translate

Translate

Report

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
Participant ,
May 23, 2016 May 23, 2016

Copy link to clipboard

Copied

LATEST

SUCCESS!!  Redraw(); worked perfectly rasterizing then un-rasterizing as needed.  Below is a snippet of the code for reference.

     app.redraw();

     for(var a=0;a<myLayer.pageItems.length;a++){

        var currentItem = myLayer.pageItems;

            currentItem.selected = true; 

            idoc.rasterize( currentItem ,currentItem.visibleBounds, newoptions);

     } 

    docRef.saveAs(File("my.pdf"), myOpts);

    app.undo();

Thank You!!

Votes

Translate

Translate

Report

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