ONYX - 9.0 - Utilisation

XPS Indexation management

De MappingDoc
Cette page est une version traduite de la page ONYX:9.0:Utilisation:Gestion d'indexation et la traduction est complétée à 100 %.

Autres langues :
English • ‎français

List of indexes and their values

The -dumpIndex toggle allows you to list all the indexing criteria present in the XPS document.


Example:

map_xps -infile:/tmp/invoice.xps -dumpIndex
CustomerID
InvoiceID
InvoiceDate
CustomerName
MAPSUBJCT
MAPSEND
NUMPING

Used with the name of a particular index, it lists all the different values ​​of this index:

map_xps -infile:/tmp/invoice.xps -dumpIndex:CustomerID
10638
4274
11426
4533
...


By adding the -duplicateindex switch, the index values ​​are listed on all pages of the XPS document including those with the same value:

map_xps -infile:/tmp/invoice.xps -dumpIndex:CustomerID -duplicateindex
10638
4274
11426
11426
4533
4533
...

Indexing a document

Replications of index values

In certain cases, it may be that an indexing criterion is present on all pages but without a defined value for certain pages or that the indexing criterion is not present on all pages. The copyEmptyIndex switch then allows you to reindex the document by copying, for pages without an index value, the index value found on the previous page.


Example :

map_xps -infile:/tmp/invoice.xps -copyEmptyIndex:InvoiceID

Indexing the file before placing the order:

Page Index Index value
1 InvoiceID 1
2 Cell text
3 InvoiceID 2
4 InvoiceID 3
5 InvoiceID Cell text


Indexing the file after placing the order:

Page Index Valeur de l’index
1 InvoiceID 1
2 InvoiceID 1
3 InvoiceID 2
4 InvoiceID 3
5 InvoiceID 3


Addition of indexing criteria (Static)

The -addCriteria switch allows you to add one or more criteria to a document. The general syntax is:

-addCriteria:IndexName=value


Example: adding one or more indexes with the same value on all pages

map_xps -infile:/tmp/in.xps -outfile:/tmp/out.xps -addCriteria:NumOrder=123456 -addCriteria:Date=17.02.2015


Addition of indexing criteria (Dynamic)

More generally, the values ​​of the added index will come from a prior extraction of text information contained in the XPS document itself on each of its pages. This information, temporarily stored in a /tmp/values.txt file, is reused to add the criterion with the following syntax:


map_xps "-infile:/tmp/in.xps" "-outfile:/tmp/out.xps" "-addCriteria:NumOrder=FILE:/tmp/value.txt"

Extracting criterion values

The principle is to search for information contained in the document and extract it (-extract:xxx switch) into a temporary file and then add them as values ​​of an indexing criterion of the same document. The temporary file created is in text format, in Unicode, with the following syntax: "value[TAB]page[CRLF]". The collection of information in the document can be done by keyword (-filter:xxx switch) or by position (-box:xxx switch). The returned information can be cleaned of extraneous spaces before and/or after the text with the following switches:

-ltrim: removing spaces before the text


-rtrim: removing spaces after the text


-trim: removal of spaces before and after the text

Example 1: Keyword search

map_xps "-infile:/tmp/invoice.xps" "-extract:/tmp/values.txt" "-filter:Invoice for order" "-length:10" "-shift:2" "-rtrim"

⇒ extraction of 10 characters located two characters after the keyword Invoice for order by removing unnecessary spaces after the returned text.

Example 2: search by position

map_xps "-infile:/tmp/invoice.xps" "-extract:/tmp/values.txt" "-box:100,150,180,30,mm"


The box parameters specify its dimensions: xx.xx,xx.xx,xx.xx,xx.xx[,cm|in|mm]


- four decimal numbers specifying in order: top, bottom, left, right


- the decimal separator is ‘.’


- the value separator is ‘,’ or ‘;’


- the last parameter (optional) is the coordinate unit: in points (for a resolution of 96dpi) by default, in millimeters (mm), in inches (in) or in centimeters (cm)


Export of indexes and their values

The principle is the creation of an index file from a document with a view to archiving it in third-party software. The index files produced as standard by ONYX Server can be in TXT, XML, or IND format (compatible with Content Manager). This export of indexes to a file is controlled by the -indexfile:xxx switch. The extension of the export file controls its type.

The -duplicateindex parameter allows you to also export indexes whose value is the same on several pages.


The -exportemptyindex parameter allows you to also export indexes that have no value.


Examples:

map_xps -infile:/tmp/invoice.xps -indexfile:/tmp/file.txt [-duplicateindex] [-exportemptyindex]
map_xps -infile:/tmp/invoice.xps -indexfile:/tmp/file.xml [-duplicateindex] [-exportemptyindex]
map_xps -infile:/tmp/invoice.xps -indexfile:/tmp/file.ind [-duplicateindex] [-exportemptyindex]


Processing on indexes

Sorting

The principle is to sort (-sort:xxx switch) an XPS document according to the values ​​of one or more indexing criteria. Only one file will be created as output. Sorting is done in ascending order using numeric values ​​by default. Using the ALPHA option allows you to sort on alphanumeric values, the REVERSE option allows you to sort in descending order.


Examples :

map_xps -infile:/tmp/invoice.xps -outfile:/tmp/invoice.pdf -sort:CustomerID -toPDF
map_xps -infile:/tmp/invoice.xps -outfile:/tmp/invoice.pdf -sort:ALPHA:CustomerName -toPDF
map_xps -infile:/tmp/invoice.xps -outfile:/tmp/invoice.pdf -sort:CustomerID,InvoiceID -toPDF
map_xps -infile:/tmp/invoice.xps -outfile:/tmp/invoice.pdf -sort:ALPHA:CustomerName,REVERSE:InvoiceID -toPDF


Spliting

The principle is to split a document according to the values ​​of one or more indexing criteria. As many output files can be created as there are different values ​​of the criteria used. Here, no particular switch, but a precise syntax to follow to control the splitting: [[Index_Name]].

Examples :

map_xps -infile:/tmp/invoice.xps -outfile:/tmp/invoice_[[CustomerID]].pdf -toPDF
map_xps -infile:/tmp/invoice.xps -outfile:/tmp/invoice_[[CustomerID]]_[[InvoiceID]].pdf -toPDF

Volume spliting

The BUNDLEONINDEX mode allows you to create batches according to the number of pages for each criterion value (for example: a file with documents having 1 to 4 pages for each criterion value, a file for documents of 5 to 9 pages, one file for documents of more than 10 pages). It is possible to create as many batches as desired.


Example :

map_xps -infile:/tmp/invoice.xps -outfile:/tmp/invoice_[[BUNDLEONINDEX,MAPSEND,1,5,10]].pdf -toPDF


In BUNDLEONINDEX mode, splitting can also be done according to a number of sheets (depending on the front/back information), the syntax then becomes:

map_xps -infile:/tmp/invoice.xps -outfile:/tmp/invoice_[[BUNDLEONINDEX=SHEET,MAPSEND,1,5,10]].pdf -toPDF


Filters or page extraction

The principle is to isolate certain pages of an XPS document based on the values ​​of one or more indexing criteria. This can be used in particular to create an output document that only concerns certain clients. The -filter:xxx switch is used in this case. Mathematical (=, <, >, <=, >=) and logical (AND, OR) operators can be used for complex filters without forgetting priority parentheses.

Examples :

map_xps -infile:/tmp/invoice.xps -outfile:/tmp/invoice_426.pdf -toPDF -filter:CUSTOMER=426
map_xps -infile:/tmp/invoice.xps -outfile:/tmp/extract.pdf -toPDF-filter:(CUSTOMER=4026) OR (CUSTOMER=1458) AND (PRICE=15)

This can also be very useful for performing actions only on certain pages depending on criteria values, in particular the management of finishing options (PrintTickets).


Apart from index management, another switch allows you to extract pages from an XPS document: -pages:xxx. Page values ​​can be defined by:


- unit numbers separated by commas: -pages:1,5,6,7,12

- page intervals: -pages:5-7

- a combination of both: -pages:1.5-7.12


- the character ‘*’ can be used in an interval to specify the end of the document


- the pages to extract can be written in an external text file with the syntax: page[CRLF]


Examples :

map_xps -infile:/tmp/invoice.xps -outfile:/tmp/invoice.pdf -pages:1,5,6,7,12 -toPDF
map_xps -infile:/tmp/invoice.xps -outfile:/tmp/invoice.pdf -pages:5-7 -toPDF
map_xps -infile:/tmp/invoice.xps -outfile:/tmp/invoice.pdf -pages:1,5-7,10-* -toPDF
map_xps -infile:/tmp/invoice.xps -outfile:/tmp/invoice.pdf -pages:FILE:/home/extern/pages.txt -toPDF


Document concatenation

The principle is to add several documents one after the other. The output document is the concatenation of all the files specified on the command line in the order in which they were specified. Two switches can be used: -add:xxx (=concatenation of several XPS documents into a single XPS document) or -adddoc:xxx (=concatenation of several XPS documents into an XPS multi documents with preservation of the finishing options of each original document).


Noticed: We can then imagine sorting according to indexing criteria previously defined on each file to group together files from several different sources (invoice + T&Cs + newsletter, etc.)


Examples :

Concatenating multiple XPS files at once:

map_xps -outfile:/tmp/final.xps -add:/tmp/test1.xps -add:/tmp/test2.xps -add:/tmp/test3.xps


Concatenation in several times, in the case where we do not know in advance the number of input XPS files (generally in a loop):

map_xps -tempfile:/tmp/final.xps -add:/tmp/test1.xps
map_xps -tempfile:/tmp/final.xps -add:/tmp/test2.xps
map_xps -tempfile:/tmp/final.xps -add:/tmp/test3.xps