37
7-32
Dynamic Converter Administration Guide
Script Templates
{## LINK} Usage Scenarios
Using the first syntax shown at the beginning of this section, a URL for the element
bookmark is inserted in the document. Normally this syntax is used to create
intradocument links to aid navigation. An example would be creating a link to the next
section of the document.
In the second syntax, a URL is created to an output file generated by the specified
template. This template is run on the same source document, but may extract different
parts of the document. Normally, in this syntax, the “main” template contains a link to a
second HTML file. This second file is generated using the template specified by the
{## LINK} command and contains other document elements. As an example, the “main”
template could produce a file containing the body of the document and a link to the second
HTML file, which contains the footnotes and endnotes.
The third and most powerful syntax also produces the URL of a file generated by the
specified template. This template is then expected to contain an insertion of the specified
element. Normally this syntax is used with repeatable elements. It allows the author to
generate multiple output files with sequential pieces of the document. As such it provides
a way to break large documents up into smaller, more readable pieces. An example of
where this syntax would be used is a template that generates a “table of contents” in one
HTML file (perhaps a separate HTML frame). The entries in the table are then links to
other HTML files generated by different templates.
Note that a {## LINK} statement which specifies a template does not always result in a
new file being created. New files are only created if the target of the link does not exist
yet. So if for example two {## LINK} statements specify the same element and template,
only one HTML file is produced and the same URL will be used by both {## LINK}
statements.
TOP
This attribute is only meaningful if an element is specified in the
{## LINK} command. When this attribute exists, the generated URL
will not contain a bookmark, and therefore the resulting link will
always jump to the top of the HTML file containing the specified
element. This is useful if the top of the script template has navigation
or other information that the developer would like the user to see.
Attribute
Description
41
Dynamic Converter Administration Guide
7-33
Script Templates
{## LINK} Archive File Example
The following template generates a list of links to all the extracted and converted files
from the source archive file (represented by decompressedFile in the following example):
{## repeat element=sections}
<p><a href=”{## link element=sections.current.decompressedFile}”>
{## insert Element=sections.current.fullname}</a></p>
{## /repeat}
{## LINK} Presentation File Example
The following example (template.htm) uses the first syntax to generate a set of HTML
files, one for each slide in a presentation. Each slide will include links to the previous and
next slides and the first slide. Note the use of {## IF} macros so the first and last slides do
not have Previous and Next links respectively:
template.htm
<html>
<body>
{## insert element=slides.current.image width=300}
<hr />
{## if element=slides.previous.image}
<p><a href={## link element=slides.previous.image}>
previous</a></p>
{## /if}
{## if element=slides.next.image}
<p><a href={## link element=
slides.next.image}>Next</a></p>
{## /if}
</body>
</html>
Due to the side effects of {## LINK} using the element attribute, there can be some
confusion over what values “current”, “previous” and “next” have when each {## LINK}
is processed. To better illustrate how this template works, consider running it on a
presentation that contains three slides:
First Output File
Since no template is specified in the {## LINK} statements, template.htm is (re)used as
the template for all {## LINK} statements. For the first slide, nothing interesting happens
until slides.next is encountered. Since slides.current is 1 in this case, slides.next refers to
slides.2 and the {## LINK} is performed on slides.2.image. This {## LINK} fills in the
anchor tag with the URL for the output file containing the second slide. Since no file
containing slides.2 exists, {## LINK} opens a new file.
How to C#: Basic SDK Concept of XDoc.PDF for .NET annotation features can be integrated into your C# project, such as annotation creating, deleting, modifying This class describes bookmarks in a PDF document
bookmark template pdf; bookmarks in pdf
29
7-34
Dynamic Converter Administration Guide
Script Templates
Second Output File
For the second slide the template is rerun. slides.current now refers to slides.2,
slides.previous refers to slides.1 and slides.next refers to slides.3. The {## INSERT}
statement will insert the second slide.
The {## IF} statement referring to slides.previous succeeds. Since the file containing
slides.1 already exists, no additional file is created. The anchor tag will be filled in with
the URL for the first output file.
The {## IF} statement referring to slides.next also succeeds and the anchor tag will be
filled in with the URL for the output file containing the third slide. Since no file containing
slides.3 exists, {## LINK} opens a new file.
Third Output File
For the third slide the template is rerun. slides.current now refers to slides.3 and
slides.previous refers to slides.2. slides.next refers to slides.4, which does not exist.
The {## INSERT} statement will insert the third slide.
The {## IF} statement referring to slides.previous succeeds. Since the file containing
slides.2 already exists, no additional file is created. The anchor tag will be filled in with
the URL for the second output file.
The {## IF} statement referring to slides.next fails. At this point processing is essentially
complete.
Linking With Content Size Breaking:
{## ANCHOR}
This macro generates a relative URL to a piece of the document produced by Dynamic
Converter when doing document breaking based on content size.
Syntax
{## ANCHOR AREF=type [STEP=stepval] FORMAT="anchorfmt" [ALTLINK="element"]
[ALTTEXT="text"]}
VB.NET PDF: Basic SDK Concept of XDoc.PDF features can be integrated into your VB.NET project, such as annotation creating, deleting, modifying This class describes bookmarks in a PDF document.
pdf bookmark editor; bookmarks pdf files PDF Image Viewer| What is PDF such as text extraction, hyperlinks, bookmarks and metadata as version among a suite of PDF-based standards to develop specifications for creating, viewing, and
pdf bookmark; how to bookmark a pdf document
34
Dynamic Converter Administration Guide
7-35
Script Templates
Attribute
Description
AREF
Indicates the relation of the target of the link to the current file.
Allowable values for this attribute are:
• nsertStart: links to first page of the inserted element
• InsertEnd: links to last page of the inserted element
• Next: links to next page in the inserted element
• Prev: links to previous page in the inserted element
• FirstFile: links to first page created for the entire document
• LastFile: links to last page created for the entire document
STEP
This attribute is used to insert a link to “fast forward/rewind” through
the output pages. This attribute may only be used if AREF is “next” or
“prev”. It is specified as a non-zero positive integer. For example, to
insert a link to skip ahead five pages in a document, the following
statement could be used:
{## unit aref=”next” step=”5”
format=”<p><a href=\”%url\”>Next</a></p>”}
If not specified, the default value of the STEP attribute is one (1),
which corresponds to the next/previous page. This attribute has no
meaning when
aref
equals “insertstart”, “insertend”, “firstfile” or
“lastfile”.
FORMAT
This is an sprintf style format string specifying the text to output as the
link. Dynamic Converter replaces the %url format specifier with the
target URL into the format string. For example:
{## anchor aref=”next”
format=”<a href=\”%url\”>Next</a><br/>\r\n”}
How to C#: Basic SDK Concept of XDoc.PowerPoint Conversely, conversion from PDF to PowerPoint (.PPTX C# project, such as annotation creating, deleting, modifying This class describes bookmarks in a PowerPoint
how to add bookmarks on pdf; add bookmark pdf How to C#: Basic SDK Concept of XDoc.Word Conversely, conversion from PDF to Word (.docx) is C# project, such as annotation creating, deleting, modifying This class describes bookmarks in a Word document
pdf bookmarks; add bookmarks to pdf file
38
7-36
Dynamic Converter Administration Guide
Script Templates
Comment Put in the Output File: {## IGNORE}
This macro causes {##} statements in an area of the template file to be ignored by the
template parser. Any text between the {## IGNORE} and {## /IGNORE} tags will be
written to the output file as-is. This macro allows {##} statements in an area of the
template to be commented out for debugging purposes, or to actually write out the text of
another {##} macro. However, the browser will parse any HTML tags inside the ignored
block and the text will be formatted accordingly. This macro can ignore all {##} macros
except for an {## /IGNORE} macro. No escape sequence has been implemented for this
purpose. As a result, {## IGNORE} statements cannot be nested. If they are nested, a run
time template parser error will occur.
Syntax
{## IGNORE}
any HTML or other {##} macros
{## /IGNORE}
ALTLINK
An attribute used to specify the target of the anchor if it cannot be
resolved based on the anchor type. For example, the final file of a
breakable element has no “next” file, and thus would resolve to
nothing. However, if the altlink attribute is specified, the anchor will
be generated using a URL to the first file found containing the
specified element.
Note that no EX_CALLBACK_ID_ALTLINK callback will be made
if an EX_CALLBACK_ID_ALTLINK attribute is specified in the
{## ANCHOR} statement.
For example:
{## anchor aref=next format=”<a href=\”%url\”>Next</a>”
altlink=headings.next.body}
ALTTEXT
Text to be output if the anchor cannot be resolved. If this attribute is
not specified, no text will be output if the anchor target does not exist.
For example:
{## anchor aref=next format=”<a href=\”%url\”>Next</a>“
alttext=”Next”}
Attribute
Description
How to C#: Basic SDK Concept of XDoc.Excel Conversely, conversion from PDF to Excel (.XLSX) is also C# project, such as annotation creating, deleting, modifying This class describes bookmarks in a Excel
add bookmark pdf file; create bookmarks pdf files
29
Dynamic Converter Administration Guide
7-37
Script Templates
Comment Not Put in the Output File:
{## COMMENT}
The {## COMMENT} macro allows the template writer to include comments in the
template without including them in the final output files. {## COMMENT} provides the
functionality of {## ignore}, but the text inside the {## COMMENT} block is not
rendered to the output files and is not included in page size calculations. Like
{## IGNORE}, {## COMMENT} macros may not be nested.
Syntax
{## COMMENT}
any HTML or other {##} macros
{## /COMMENT}
Including Other Templates: {## INCLUDE}
This command allows other templates to be inserted into the current template. It works in
a manner similar to the C/C++
# include
directive.
Syntax
{## INCLUDE TEMPLATE=template}
Note: To fully comment out a section of the script template, surround the ## IGNORE
statements with HTML comments, for example:
<!--{## Ignore} (everything between here and the end HTML comment is
commented out) {## /Ignore}-->
Attribute
Description
TEMPLATE
This attribute gives the name of the template to insert.
26
7-38
Dynamic Converter Administration Guide
Script Templates
Setting Options Within the Template:
{## OPTION}
This macro sets an option to a given value. All {## OPTION} statements are executed in
the order in which they are encountered. Remember when using this template macro that
the {## UNIT} tag must be the first template macro in any template.
Options set in the template have template scope. This means that, for example, if a
{## LINK} macro references another template, options in the referenced template are
not affected by the option settings from the parent template. Similarly, when the files
contained in an archive file are converted, Export recursively calls itself to perform the
exports of the child documents in the archive. Each child document is converted using
acopy of the parent template, and that copy does not inherit the option values from the
parent template.
Syntax
{## OPTION OPTION=value}
Note: Options set using {## OPTION} in the template are not inherited by the dynamic
conversions performed on files within archives. Each child conversion receives a fresh
copy of all option values as originally set with DASetOption.
Note: Remember that setting an option in the template overrides any option value set by
an application within the scope of the template.
Attribute
Description
OPTION
See the table below for the supported options and their values.
36
Dynamic Converter Administration Guide
7-39
Script Templates
Supported Options and Values
Option
Description
SCCOPT_GRAPHIC_TYPE
This option sets the format of the graphics
produced by Dynamic Converter when it
converts document embeddings.
The supported values are:
• FI_GIF: GIF graphics
• FI_JPEGFIF: JPEG graphics
• FI_PNG: PNG graphics
• FI_NONE: no graphic conversion
The default is FI_JPEGFIF.
SCCOPT_GIF_INTERLACED
This option specifies whether GIF output
should be interlaced or non-interlaced.
Interlaced GIFs are useful when graphics are
to be downloaded over slow Internet
connections. They allow the browser to
begin to render a low-resolution view of the
graphic quickly and then increase the quality
of the image as it is received. There is no real
penalty for using interlaced graphics.
The supported values are:
• 0 or FALSE (i.e., non-interlaced)
• 1or TRUE (i.e., interlaced)
SCCOPT_JPEG_QUALITY
This options sets the lossyness of JPEG
compression. This should be a value between
1 and 100 (percent), with 100 being the
highest quality but the least compression,
and 1 being the lowest quality but the most
compression.
32
7-40
Dynamic Converter Administration Guide
Script Templates
SCCOPT_GRAPHIC_SIZEMETHOD
This option determines the method used to
size graphics. You can choose among three
methods, each of which involves some
degree of trade off between the quality of the
resulting image and speed of conversion:
• SCCGRAPHIC_QUICKSIZING
• SCCGRAPHIC_SMOOTHSIZING
• SCCGRAPHIC_SMOOTHGRAYSCALE
SIZING
Using the quick sizing option results in the
fastest conversion of color graphics, though
the quality of the converted graphic will be
somewhat degraded.
The smooth sizing option results in a more
accurate representation of the original
graphic, as it uses antialiasing. Antialiased
images may appear smoother and can be
easier to read, but rendering when this option
is set will require additional processing time.
Please note that the smooth sizing option
does not work on images which have a width
or height of more than 4,096 pixels.
The grayscale-only option also uses
antialiasing, but only for grayscale graphics,
and the quick sizing option for any color
graphics.
Option
Description
Documents you may be interested
Documents you may be interested