Package vgpdf implements the vg.Canvas interface using gofpdf (

    Example (EmbedFonts)

      Example_embedFonts shows how one can embed (or not) fonts inside a PDF plot.

      Example (Multipage)

        Example_multipage shows how one can create a PDF with multiple pages.





        View Source
        const DPI = 72

          DPI is the nominal resolution of drawing in PDF.


          This section is empty.


          This section is empty.


          type Canvas

          type Canvas struct {
          	// contains filtered or unexported fields

            Canvas implements the vg.Canvas interface, drawing to a PDF.

            func New

            func New(w, h vg.Length) *Canvas

              New creates a new PDF Canvas.

              func (*Canvas) DPI

              func (c *Canvas) DPI() float64

              func (*Canvas) DrawImage

              func (c *Canvas) DrawImage(rect vg.Rectangle, img image.Image)

                DrawImage implements the vg.Canvas.DrawImage method.

                func (*Canvas) EmbedFonts

                func (c *Canvas) EmbedFonts(v bool) bool

                  EmbedFonts specifies whether the resulting PDF canvas should embed the fonts or not. EmbedFonts returns the previous value before modification.

                  func (*Canvas) Fill

                  func (c *Canvas) Fill(p vg.Path)

                  func (*Canvas) FillString

                  func (c *Canvas) FillString(fnt vg.Font, pt vg.Point, str string)

                  func (*Canvas) NextPage

                  func (c *Canvas) NextPage()

                    NextPage creates a new page in the final PDF document. The new page is the new current page. Modifications applied to the canvas will only be applied to that new page.

                    func (*Canvas) Pop

                    func (c *Canvas) Pop()

                    func (*Canvas) Push

                    func (c *Canvas) Push()

                    func (*Canvas) Rotate

                    func (c *Canvas) Rotate(r float64)

                    func (*Canvas) Scale

                    func (c *Canvas) Scale(x float64, y float64)

                    func (*Canvas) SetColor

                    func (c *Canvas) SetColor(clr color.Color)

                    func (*Canvas) SetLineDash

                    func (c *Canvas) SetLineDash(dashes []vg.Length, offs vg.Length)

                    func (*Canvas) SetLineWidth

                    func (c *Canvas) SetLineWidth(w vg.Length)

                    func (*Canvas) Size

                    func (c *Canvas) Size() (w, h vg.Length)

                    func (*Canvas) Stroke

                    func (c *Canvas) Stroke(p vg.Path)

                    func (*Canvas) Translate

                    func (c *Canvas) Translate(pt vg.Point)

                    func (*Canvas) WriteTo

                    func (c *Canvas) WriteTo(w io.Writer) (int64, error)

                      WriteTo writes the Canvas to an io.Writer. After calling Write, the canvas is closed and may no longer be used for drawing.

                      Source Files