Creating SVG (Scalable Vector Graphics) Files
Using Universal Printing
Overview of Scalable Vector Graphics in SAS
Scalable Vector Graphics in SAS
Scalable Vector Graphics (SVG) is an XML language for describing two-dimensional
vector graphics. SAS creates SVG documents based on the W3C recommendation for
SVG documents. SAS SVG documents are created using the UNICODE standard
encoding UTF-8.
SAS can create SVG documents by using Universal Printers and SAS/GRAPH device
drivers. Because SAS/GRAPH SVG device drivers use the SVG Universal Printers, this
section contains some information about creating SVG documents using SAS/GRAPH.
Most often in SAS, the SVG Universal Printers and device drivers are used to create
graphs. Graphs can be created by using ODS Graphics or SAS/GRAPH. You can also
use the SVG Universal Printers to show tables or reports that you create as SVG
documents.
Several ODS destinations (EPUB, HTML, HTML5, LISTING, and PRINTER
destinations) can be used to create SVG documents. SVG is the default Universal Printer
and device driver for the ODS HTML5 destination.
SVG documents can be stand-alone files or integrated within an HTML5 or EPUB file.
A stand-alone SVG document can be referenced as a link target, referenced as an
embedded file in an HTML document, or referenced as a CSS2 or XSL property. For
information about embedding SVG documents in web pages, see the topic on using SVG
documents in web pages in the SVG 1.1 specification on the W3 SVG website http://
www.w3.org/TR/SVG.
Multi-page SVG documents can be animated in Base SAS and SAS/GRAPH. When you
create animated SVG documents in Base SAS using Universal Printing without
specifying any ODS Graphics procedures, the animated SVG documents appear as a
slide show or an animated PowerPoint presentation. For more information, see “Creating
Animated GIF Images and SVG Documents” on page 343.
If you have SAS/GRAPH installed, your SVG documents can contain links and pop-up
text boxes.
The information provided here is limited to creating SVG documents using Universal
Printers in Base SAS and ODS Graphics. For more information about creating SVG files
in SAS/GRAPH, see “Enhancing Web Presentations with Chart Descriptions, Data Tips,
and Drill-Down Functionality ” in SAS/GRAPH: Reference.
For detailed information about the SVG standard, see the W3 documentation at http://
www.w3.org/TR/SVG.
SVG Terminology
SVG canvas
the space upon which the SVG document is rendered.
314 Chapter 15 Printing with SAS
viewBox
specifies the coordinate system and the area of the SVG document that is visible in
the viewport.
viewport
a finite rectangular space within the SVG canvas where an SVG document is
rendered. In SAS, the viewport is determined by the value of the PAPERSIZE=
system option for a scalable viewport and by the SVGWIDTH= and SVGHEIGHT=
system options for a static viewport.
viewport coordinate system or viewport space
the starting X and Y coordinates and the width and height values of the viewport.
user coordinate system or user space
the starting X and Y coordinates and the width and height values of the area of the
document to display in the viewport.
user units
is equal to one unit of measurement that is defined in your environment's coordinate
system. In many cases, the coordinate system uses pixels. Check with your system
administrator to determine the unit of measure that is used in your environment.
Why Create SVG Documents?
SVG documents are displayed clearly at any size in any viewer or browser that supports
SVG. SVG documents are ideal for producing documents to display on a computer
monitor, PDA, or cell phone; or documents to be printed. Because it is a vector graphic,
a single SVG document can be transformed to any screen resolution without
compromising the clarity of the document. In comparison, a multiple raster graphic
image might require using different screen resolutions in order to display the image at
various screen resolutions and sizes.
An SVG document might also be smaller in file size than the same image created by a
raster graphic Universal Printer, such as GIF or PNG.
Web Server Content Type for SVG Documents
If the mime content type setting for your web server does not have the correct setting for
SVG documents, your web browser might render SVG documents as text files, or SVG
documents might be unreadable.
To ensure that SVG documents are rendered correctly, configure your web server to use
this mime content type:
image/svg+xml
The SVG Universal Printers and the Output That They Create
The following table lists the SAS SVG Universal Printers.
Table 15.19 SVG Universal Printers
Printer Name Description
SVG
*
produces SVG 1.1 documents.
Creating SVG (Scalable Vector Graphics) Files Using Universal Printing 315
Printer Name Description
SVGt
*
produces SVG 1.1 documents that are
transparent (no background).
SVGnotip produces SVG 1.1 documents without
tooltips.
SVGZ
*
produces compressed SVG 1.1 documents.
SVGView
*
produces SVG1.1 documents with
navigational controls when the SVG file
contains multiple pages.
*
When you use this printer in SAS/GRAPH, you can create pop-up data tips. For more information, see
“Data Tips for Web Presentations” in SAS/GRAPH: Reference.
SVG prototypes for creating printers are available in the SAS Registry under CORE
PRINTINGPROTOTYPES. You can define your own SVG printer using the PRTDEF
procedure. For more information, see “PRTDEF” in Base SAS Procedures Guide and
“Managing Universal Printers Using the PRTDEF Procedure” on page 276.
For a description of an SVG printer, you can either view the printer in the SAS registry
or submit the following QDEVICE procedure and view the output in the SAS log:
proc qdevice;
printer svg-printer-name;
run;
See Also
“Color Support for Universal Printers” on page 247
“Creating Animated GIF Images and SVG Documents” on page 343
How to Create SVG Documents
Fundamentals of Creating SVG Documents Using Universal Printers
You can create SVG documents by using the Print dialog box or by using programming
statements.
To create SVG documents by using the Print dialog box, select an SVG printer from the
Name drop-down list box.
316 Chapter 15 Printing with SAS
Figure 15.34 Print Dialog Box for Printing an SVG Document
To create SVG documents programmatically, specify an SVG Universal Printer as the
value of the PRINTERPATH= system option. Also, specify an ODS destination, such as
the ODS PRINTER statement, as shown below.
options printerpath=svg;
ods html close;
ods printer;
...more SAS code...
ods printer close;
ods html;
Alternatively, you can specify the SVG printer in the ODS PRINTER statement and
eliminate the OPTIONS statement, as shown below.
ods html close;
ods printer printer=svg;
...more SAS code...
ods printer close;
ods html;
Creating SVG (Scalable Vector Graphics) Files Using Universal Printing 317
To create SVG graphs using SAS/GRAPH, you can use the ODS LISTING statement:
You can create SVG graphs for ODS Graphics using these statements:
ods html5 options (svg_mode="inline");
ods graphics /imagefmt=svg;
...more SAS code...
ods html5 close;
options printerpath=svg;
ods html;
...more SAS code...
ods html close;
ods listing;
ods graphics /imagefmt=svg;
...more SAS code...
ods listing close;
Using SAS/GRAPH:
ods listing;
goptions dev=SVG;
...more SAS code...
ods listing close;
SAS has several system options that enable you to modify various aspects of your SVG
document. Here are some SVG document traits:
a specific SVG Universal Printer
the height and width of the SVG document
the size of the viewBox
whether a multi-page SVG document contains navigational controls
By using the NEWFILE option in the ODS PRINTER statement, you can create an SVG
document for the output from each procedure or DATA step.
For more information, see the following language elements:
“PRINTERPATH= System Option” in SAS System Options: Reference
“ODS PRINTER Statement ” in SAS Output Delivery System: Users Guide
System Options for SVG Documents on page 322
A Summary of ODS Destinations to Create SVG Documents
The following table shows the ODS destinations that you can use to create SVG
documents and the output that is created:
318 Chapter 15 Printing with SAS
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.47.169