Documentation ¶
Overview ¶
Package tiff allows standard (LZW-compressed) TIFF images to be used in documents generated with gofpdf.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterFile ¶
func RegisterFile(pdf *fpdf.Fpdf, imgName string, options fpdf.ImageOptions, tiffFileStr string) (info *fpdf.ImageInfoType)
RegisterFile registers a TIFF image, adding it to the PDF file but not adding it to the page. imgName specifies the name that will be used in the call to Image() that actually places the image in the document. options specifies various image properties; in this case, the ImageType property should be set to "tiff". The TIFF image is read from the file specified by tiffFileStr.
Example ¶
ExampleRegisterFile demonstrates the loading and display of a TIFF image.
package main import ( "github.com/go-pdf/fpdf" "github.com/go-pdf/fpdf/contrib/tiff" "github.com/go-pdf/fpdf/internal/example" ) func main() { pdf := fpdf.New("L", "mm", "A4", "") pdf.SetFont("Helvetica", "", 12) pdf.SetFillColor(200, 200, 220) pdf.AddPageFormat("L", fpdf.SizeType{Wd: 200, Ht: 200}) opt := fpdf.ImageOptions{ImageType: "tiff", ReadDpi: false} _ = tiff.RegisterFile(pdf, "sample", opt, "../../image/golang-gopher.tiff") pdf.Image("sample", 0, 0, 200, 200, false, "", 0, "") fileStr := example.Filename("Fpdf_Contrib_Tiff") err := pdf.OutputFileAndClose(fileStr) example.Summary(err, fileStr) }
Output: Successfully generated ../../pdf/Fpdf_Contrib_Tiff.pdf
func RegisterReader ¶
func RegisterReader(pdf *fpdf.Fpdf, imgName string, options fpdf.ImageOptions, r io.Reader) (info *fpdf.ImageInfoType)
RegisterReader registers a TIFF image, adding it to the PDF file but not adding it to the page. imgName specifies the name that will be used in the call to Image() that actually places the image in the document. options specifies various image properties; in this case, the ImageType property should be set to "tiff". The TIFF image is a reader from the reader specified by r.
Types ¶
This section is empty.