An IDLgrPDF object saves Object Graphics output to a PDF file.
See IDLgrPDF::Init.
Objects of this class have the following properties. See IDLgrClipboard Properties for details on individual properties.
In addition, objects of this class inherit the properties of all superclasses of this class.
This class has the following methods:
In addition, this class inherits the methods of its superclasses (if any).
The author metadata string for the document.
Property Type |
STRING |
||
Name String |
Author |
||
Get: Yes |
Set: Yes |
Init: Yes |
Registered: Yes |
The creator metadata string for the document.
Property Type |
STRING |
||
Name String |
Creator |
||
Get: Yes |
Set: Yes |
Init: Yes |
Registered: Yes |
A two-element array in the form [width, height] to specify the physical dimensions of the plot on the page. The default is [8, 6].
Property Type |
Integer vector |
||
Name String |
not displayed |
||
Get: Yes |
Set: Yes |
Init: Yes |
Registered: No |
A scalar value specifying the relative size of the text. The default value is 1.0. All text drawn to the device is rescaled by its value. Setting FONT_SCALE to 2.0 draws the font twice as large as the default; 0.5 half as large.
Property Type |
FONT_SCALE |
||
Name String |
not displayed |
||
Get: Yes |
Set: Yes |
Init: Yes |
Registered: No |
An object reference of type IDLgrScene, IDLgrViewgroup, or IDLgrView that specifies the graphic tree of this object. If this property is set to a valid object reference, calling the Draw method on the destination object with no arguments will cause the object reference associated with this property to be drawn. If this object is valid and the destination object is destroyed, this object reference will be destroyed as well. By default the GRAPHICS_TREE property is set equal to the null-object.
Property Type |
Object reference |
||
Name String |
not displayed |
||
Get: Yes |
Set: Yes |
Init: Yes |
Registered: No |
The keywords metadata string for the document.
Property Type |
STRING |
||
Name String |
Keywords |
||
Get: Yes |
Set: Yes |
Init: Yes |
Registered: Yes |
An integer value indicating the rendering quality of lines with a thickness greater than one pixel.
Valid values are:
Value | Description |
---|---|
0 | Low quality - this setting will result in faster performance, but it may introduce minor defects in the lines. |
1 (default) | High quality - this setting produces lines with clean joins at corners and intersections, but it may result in slower performance. |
A two-element array in the form [x, y] specifying the location on page (measured from the bottom-left corner) of any following draw operations. The default is [0.25, 2.5].
Property Type |
Integer vector |
||
Name String |
Location |
||
Get: Yes |
Set: Yes |
Init: Yes |
Registered: No |
A two-element array in the form [xres, yres] specifying the device resolution in centimeters per pixel. The default value is: [0.035277778, 0.035277778] (72 DPI).
Property Type |
USERDEF |
||
Name String |
Resolution |
||
Get: Yes |
Set: Yes |
Init: Yes |
Registered: Yes |
The subject metadata string for the document.
Property Type |
STRING |
||
Name String |
Subject |
||
Get: Yes |
Set: Yes |
Init: Yes |
Registered: Yes |
The title metadata string for the document.
Property Type |
STRING |
||
Name String |
Title |
||
Get: Yes |
Set: Yes |
Init: Yes |
Registered: Yes |
An integer value that indicates the units of measure for the DIMENSIONS property. Valid values are:
Property Type |
Integer |
||
Name String |
not displayed |
||
Get: Yes |
Set: Yes |
Init: Yes |
Registered: No |
Adds a new page to the document.
Obj->[IDLgrPDF::]AddPage [, DIMENSIONS=dims] [, /LANDSCAPE]
Set this keyword to a two-element array in the form [w, h] specifying the size of the page. Default is [8.5, 11].
Set this keyword to a nonzero value to indicate that the page is in landscape orientation. Default is 0.
This method clears the working PDF document in memory; after this operation the document contains no pages, just as after initial creation.
Obj->[IDLgrPDF::]Clear
None
This method draws a given IDLgrView object to the current page. The view parameter may be omitted if the GRAPHICS_TREE property is set with a default view. If no pages have been added yet, this method returns an error.
Obj->[IDLgrPDF::]Draw [, view] [, VECTOR={0,1}] [, VECT_SHADING={0,1}] [, VECT_SORTING={0,1}]
The view (an instance of an IDLgrView object), viewgroup (an instance of an IDLgrViewgroup object), or scene (an instance of an IDLgrScene object) to be drawn.
Set this keyword to indicate the type of graphics primitives generated. The default value is 1. Valid values are:
This keyword has an effect only when generating vector output (VECTOR=1).
This keyword controls the appearance of smooth (Gouraud) shaded IDLgrPolygon and IDLgrSurface objects. Valid values are:
This keyword has an effect only when generating vector output (VECTOR=1).
This keyword controls the way object primitives in a picture appear in the destination. Valid values are:
Initializes the class with default values or any provided property values, and creates an empty document in memory.
Obj = OBJ_NEW('IDLgrPDF' [, PROPERTY=value])
or
Result = Obj->[IDLgrPDF::]Init( [, PROPERTY=value]) (In a lifecycle method only.)
When this method is called indirectly, as part of the call to the OBJ_NEW function, the return value is an object reference to the newly-created object.
When called directly within a subclass Init method, the return value is 1 if initialization was successful, or zero otherwise.
None
None
Saves the working PDF document in memory out to a file with the given name.
Obj->[IDLgrPDF::]Save, filename
The file name and location to save the PDF file.
None
This example creates some sample data to output to a PDF file. It then sets up the PDF pages and saves the output to PDF. You can copy the entire code example into the IDL editor, then save and run it. After it runs, view the example.pdf
file in the current IDL directory.
PRO PDF_Example
; Create some data to plot
dataX = Findgen(200)
dataY = Sin(dataX*2*!PI/25.0)*Exp(-0.01*dataX)
; Set up the graphics tree
oModel = OBJ_NEW('IDLgrModel')
oView = OBJ_NEW('IDLgrView', VIEWPLANE_RECT=[-50,-1.5,300,3])
oPlot = OBJ_NEW('IDLgrPlot', dataX, dataY)
oXAxis = OBJ_NEW('IDLgrAxis', 0, LOCATION=[0,-1], RANGE=[0,200], $
TICKINTERVAL=50, TICKDIR=1)
oYAxis = OBJ_NEW('IDLgrAxis', 1, RANGE=[-1,1], TICKINTERVAL=0.5, $
TICKLEN=10, TICKDIR=1)
oTitle = OBJ_NEW('IDLgrText', LOCATION=[100,1.2], ALIGNMENT=0.5)
oModel->Add, oPlot
oModel->Add, oXAxis
oModel->Add, oYAxis
oModel->Add, oTitle
oView->Add, oModel
oPDF = OBJ_NEW('IDLgrPDF')
; Add a PDF page.
oPDF->AddPage ; Default layout is portrait, 8.5"x11"
oTitle->SetProperty, STRING='Page 1 - vector plot'
oPDF->Draw, oView
oPDF->SetProperty, UNITS=2, LOCATION=[2, 9], DIMENSIONS=[14, 10]
oPDF->AddPage, DIMENSIONS=[21.0, 29.7], /LANDSCAPE ; A4 paper size
oTitle->SetProperty, STRING='Page 2 - This one is a vector plot'
oPDF->Draw, oView
oPDF->SetProperty, LOCATION=[15, 2], RESOLUTION=[2.54/300, 2.54/300]
oTitle->SetProperty, STRING='...and this one is rasterized at 300 DPI'
oPDF->Draw, oView, VECTOR=0
; Save the output to a PDF file in the current directory.
oPDF->Save, 'example.pdf'
END
8.0 |
Introduced |
8.2 | Added LINE_QUALITY property |