remove border and center docs


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /*
  2. @@@BUILDINFO@@@ "removeBorder.jsx" 1.0.0 5-6-2010
  3. */
  4.  
  5. var myDocument = app.documents.item(0);
  6.  
  7. main();
  8. function main(){
  9. if(app.documents.length != 0){
  10. if(app.documents.item(0).rectangles.length != 0){
  11. removeBorder();
  12. }
  13. else{
  14. alert("Document contains no graphics.");
  15. }
  16. }
  17. else{
  18. alert("Please open a document and try again.");
  19. }
  20. }
  21.  
  22. function removeBorder(){
  23. var myBoxes = myDocument.rectangles;
  24. var myText = myDocument.textFrames;
  25. for(var i = myBoxes.length-1; i >= 0; i--){
  26. myBoxes.item(i).strokeWeight = 0;
  27. //this crazy number below really just means Center Content
  28. myBoxes.item(i).fit(1667591779);
  29.  
  30. }
  31. for(var i = myText.length-1; i >= 0; i--){
  32. myText.item(i).strokeWeight = 0;
  33. }
  34. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.