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

Data Merge for Book Covers

Community Beginner ,
Oct 25, 2022 Oct 25, 2022

Copy link to clipboard

Copied

I want to make book covers programmatically using Indesign.

The indd I use is a spread where page 1 is the flap from the back cover, page 2 is the back cover, page 3 is the spine, page 4 is the front cover, page 5 is the flap from the front cover.

Page 3, the spine, should vary it's width from a value set in the CSV used for data merging all variable text and images. Then it should export to PDF with the correct spine width.

 

Can this be doable ? I've seen several scripts to change page width, but would it work for all data merge rows with different spine widths ?

TOPICS
Scripting

Views

121

Likes

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 ,
Oct 25, 2022 Oct 25, 2022

Copy link to clipboard

Copied

Hi @Federico267836568h03 , I think you will need a script to change the spine page size, and the spread would need to be setup as Facing Pages, so the back and front covers travel with the new spine width. A single script could probably handle the data merge and page adjustment— the scripted width could come from the CSV.

Likes

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
Advisor ,
Oct 25, 2022 Oct 25, 2022

Copy link to clipboard

Copied

You won't be able to do it through data merge - only scripting - but why are you complicating things so much?

 

You just need one wide page - sum of all parts - with guidelines to mark each part. 

Can automate anything - as long as it doesn't require A.I.

Likes

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 ,
Oct 25, 2022 Oct 25, 2022

Copy link to clipboard

Copied

Until recently, I would have agreed, but a discussion sold me on the merits of the three-page layouts (rear cover, spine, front cover, export as spread). Even simpler than moving guidelines and elements around, as I did for years.

 

I guess this could be scripted but with the 3-page format, it's a minute or two to adjust an optimized layout.

 


| Word & InDesign to Kindle & EPUB: a Pro Guide (Amazon)

Likes

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 ,
Oct 25, 2022 Oct 25, 2022

Copy link to clipboard

Copied

If the document was setup carefully (a facing page spread, with layers), the spine width could be changed without having to move any of the page items. So, this simple script would chage the spine width in the example below from 1/2" to 2" without needing to move any of the jacket’s page items:

 

 

//a new spine width as Inches
var nsw = 2

app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;
var doc = app.activeDocument;
var p = doc.pages[2]
doc.pageItems.everyItem().locked = false;
var b = p.bounds;
p.resize (CoordinateSpaces.INNER_COORDINATES, AnchorPoint.CENTER_ANCHOR, ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,[nsw*72,b[2]-b[0]])
app.scriptPreferences.measurementUnit = AutoEnum.AUTO_VALUE;

 

 

Before:

 

Screen Shot 15.png

 

After:

 

Screen Shot 16.png

Likes

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 Beginner ,
Oct 28, 2022 Oct 28, 2022

Copy link to clipboard

Copied

Hi @rob day thanks for the reply. I don't know anything about scripting, but if I'm not mistaken, the spine width variable in your script is fixed to "2". Is that script usable with Data Merge ? How would that variable be tied to a CSV field value ?

Likes

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
Advisor ,
Oct 29, 2022 Oct 29, 2022

Copy link to clipboard

Copied

If your only goal for using Data Merge is to vary spine width - then script would need to read your CSV file directly - no need for Data Merge.

If you need to do more - import texts, etc. - then the workflow needs to be changed. 

Can automate anything - as long as it doesn't require A.I.

Likes

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 ,
Oct 29, 2022 Oct 29, 2022

Copy link to clipboard

Copied

A similar question came up here where the the document pages are getting resized based on a width and height field set in the data merge file. It could be done with a jacket, but you would need some coding skills:

 

https://community.adobe.com/t5/indesign-discussions/need-assistance-creating-a-script-using-data-mer...

 

An easier approach might be to feed a simpler script, like the one above, a text file with the spine widths for each jacket spread. The setup of the facing page spreads would be important. I’ve attached the one I used in my sample

 

 

 

Likes

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 ,
Oct 29, 2022 Oct 29, 2022

Copy link to clipboard

Copied

LATEST

Here‘s a simple example where you would have run the data merge and the texts are correct, and then run a script to adjust the spine widths of 3 jacket spreads. The first line is an array of new spine widths:

 

//an array of spine widths
var sd = [1, .75, 2.3]

//the document spreads
var sp = app.activeDocument.spreads

for (var i = 0; i < sd.length; i++){
    setSpineWidth(sp[i], sd[i])
};   

/**
* Adjusts the spine width—page 3 of a 5 page spread 
* @ param the spread to adjust 
* @ param the new width in inches 
* @ return void 
*/
function setSpineWidth(s,sw){
    app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;
    var p = s.pages[2]
    s.pageItems.everyItem().locked = false;
    var b = p.bounds;
    p.resize (CoordinateSpaces.INNER_COORDINATES, AnchorPoint.CENTER_ANCHOR, ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,[sw*72,b[2]-b[0]])
    app.scriptPreferences.measurementUnit = AutoEnum.AUTO_VALUE;
}

 

 

Screen Shot 20.png

 

Screen Shot 19.png

Likes

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