Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -54,8 +53,6 @@ var hMainWbase = []float64{
|
||||
const (
|
||||
hFontFamilyReg = "dejavu"
|
||||
hFontFamilyBold = "dejavu-b"
|
||||
hFontPathReg = "fonts/DejaVuSans.ttf"
|
||||
hFontPathBold = "fonts/DejaVuSans-Bold.ttf"
|
||||
)
|
||||
|
||||
// Renkler
|
||||
@@ -66,13 +63,8 @@ var (
|
||||
|
||||
/* ============================ FONT / FORMAT ============================ */
|
||||
|
||||
func hEnsureFonts(pdf *gofpdf.Fpdf) {
|
||||
if _, err := os.Stat(hFontPathReg); err == nil {
|
||||
pdf.AddUTF8Font(hFontFamilyReg, "", hFontPathReg)
|
||||
}
|
||||
if _, err := os.Stat(hFontPathBold); err == nil {
|
||||
pdf.AddUTF8Font(hFontFamilyBold, "", hFontPathBold)
|
||||
}
|
||||
func hEnsureFonts(pdf *gofpdf.Fpdf) error {
|
||||
return registerDejavuFonts(pdf, hFontFamilyReg, hFontFamilyBold)
|
||||
}
|
||||
|
||||
func hNormalizeWidths(base []float64, targetTotal float64) []float64 {
|
||||
@@ -332,7 +324,10 @@ func ExportStatementHeaderReportPDFHandler(mssql *sql.DB) http.HandlerFunc {
|
||||
pdf := gofpdf.New("L", "mm", "A4", "")
|
||||
pdf.SetMargins(hMarginL, hMarginT, hMarginR)
|
||||
pdf.SetAutoPageBreak(false, hMarginB)
|
||||
hEnsureFonts(pdf)
|
||||
if err := hEnsureFonts(pdf); err != nil {
|
||||
http.Error(w, "PDF font yükleme hatası: "+err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
wAvail := hPageWidth - hMarginL - hMarginR
|
||||
mainWn := hNormalizeWidths(hMainWbase, wAvail)
|
||||
|
||||
Reference in New Issue
Block a user