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

multipage XML automatisation

Community Beginner ,
Mar 31, 2020 Mar 31, 2020

Copy link to clipboard

Copied

Hej there,

I am attempting to build an automated multipage InDesign document via XML – one long XML (which changes for every month) and one 1-page INDD master, which combine to one ~30-page INDD per month.

 

It works perfectly when I have a 30-page document with all the XML-elements linked to all the textframes on every page. But the next step would be to have just one page in InDesign and have it automatically expand according to the XML. That way, I wouldn't have to do the same thing 30 times when something has to be changed structurally or with the fixed elements...

 

According to the following thread, it should be possible without scripting (which was my first thought, too) and it sounds rather simple: https://community.adobe.com/t5/indesign/build-xml-structure-by-scripting/m-p/11012846?page=1#M180624

(I posted there, too, but as it's marked as solved, I was uncertain whether it'd get any attention)

 

So I reworked my project file, but to no avail.

Then I tried it in a dummy XML file + project:

 

<content>

<event1>
<a>ASDF1</a>
<b>QWER1</b>
</event1>

<event2>
<a>ASDF2</a>
<b>QWER2</b>
</event2>

<event3>
<a>ASDF3</a>
<b>QWER3</b>
</event3>

</content>

 

... but nothing changed. Just page one worked.

 

I tried to have <event> containers without the digit, I tried adding empty pages beforehand and I tried out the different import-options – no luck 😕 I also played around with the master page, but it doesn't seem to have anything to do with it...

I'm out of ideas, do you have any? °-° 🙂

 

Thanks and best wishes

Mathis

TOPICS
How to , Import and export , Scripting

Views

1.2K

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 ,
Mar 31, 2020 Mar 31, 2020

Copy link to clipboard

Copied

Make sure your document is set up with Primary Text Frame set to true. Have a paragraph style established for each tagged element (one for "a" and one for "b"--maybe call them itemA and itemB)

Import the XML file and drag from the root element to the first page (also the first threaded text frame). You now have all elements on the first page. Using the Tag panel (under Window > Utilities), set Tag to Paragraph styling (Map Tags to Styles in hamburger menu) see screenshot below. For the first tagged paragraph, set its paragraph style to Keep Options > On Next Page. (Text will now start on page 2).  Note: this assumes both items will be in the same Primary Text Frame (first threaded text frame by default).Screen Shot 2020-03-31 at 1.47.35 PM.png

 

Screen Shot 2020-03-31 at 1.50.04 PM.png

 

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 Beginner ,
Apr 01, 2020 Apr 01, 2020

Copy link to clipboard

Copied

Thank you very much, Hopkins!

 

It works in my dummy project 🙂 Very interesting.

<a> and <b> in one text frame on page 2 and 3, page 1 empty. (I deleted <event3> for now)

 

But can I also have <a> and <b> in two separate text frames now? 

 

 

This only half-works manually, when I drag the containers in their frames on page 1. Then, when the XML is loaded, page 1 (no page break then) looks fine, but on page 2, <b> is underneath <a> in the primary text frame again. So this is no way to go.

Which makes sense in this context, but doesn't fit my needs as I have more complex designs that need to be retouched a lot.

 

This is probably what you mean by:

Note: this assumes both items will be in the same Primary Text Frame (first threaded text frame by default).

 

But it seems to somehow be possible, when I look at the old thread I posted – there are multiple text frames with changing content.

Or am I missing something...?

 

Thank you & best wishes

Mathis

 

Pictures of my trivial structure panel with only "Root" inserted on page 1 and my failed attempt of manually dragging <a> and <b> in text frames prior XML on page 1:

 

Bildschirmfoto 2020-04-01 um 10.29.37.png

Bildschirmfoto 2020-04-01 um 10.31.26.png

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 ,
Apr 01, 2020 Apr 01, 2020

Copy link to clipboard

Copied

As you get into XML you will find many different ways to get the same results. And, yes, you can have any number of text frames on each page, for the process below the frames will be threaded.
1. New document: 1 page, primary text frame checked. Paragraph style created for each XML tag in XML document. (I named them itemA and itemB). Do not set Keep Options at this point.
2. Master page A: Grab the primary text frame and resize as needed. Click on the outport for this frame to create a second text frame (threaded to the first frame).
3. Document Page 1: Click in the first frame with the text tool); type in Placeholder text. Style with the appropriate paragraph style (itemA)
5. Enter a return after first paragraph to start a second paragraph. Enter Placeholder text for the second XML tagged item and style with the appropriate paragraph style (itemB)
6. If second paragraph as styled does not go to the second text frame, add space above/below as needed or set its Keep Options to In Next Frame.
7. In Tag dialog box (Window > Utilities > Tags) create a Tag for each of the XML tags in the XML file. Establish Tag to Paragraph Styling. (See screenshots).
8. Import XML file. Drag from Root XML element (content) to the first text frame on Page 1.
9. Set Keep Options for the first paragraph style (itemA) to On Next Page. Remove empty paragraphs

Screen Shot 2020-04-01 at 12.34.20 PM.pngScreen Shot 2020-04-01 at 12.37.35 PM.pngScreen Shot 2020-04-01 at 12.38.09 PM.png

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 Beginner ,
Apr 02, 2020 Apr 02, 2020

Copy link to clipboard

Copied

Again, thanks a lot, Hopkins! 🙂

This really got it going for me. I'm still figuring out the details, but it seems to work.

 

As I need breaks inside of the single text frames, as in:

 

 

<event1>
<a>line1
line2
line3</a>
<b>line1
line2</b>
</event1>

 

 

 ... I switched to working with empty <break> and <page> containers with the Keep Options "In Next Frame" and "On Next Page". This seems to work and is a bit cleaner than directly linking it with <a> etc.:

 

 

<Root><page></page>
<event1><a>line1
line2
line3</a>
<br></br>
<b>line1
line2</b>
<br></br>
<c>line1</c></event1>

<page></page>
<event2><a>line1</a>
<br></br>
<b>line1</b></event2></Root>

 

 

 

What I haven't yet figured out is when InDesign really does create new pages and when it doesn't... for me, the behaviour seems to change from project to project, although I think I did everything the same way, structurally.

There must be a mistake in there somewhere...

While page 1 is still being filled perfectly, InDesign doesn't add any additional pages, although I added <page> breaks, which work in the dummy project. Checked it seven times: paragraph style+keep options, tags, XML, linking XML and tags...

Do you have any guesses? I'll report back if I find something myself.

 

edit:

If I insert <page> somewhere else, it "works". Meaning, the following text disappears from page 1 and there's the little red plus on the last text frame of page 1 – which is there all the time with the XML loaded.

Also, if I select all and copy paste the primary textframe's content, it's all there! So it does get pushed to page 2, InDesign just doesn't create a page 2 etc. to put it in.

 

Best wishes

Mathis

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 Beginner ,
Apr 02, 2020 Apr 02, 2020

Copy link to clipboard

Copied

Hej again,

 

I found the solution to that last issue – I didn't start the document with Primary Text Frame enabled °-° but enabled it by hand in the master page... I didn't think that'd be a difference and I couldn't turn it on afterwards. But starting a whole new document with it seems to have resolved the issue 🙂

 

I'll keep the thread open for a little bit, just if I run into more problems tomorrow, is that ok?

 

Again, thanks so much and best wishes

Mathis

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 ,
Apr 02, 2020 Apr 02, 2020

Copy link to clipboard

Copied

Glad you spotted the problem. Yes, how you set up the document makes a ton of difference with the master page (and master text frame(s)). Yes, keep the thread open. Hopefully others will find this informative.

Shirley

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 Beginner ,
Apr 20, 2020 Apr 20, 2020

Copy link to clipboard

Copied

LATEST

Hi again,

 

apart from everything else working wonderfully 🙂 I have one question:

I am importing a <picture href="file:///...jpg"></picture> container.

When working with my previous, bad method, it worked fine.

Now with the primary textframe, the image is created as an Anchored Object and the option (something along the lines of...) embedded.

This way, I can only move it oh-so-little vertically, until it leaves the text frame...

 

When I change to Anchored Objects –> Options –> Custom, I can move the image around as I like, but this doesn't solve the automatisation problem as I'd have to do this every time for every image and there's this other, connected problem:

It is imported as big as the image actually is, not resized to as big as the frame it should be in. As it's floating around outside its actual frame, of course it doesn't respect its boundaries.

 

This isn't a big problem yet, as there are only few and static images in use (varying, only on some pages), but when XML will be connected to my image database in the future, it might become a biggy.

 

Is there some other way to implement images in XML or to import the XML in InDesign? I couldn't find anything.

Thinking about it, I guess it might be a bit of a struggle to do this with a primary text frame, right?

 

Thanks & best wishes,

Mathis

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