What better way to create nice looking, efficient forms than by using Indesign. Today, the XML data available can be inserted with a script and creation, and printing and customizing can be controlled using Javascript.
Start with Master Pages. Create a master page for a docket, a packing slip or an invoice. Label it with a short description and you can have one template with all your required forms!
To apply a master using Javascript, use this code when running from the scripts menu in Indesign:
app.activeDocument.pages.item(0).appliedMaster = app.activeDocument.masterSpreads.item(templatename).
In the FullSWITCH or PowerSWITCH environment, the Indesign configuration uses $doc in place of app.activeDocument to refer to the template that SWITCH opens:
$doc.pages.item(0).appliedMaster = $doc.masterSpreads.item(templatename).
Start with this, and you can have one script that creates a completed form with the click of a mouse!
Javascript can apply a template to a page, and then fill in the blanks with XML data – shipping information, ordered items, item numbers, quantities. A single line to import the XML file from the Javascript is as follows:
app.activeDocument.importXML(File(thePathtotheXMLFile)).
$doc. is used again in the FullSWITCH and PowerSWITCH environments.
Importing XML can seem tricky, so for your first time, try manually importing a sample of the XML file you are using. For this to work, the file needs to be the same XML setup for all files being used.
Under the View menu, select Show Structure if it is not on the left of your screen. Under the drop down menu in the structure window, select Import XML and select your XML file.
The structure of the XML file can be dragged from the current window into a textbox on the page. Under View ->Structure, select Show Tagged Frames. When you drag an XML element into a textbox, it will appear highlighted with the colour of the elements tag. Select the data inside the frame, and delete it – the box should still show the tag colour. This means the next time an XML file with that element is imported, the data will go into that box.
Next, set up paragraph styles for your text so you can map the individual parts to the styles you want. In the structure window’s drop down menu, select Map Tags to Styles. You can select the element and specify the paragraph style you want.
Keep in mind, this works for a single element, such as an order date or order number, but if you want a group of items such as a shipping address, they will most likely be grouped into a higher level element.
In the structure window, you can select Show Text Snippets from the drop down window and the data inside the XML file appears next to each element.
You can add a complex element as well. For example, if you have an element named ShipTo, and attached to it is a complete name and address, you can drag the whole ShipTo element into a textbox. To do this, follow these simple steps:
1. Select View->Structure->Show Tag Markers. Each element will have a set of coloured square parentheses around it.
2. Format the text and set it up the way you prefer.
3. Delete the text in the square parentheses, but leave the parentheses in place. Notice that when you do this, the data that was attached to the element in the structure window disappears when the text is deleted, leaving an empty element.
So far, we have been working with single occurring items, but if you have something that changes from job to job, like ordered items, you will want them to generate a line for each item.
Using the method above, drag an item that may contain things like quantity, description, code or price into a textbox. Format the line using a paragraph style with tabs, and add a hard return at the end of the line. Delete the text above it, leaving the coloured parentheses as placeholders.
Indesign will remember previous settings when importing the XML file. Make sure to check Mode: Merge Content and Clone when repeating text elements. When you run your script on the open template file, it will apply the master and import your data.
Dear Andrea,
I am not a programmer and this is probably where my problem is, but I tried using your Javascript code and can’t seem to get it to see my XML file. I am working on a Mac and I tried to link (thePathtotheXMLFile) and I’ve tried everything from where the XML file is compared to the InDesign file. Too starting the path right from my hard drive. Can you give me some insight into what I might be doing wrong?
Sincerely,
Trevor
This Answer is very useful to me
венера в рыбах у мужчины в 10 доме к чему снится парик во сне рассорка на дождь,
дождик для фотозоны – купить
гадание на воде с бумагой что делать с бывшей женой мужа магия
acquista farmaci in modo sicuro Marksans Châtelet aankoop van mylan-medicijnen in Frankrijk
medicamentos sin efectos indeseables en Ecuador Advaita Volendam Guida all’acquisto sicuro di farmaci
online a Milano, Italia
ou acheter du médicaments sans ordonnance à Paris Germed San Prisco
Acheter médicaments en ligne avec expédition rapide en Suisse
łatwo kupić leki w Hiszpanii Viofar Montelíbano médicaments disponible sur ordonnance
acheter des médicaments au meilleur prix korhispana Lauterach
compra de medicamentos en São Paulo fiable
médicaments en ligne sans ordonnance Almus Saint-Herblain fai un ordine di farmaci
in Italia
medicijnen beschikbaar in apotheek lek Fügen Legal Medikamente
ohne Rezept in Antwerpen erwerben – Was Sie wissen sollten
medicamentos farmacia en Camerún Farmoz Corrientes médicaments prix en Belgique
médicaments à prix réduit Aurobindo Yarumal médicaments sans
tracas pour votre santé
неліктен адам түсінде жылан жеуді армандайды?
шөбере қолынан май жалау, шөбере туралы
әндер скачать асылжан абдулла – журек текст, асылжан абдулла – жүрек сипаттау
мәтіні, сипаттау мәтіні мысалдар 3 сынып
мәтіндер жинағы 2 сынып, қысқаша мәтіндер
4 сынып қозғалыс атауы, алаш қозғалысы құжаттар мен материалдар жинағы
pharmadoct беруши, беруши противошумные купить жер эрозиясы деген не, су эрозиясы