| Title: Apache(tm) FOP Development: SVG Issues |
| |
| #Apache™ FOP Development: SVG Issues |
| |
| |
| See also [SVG User Documentation](../trunk/graphics.html#svg) for more information. |
| |
| ## Examples { #Examples} |
| |
| These examples illustrate a number of issues relating to conversion to PDF: |
| |
| <caption>SVG to PDF examples</caption> |
| |
| | | svg file | png file | pdf result | |
| |--|----------|----------|------------| |
| | images | [images.svg](svg/images.svg) | [images.png](svg/images.png) | [images.pdf](svg/images.pdf) | |
| | svg linking | [link.svg](svg/link.svg) | [link.png](svg/link.png) | [link.pdf](svg/link.pdf) | |
| | gradients and patterns | [paints.svg](svg/paints.svg) | [paints.png](svg/paints.png) | [paints.pdf](svg/paints.pdf) | |
| | various text and effects on text | [text.svg](svg/text.svg) | [text.png](svg/text.png) | [text.pdf](svg/text.pdf) | |
| | transparent objects | [transparency.svg](svg/transparency.svg) | [transparency.png](svg/transparency.png) | [transparency.pdf](svg/transparency.pdf) | |
| |
| As can be seen most of the specific issues are handled. |
| |
| <note>You will need Acrobat 5.0 to see transparency.</note> |
| |
| <caption>XSL:FO to PDF examples</caption> |
| |
| | | fo file | pdf result | |
| |--|---------|------------| |
| | embedding svg | [embedding.fo](fo/embedding.fo) | [embedding.fo.pdf](fo/embedding.fo.pdf) | |
| |
| ## Developer Notes { #Developer-Notes} |
| |
| For most output formats in FOP the SVG is simply drawn into an image with Batik. For PDF there are a set of classes to handle drawing the [GVT (Graphic Vector Toolkit)](http://xmlgraphics.apache.org/batik/using/architecture.html) into PDF markup. |
| |
| ### Classes { #Classes} |
| |
| These are the relevant classes, found in the package org.apache.fop.svg: |
| |
| |
| - *PDFGraphics2D* |
| |
| used for drawing onto a Graphics2D into an existing pdf document, used internally to draw the svg. |
| |
| - *PDFDocumentGraphics2D* |
| |
| used to create a pdf document and inherits from PDFGraphics2D to do the rest of the drawing. Used by the transcoder to create a standalone pdf document from an svg. Can be used independantly the same as any Graphics2D. |
| |
| - *PDFTranscoder* |
| |
| used by Batik to transcode an svg document into a standalone pdf, via PDFDocumentGraphics2D. |
| |
| ### Ideas { #Ideas} |
| |
| Batik can convert ttf to svg font. This svg font could be converted into a pdf stroked font (type 3 font). |