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

how to change work area for several pages

Enthusiast ,
Feb 18, 2022 Feb 18, 2022

Copy link to clipboard

Copied

Hello,

I have imported in Photoshop a 4 pages PDF. So you can see here the 4 tabs at the top :

 

photoshop.jpg

I would like to change the work area for all pages/images/tab at the same time.

By example in the screenshot I have changed the work area to 135 mm x 215 mm, but if I do that, it changes only for the active image. I would like to make this setting for all images/tab at the same time.

How to do this ?

My goal is to obtain a 135 x 215 mm PDF (without distorting the pages).

TOPICS
Windows

Views

262

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
Adobe
Community Expert ,
Feb 18, 2022 Feb 18, 2022

Copy link to clipboard

Copied

These images appear to be scanned, with discolored backgrounds. The following script resets the background colour to pure white, which may or not exactly match the scan on all edges. 

 

/*
Resize Canvas For All Open Docs.jsx
Stephen Marsh, v1.1 - 19th February 2022
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-change-work-area-for-several-pages/td-p/12761765
*/

#target photoshop

// CHECK FOR OPEN DOCS
if (app.documents.length) {

    // SET THE CURRENT DOC AS ORIGINAL DOC
    var actDoc = activeDocument;

    resetSwatches();

    // LOOP OVER OPEN FILES
    for (var i = 0; i < app.documents.length; i++) {
        activeDocument = app.documents[i];
        activeDocument.resizeCanvas(UnitValue(135,"mm"), UnitValue(215,"mm"), AnchorPosition.MIDDLECENTER);
    }

    // RETURN TO THE ORIGINAL DOC
    activeDocument = actDoc;

    // END OF SCRIPT NOTIFICATION
    app.beep();

// ALERT IF NO DOCS OPEN
} else {
    alert('You must have a document open!');
}

function resetSwatches() {
	var s2t = function (s) {
		return app.stringIDToTypeID(s);
	};
	var descriptor = new ActionDescriptor();
	var reference = new ActionReference();
	reference.putProperty( s2t( "color" ), s2t( "colors" ));
	descriptor.putReference( s2t( "null" ), reference );
	executeAction( s2t( "reset" ), descriptor, DialogModes.NO );
}

 

  1. Copy the JavaScript code text to the clipboard
  2. Open a new blank file in a plain-text editor (not word-processor)
  3. Paste the code in
  4. Save the text file with your desired filename with a .txt filename extension
  5. Rename the file extension from .txt to .jsx
  6. Install or browse to the .jsx file to run

 

NOTE: Altering page box dimensions in Acrobat Pro is considered best practice. Using a plug-in such as Enfocus PitStop Pro can also extend the background colour to the images, even if the content is raster.

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 ,
Feb 18, 2022 Feb 18, 2022

Copy link to clipboard

Copied

This version uses content aware fill (therefore, it's slower) – in an attempt to seamlessly extend the variable background colour:

 

/*
Resize Canvas For All Open Docs.jsx
Stephen Marsh, v2.0 - 19th February 2022
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-change-work-area-for-several-pages/td-p/12761765
*/

#target photoshop

// CHECK FOR OPEN DOCS
if (documents.length) {

    // SET THE CURRENT DOC AS ORIGINAL DOC
    var actDoc = activeDocument;

    // LOOP OVER OPEN FILES
    for (var i = 0; i < documents.length; i++) {
        activeDocument = documents[i];
        if (activeDocument.activeLayer.isBackgroundLayer) {
            activeDocument.activeLayer.name = 'Background';
            extendCanvas();
        } else {
            extendCanvas();
        }

    }

    // RETURN TO THE ORIGINAL DOC
    activeDocument = actDoc;

    // END OF SCRIPT NOTIFICATION
    app.beep();

    // ALERT IF NO DOCS OPEN
} else {
    alert('You must have a document open!');
}

// FUNCTIONS

function extendCanvas() {
    // Content aware fill requires a certain amount of blank space to work without erroring
    activeDocument.resizeCanvas(UnitValue(137, "mm"), UnitValue(217, "mm"), AnchorPosition.MIDDLECENTER);
    loadLayerTrans();
    activeDocument.selection.invert();
    contentAwareFill(true, false, false, false, 100);
    activeDocument.selection.deselect();
    // Final required size
    activeDocument.resizeCanvas(UnitValue(135, "mm"), UnitValue(215, "mm"), AnchorPosition.MIDDLECENTER);
    activeDocument.flatten();
}

function loadLayerTrans() {
	var s2t = function (s) {
		return app.stringIDToTypeID(s);
	};
	var descriptor = new ActionDescriptor();
	var reference = new ActionReference();
	var reference2 = new ActionReference();
	reference.putProperty(s2t("channel"), s2t("selection"));
	descriptor.putReference(s2t("null"), reference);
	reference2.putEnumerated(s2t("channel"), s2t("channel"), s2t("transparencyEnum"));
	descriptor.putReference(s2t("to"), reference2);
	executeAction(s2t("set"), descriptor, DialogModes.NO);
}

function contentAwareFill(contentAwareColorAdaptationFill, contentAwareRotateFill, contentAwareScaleFill, contentAwareMirrorFill, opacity) {
	var s2t = function (s) {
		return app.stringIDToTypeID(s);
	};
	var descriptor = new ActionDescriptor();
	descriptor.putEnumerated(s2t("using"), s2t("fillContents"), s2t("contentAware"));
	descriptor.putBoolean(s2t("contentAwareColorAdaptationFill"), contentAwareColorAdaptationFill);
	descriptor.putBoolean(s2t("contentAwareRotateFill"), contentAwareRotateFill);
	descriptor.putBoolean(s2t("contentAwareScaleFill"), contentAwareScaleFill);
	descriptor.putBoolean(s2t("contentAwareMirrorFill"), contentAwareMirrorFill);
	descriptor.putUnitDouble(s2t("opacity"), s2t("percentUnit"), opacity);
	descriptor.putEnumerated(s2t("mode"), s2t("blendMode"), s2t("normal"));
	executeAction(s2t("fill"), descriptor, DialogModes.NO);
}

 

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 ,
Feb 21, 2022 Feb 21, 2022

Copy link to clipboard

Copied

@pierret18811376 

 

How did the scripts work for 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
Enthusiast ,
Feb 21, 2022 Feb 21, 2022

Copy link to clipboard

Copied

Sorry, but I give up Photoshop (I have not complete CC subscription), so I have not tried your scripts.

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 ,
Feb 22, 2022 Feb 22, 2022

Copy link to clipboard

Copied

LATEST

@pierret18811376 wrote:

Sorry, but I give up Photoshop (I have not complete CC subscription), so I have not tried your scripts.


 

Sorry, I don't understand. You posted a question and on the same day I provided two solutions, but three days later you reply that you have stopped using Photoshop?

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 ,
Feb 21, 2022 Feb 21, 2022

Copy link to clipboard

Copied

@pierret18811376 

 

Is this what you are trying to achieve?

  • from 134,96 mm to 135 mm
  • from 214,97 mm to 215 mm

 

Instead of 300 ppi (pixels per inch), the bottom left corner says 300 ppp. What does the third "p" stand for?

 

I live in the one part of the world that does not use metrics, but Photoshop cannot give you an image size that includes a partial pixel and will do the kind of rounding you are seeing when faced with an impossible situation.

 

Jane

 

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 ,
Feb 21, 2022 Feb 21, 2022

Copy link to clipboard

Copied

ppp is in french, and is the same as ppi in english.

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