This commit is contained in:
Klaus Wendel, archium GmbH 2021-03-03 09:31:28 +01:00
parent 7272aa1ddf
commit 7e9370d183
2 changed files with 7 additions and 7 deletions

10
fpdf.go
View File

@ -223,7 +223,7 @@ func fpdfNew(orientationStr, unitStr, sizeStr, fontDirStr string, size SizeType,
// alternative to New() that provides additional customization. The PageSize() // alternative to New() that provides additional customization. The PageSize()
// example demonstrates this method. // example demonstrates this method.
func NewCustom(init *InitType) (f *Fpdf) { func NewCustom(init *InitType) (f *Fpdf) {
return fpdfNew(init.OrientationStr, init.UnitStr, init.SizeStr, init.FontDirStr, init.Size) return fpdfNew(init.OrientationStr, init.UnitStr, init.SizeStr, init.FontDirStr, init.Size, init.Density)
} }
// New returns a pointer to a new Fpdf instance. Its methods are subsequently // New returns a pointer to a new Fpdf instance. Its methods are subsequently
@ -246,8 +246,8 @@ func NewCustom(init *InitType) (f *Fpdf) {
// reference an actual directory if a font other than one of the core // reference an actual directory if a font other than one of the core
// fonts is used. The core fonts are "courier", "helvetica" (also called // fonts is used. The core fonts are "courier", "helvetica" (also called
// "arial"), "times", and "zapfdingbats" (also called "symbol"). // "arial"), "times", and "zapfdingbats" (also called "symbol").
func New(orientationStr, unitStr, sizeStr, fontDirStr string) (f *Fpdf) { func New(orientationStr, unitStr, sizeStr, fontDirStr string, density float64) (f *Fpdf) {
return fpdfNew(orientationStr, unitStr, sizeStr, fontDirStr, SizeType{0, 0}) return fpdfNew(orientationStr, unitStr, sizeStr, fontDirStr, SizeType{0, 0}, density)
} }
// Ok returns true if no processing errors have occurred. // Ok returns true if no processing errors have occurred.
@ -3079,12 +3079,12 @@ func (f *Fpdf) imageOut(info *ImageInfoType, x, y, w, h float64, allowNegativeX,
// //
// Deprecated in favor of ImageOptions -- see that function for // Deprecated in favor of ImageOptions -- see that function for
// details on the behavior of arguments // details on the behavior of arguments
func (f *Fpdf) Image(imageNameStr string, x, y, w, h float64, flow bool, tp string, link int, linkStr string) { func (f *Fpdf) Image(imageNameStr string, x, y, w, h float64, flow bool, tp string, link int, linkStr string, density float64) {
options := ImageOptions{ options := ImageOptions{
ReadDpi: false, ReadDpi: false,
ImageType: tp, ImageType: tp,
} }
f.ImageOptions(imageNameStr, x, y, w, h, flow, options, link, linkStr) f.ImageOptions(imageNameStr, x, y, w, h, flow, options, link, linkStr, density)
} }
// ImageOptions puts a JPEG, PNG or GIF image in the current page. The size it // ImageOptions puts a JPEG, PNG or GIF image in the current page. The size it

View File

@ -26,10 +26,10 @@ import (
*/ */
// newTpl creates a template, copying graphics settings from a template if one is given // newTpl creates a template, copying graphics settings from a template if one is given
func newTpl(corner PointType, size SizeType, orientationStr, unitStr, fontDirStr string, fn func(*Tpl), copyFrom *Fpdf) Template { func newTpl(corner PointType, size SizeType, orientationStr, unitStr, fontDirStr string, density float64, fn func(*Tpl), copyFrom *Fpdf) Template {
sizeStr := "" sizeStr := ""
fpdf := fpdfNew(orientationStr, unitStr, sizeStr, fontDirStr, size) fpdf := fpdfNew(orientationStr, unitStr, sizeStr, fontDirStr, size, density)
tpl := Tpl{*fpdf} tpl := Tpl{*fpdf}
if copyFrom != nil { if copyFrom != nil {
tpl.loadParamsFromFpdf(copyFrom) tpl.loadParamsFromFpdf(copyFrom)