PDF fully integrates text and graphics. In fact, text characters are viewed as graphic objects in PDF, just as they are in PostScript.
PDF is the native file format of the Adobe Acrobat Family of products. The Adobe Acrobat reader is the most common PDF viewer. It is available for free from the Adobe web site.
There are many PDF related books on the market. For a complete description of the format, see PDF Reference, Third Edition, version 1.4, published in 2001 by Adobe Systems Incorporated. However, if you are just viewing or automatically creating PDF, then there is no need for you to understand the actual language format.
The following table summarizes the PDF workstation types in NCAR GKS:
Table 4: NCAR GKS Workstation Types for PDF Output ------------------------- Workstation type orientation ------------------------- 11 portrait 12 landscape -------------------------------------------------------
As an example, let's look at a simple Fortran code fragment that opens and activates a workstation that produces a PDF file in landscape mode:
CALL GOPKS(3,IDUMMY) CALL GOPWK(3,0,12) CALL GACWK(3)After this code is executed, a file named "gmeta3.pdf" will be produced that contains the desired PDF output. It is possible to override the default file name. This is done in the same way as overriding the output name for PostScript output. .
There are equivalent PostScript characters for all of the characters from the filled fonts in Plotchar, except for a couple of the math symbols, and except for all of the WMO weather symbols. Additionally, the italic and bold italic fonts, not available in Plotchar, are available for the Helvetica, Times, and Courier font families.
There are no equivalents for all characters in all fontcap-defined fonts. For example, the script fonts and the old English font are entirely missing. Also things like the Zodiacal symbols from the NCAR Symbol Font are not available. If a requested character is not available from a PostScript font, NCAR GKS issues a warning message and suggests using Plotchar.
There are two big advantages to using PostScript fonts in place of Plotchar fonts. One is that there is a dramatic difference in PDF file sizes. Plotchar inserts either strokes or filled areas into the output stream in order to render its characters. There may be dozens of coordinates (with each coordinate pair requiring a dozen bytes in the output PDF) issued for a single character produced by Plotchar. Using the PostScript fonts requires using only a few bytes additional to those in the string to be rendered.
The second advantage to using PostScript fonts is that they will be rendered accurately at small sizes on low resolution output devices. A great deal of effort has gone into most PDF interpreters to accurately render characters at all sizes. When the characters produced by Plotchar get too small, some of the areas may fall between pixels on the output device and do not get plotted.
The following table summarizes the relationships between the PostScript fonts and the NCAR GKS fonts:
Table 5: Mapping between NCAR GKS fonts and PostScript fonts ------------------------------------------------------------------------ NCAR GKS NCAR GKS font name PostScript equivalent font number ------------------------------------------------------------------------ 1 default Helvetica -2 Hershey Cartographic Roman Helvetica (scaled small) -3 Hershey Cartographic Greek Greek from Symbol font (scaled) -4 Hershey Simplex Roman Helvetica -5 Hershey Simplex Greek Greek from Symbol font -6 Hershey Simplex Script none -7 Hershey Complex Roman Times-Roman -8 Hershey Complex Greek Greek from Symbol font -9 Hershey Complex Script none -10 Hershey Complex Italic Times-Italic -11 Hershey Complex Cyrillic none -12 Hershey Duplex Roman Helvetica -13 Hershey Triplex Roman Times-Bold -14 Hershey Triplex Italic Times Bold-Italic -15 Hershey Gothic German none -16 Hershey Gothic English none -17 Hershey Gothic Italian none -18 Hershey Math Symbols math symbols from Symbol font -19 Hershey Symbol Set1 none -20 Hershey Symbol Set2 none -21 NCAR Helvetica Helvetica -22 NCAR Helvetica-Bold Helvetica-Bold -23 none Helvetica-Oblique -24 none Helvetica-BoldOblique -25 NCAR Times-Roman Times-Roman -26 NCAR Times-Bold Times-Bold -27 none Times-Italic -28 none Times-BoldItalic -29 NCAR Courier Courier -30 NCAR Courier-Bold Courier-Bold -31 none Courier-Oblique -32 none Courier-BoldOblique -33 NCAR Greek Greek from Symbol font -34 NCAR Math Symbols math symbols from Symbol font -35 NCAR Text Symbols text symbols from Symbol font -36 NCAR Weather 1 none -37 NCAR Weather 2 none ------------------------------------------------------------------------
On certain occasions it may be desirable to use the entire area of a rectangular output page, or even to change the aspect ratio of the plot. PDF output from NCAR GKS can be made to occupy any position on the page by way of setting coordinate boundaries using control parameters LX, LY, UX, UY. These numbers are integers and specify corner points (LX,LY) and (UX,UY) that bound the output on the page. The numbers are specified in the default PDF coordinate space where one unit corresponds to 1/72 of an inch. In order to preserve aspect ratio, the output rectangle should be specified as a square. For example, if you want your output to occupy a square in the upper left part of a page in portrait mode, you would make calls such as:
CALL NGSETI('LX',50) CALL NGSETI('LY',500) CALL NGSETI('UX',300) CALL NGSETI('UY',750)Values must be specified for all four parameters LX, LY, UX, and UY.
For example, suppose that you choose a landscape mode PDF workstation and specify the following values:
LX = 50 LY = 50 UX = 742 UY = 562Here is what happens using these specifications. The NDC unit square will first be mapped to fit in the rectangle with lower left corner (50,50) and upper right corner (742,562) [if drawn in portrait mode, this plot would run off the right of an 8.5" x 11" piece of paper]. This rectangle is then rotated by 90 degrees clockwise about the point (50,50), giving a rectangle with coordinates (50,50) at the upper left and (562,-642) at the lower right. This rectangle is then translated vertically by 692, giving a rectangle with corner points (50,50) at the lower left and (562,742) at the upper right. Since the extreme corners of a printed 8.5" x 11" page are (0,0) and (612,792), the above rectangle will fit entirely within the page. The above settings distort the aspect ratio of the plot by elongating it and then rotating it so that it fits on the page.
You will probably not want to distort the aspect ratio of your plots when plotting to a full page, since the plots will have characters that look funny, circles will appear as ellipses, and so forth. In this case you should start with a plot such that the drawable part has an aspect ratio suitable for filling an 8.5" x 11" page. Figure 19 and Figure 20 illustrate this. The landscape version in Figure 20 was positioned by using workstation type 12 (landscape mode) and making the following calls:
CALL NGSETI('LX',50) CALL NGSETI('LY',50) CALL NGSETI('UX',742) CALL NGSETI('UY',742)Notice that the aspect ratio of the drawable part of the original plot is 4 to 3, and white space is left above the plot in order for it to be plotted correctly after it is rotated and translated. See the above discussion on positioning your output in order to understand the above subroutine calls.
CALL NGSETC('ME','pdf_file_name')just prior to the GOPWK call that opens the workstation will assign the desired name to the output file. The name can be up to 256 characters long.
You can assign 'stdout' to the output file name with a call to NGSETC and the output will go to standard out. This is only practical when you are writing to a single PDF output file. Also, be aware that errors or warnings are usually written to the standard output file and intermingling these with the output PDF will corrupt the PDF.
CALL NGSETI('CM',IVAL)where IVAL=0 (IVAL=1 selects the default RGB model).
The above call must be made just prior to the GOPWK call that opens the PDF workstation.
CALL NGSETI('Workstation',WKID) CALL NGSETI('Full background',1)where WKID is an integer workstation identifier. The setting for full background will apply only to the workstation specified in the most recent NGSETI call that sets the workstation ID.
CALL NGSETI('WO',WKID) CALL NGSETR('NO',2.)would double the width of the nominal linewidth. This means that all lines would uniformly appear to be twice as thick as they would be in the default case. Figure 22 illustrates the result of changing the size of the nominal linewidth and then changing linewidths using GSLWSC. Just remember that the linewidth scale factors given to GSLWSC apply to the nominal linewidth, whereas setting a new value for the nominal linewidth will uniformly change the width of all lines.
Filled areas present a more difficult situation than polylines in that the entire path must be presented in its entirety to be filled. For filled areas that exceed the limit on the maximum path size, software fill is utilized. This means the instead of presenting an entire path to the PDF fill operator, the area is filled by drawing a sequence of horizontal lines that are thick enough so that no gaps will be displayed. If you are generating filled areas that have more than 1300 points in them and you are using a PDF viewer that allows for more points than this, then you may want to consider increasing the limit on the maximum number of points in a path. You can do this by using the "PA" (or "Path size") parameter in an NGSETI call.
The savings in file size and interpretation time can be substantial (up to 50% or greater for files containing only large filled areas), but on the average (files that have one or two large filled areas) the savings are considerably more modest (1-10%). Setting the maximum path size to a small number can be used to force software fill, if that is ever desired.
If you are plotting on a device with crude resolution and could get by with many fewer lines than the default, then you may want to consider resetting this value, which can be done by using the "FI" (or "Fill lines") parameter in an NGSETR call. If you are going to a super high resolution device, then it is possible that you will see discrete line ends on edges of filled areas that are at an acute angle. If this is undesired, then you may consider decreasing the value for FI (increasing the number of fill lines). Remember that by tuning the number of fill lines for a specific device may cause undesirable results on another device. Also, remember that software fill is not invoked unless the number of points in a filled area exceeds the maximum number of points allowed in a path.
In the default user integer coordinate space, an 8.5" x 11" output page in portrait mode would have X coordinates in the range 0 to 612 and Y coordinates in the range 0 to 792.
This is a fairly crude resolution, and when it is mapped onto a device space with much higher resolution (such as a 300dpi printer), the increased resolution of the output device is not fully utilized. PDF allows for scaling the user space so that you can use higher resolutions. The default user coordinate space in PDF produced from NCAR GKS scales the normal default user space by 25. For an 8.5" x 11" page in portrait mode this produces coordinates in the range 0 to 15300 in X and 0 to 19800 in Y. This space is the default user space scaled by 25. This scale factor can be controlled by the NGSETI parameter 'CO' (or 'Coordinate scale'). By default it is 25 as discussed above. If you are plotting to a device with crude resolution, then you might consider setting this scale factor to something smaller than 25. By doing so, the file sizes will be reduced in accordance with the smaller number of characters needed to represent the coordinates in the resultant PDF file. If you are plotting to a very high resolution printer and notice that you are not taking full advantage of the resolution of the device, then you may want to consider increasing the resolution of the PDF user space by setting the scale factor controlled by 'CO' to something larger than 25.