Print composer

提供: OSGeo.JP Wiki
移動: 案内検索

Print Composer

The print composer provides growing layout and printing capabilities. It allows you to add elements such as the QGIS map canvas, legend, scalebar, images, and text labels. You can size, group align and position each element and adjust the properties to create your layout. The layout can be printed (also to Postscript and PDF), exported to image formats or to SVG <ref>Export to SVG supported, but it is not working properly with some recent QT4 versions. You should try and check individual on your system</ref> and you can save the layout as template and load it again in another session. See a list of tools in table 4:

表 4: Print Composer Tools
Icon Purpose Icon Purpose
MActionFolder.png Load from template MActionFileSaveAs.png Save as template
MActionExportMapServer.png Export to an image format MActionSaveAsSVG.png Export print composition to SVG
MActionFilePrint.png Print or export as PDF or Postscript MActionZoomFullExtent.png Zoom to full extend
MActionZoomIn.png Zoom in MActionZoomOut.png Zoom out
MActionDraw.png Refresh view MActionAddRasterLayer.png Add new map from QGIS map canvas
MActionSaveMapAsImage.png Add Image to print composition MActionLabel.png Add label to print composition
MActionAddLegend.png Add new legend to print composition MActionScaleBar.png Add new scalebar to print composition
MActionSelectPan.png Select/Move item in print composition MActionMoveItemContent.png Move content within an item
MActionGroupItems.png Group items of print composition MActionUngroupItems.png Ungroup items of print composition
MActionRaiseItems.png Raise selected items MActionLowerItems.png Lower selected items
MActionMoveItemsToTop.png Move selected items to top MActionMoveItemsToBottom.png Move selected items to bottom
MActionAlignLeft.png Align selected items left MActionAlignRight.png Align selected items right
MActionAlignHCenter.png Align selected items center MActionAlignVCenter.png Align selected items center vertical
MActionAlignTop.png Align selected items top MActionAlignBottom.png Align selected items bottom

To access the print composer, click on the MActionFilePrint.png Print button in the toolbar or choose File > MActionFilePrint.png Print Composer.

Using Print Composer

Before you start to work with the print composer, you need to load some raster and vector layers in the QGIS map canvas and adapt their properties to suite your own convinience. After everything is rendered and symbolized to your liking you click the MActionFilePrint.png Print Composer icon.

図 35: Print Composer Nix.png
Print composer blank.png

Opening the print composer provides you with a blank canvas to which you can add the current QGIS map canvas, legend, scalebar, images and text. Figure 35 shows the initial view of the print composer with an activated CheckBox.pngSnap to grid modus but before any elements are added. The print composer provides two tabs:

  • The General tab allows you to set paper size, orientation, the print quality for the output file in dpi and to activate snapping to a grid of a defined resolution. Please note, the CheckBox.pngSnap to grid feature only works, if you define a grid resolution > 0. Furthermore you can also activate the CheckBox.pngPrint as raster checkbox. This means all elements will be rastered before printing or saving as Postscript of PDF.
  • The Item tab displays the properties for the selected map element. Click the MActionSelectPan.png Select/Move item icon to select an element (e.g. legend, scalebar or label) on the canvas. Then click the Item tab and customize the settings for the selected element.

You can add multiple elements to the composer. It is also possible to have more than one map view or legend or scalebar in the print composer canvas. Each element has its own properties and in the case of the map, its own extent.

Adding a current QGIS map canvas to the Print Composer

To add the QGIS map canvas, click on the MActionAddRasterLayer.png Add new map from QGIS map canvas button in the print composer toolbar and drag a rectangle on the composer canvas with the left mouse button to add the map. You will see an empty box with a "Map will be printed here" message. To display the current map, you can choose between three different modes in the map Item tab:

  • Preview Rectangle SelectString.png is the default setting. It only displays an empty box with a message "Map will be printed here".
  • Preview Cache SelectString.png renders the map in the current screen resolution. If case you zoom in or out the composer window, the map is not rendered again but the image will be scaled.
  • Preview Render SelectString.png means, that if you zoom in or out the composer window, the map will be rendered again, but for space reasons, only up to a maximum resolution.
図 36: Print Composer map item tab content Nix.png
(a) Width, height and extend dialog
Print composer map item1.png
(b) Properties dialog
Print composer map item2.png

You can resize the map later by clicking on the MActionSelectPan.png Select/Move item button, selecting the element, and dragging one of the blue handles in the corner of the map. With the map selected, you can now adapt more properties in the map Item tab. Resize the map item specifying the width and height or the scale. Define the map extend using Y and X min/max values or clicking the set to map canvas extend button. Update the map preview and select, whether to see a preview from cache or an empty rectangle with a "Map will be printed here" message. Define colors and outline width for the element frame, set a background color and opacity for the map canvas. And you can also select or unselect to display an element frame with the CheckBox.pngframe checkbox (see Figure 36). If you change the view on the QGIS map canvas by zooming or panning or changing vector or raster properties, you can update the print composer view selecting the map element in the print composer and clicking the Update Preview button in the map Item tab (see Figure 36).

To move layers within the map element select the map element, click the MActionMoveItemContent.png Move item content icon and move the layers within the map element frame with the left mouse button.

Navigation tools

For map navigation the print composer provides 4 general tools:

  • MActionZoomOut.png Zoom in,
  • MActionZoomOut.png Zoom out,
  • MActionZoomFullExtent.png Zoom to full extend and
  • MActionDraw.png Refresh the view, if you find the view in an inconsistent state.


Adding other elements to the Print Composer

Besides adding a current QGIS map canvas to the Print Composer, it is also possible to add, position, move and customize legend, scalebar, images and label elements.

Label and images

To add a label or an image, click the MActionLabel.png Add label or MActionSaveMapAsImage.png Add image icon, place the element with the left mouse button on the print composer canvas and position and customize their appearance in the Item tab.

図 37: Customize print composer label and images Nix.png
(a) label item tab
Print composer label item.png
(b) image item tab
Print composer image item.png
Legend and scalebar

To add a map legend or a scalebar, click the MActionAddLegend.png Add new legend or MActionScaleBar.png Add new scalebar icon, place the element with the left mouse button on the print composer canvas and position and customize their appearance in the Item tab.

図 38: Customize print composer legend and scalebar Nix.png
(a) legend item tab
Print composer legend item.png
(b) scalebar item tab
Print composer scalebar item.png

Raise, lower and align elements

Raise or lower functionalities for elements are inside the MActionRaiseItems.png Raise selected items pulldown menu. Choose an element on the print composer canvas and select the matching functionality to raise or lower the selected element compared to the other elements (see table 4).

There are several alignment functionalities available within the MActionAlignLeft.png Align selected items pulldown menu (see table 4). To use an alignment functionality , you first select some elements and then click on the matching alignment icon. All selected will then be aligned within to their common bounding box.

Creating Output

Figure 39 shows the print composer with an example print layout including each type of map element described in the sections above.

図 39: Print Composer with map view, legend, scalebar, and text added Nix.png
Print composer complete.png

The print composer allows you to create several output formats and it is possible to define the resolution (print quality) and paper size:

  • The MActionFilePrint.png Print icon allows to print the layout to a connected printer or as PDF or Postscript file depending on installed printer drivers.
  • The MActionExportMapServer.png Export as image icon exports the composer canvas in several image formats such as PNG, BPM, TIF, JPG, ...
  • The MActionSaveAsSVG.png Export as SVG icon saves the print composer canvas as a SVG (Scalable Vector Graphic). Note: Currently the SVG output is very basic. This is not a QGIS problem, but a problem of the underlaying Qt library. This will hopefully be sorted out in future versions.

Saving and loading a print composer layout

With the MActionFileSaveAs.png Save as template and MActionFolder.png Load from template icons you can save the current state of a print composer session as a *.qpt template and load the template again in another session.