fix(handlers): Return cards as pdf
This commit is contained in:
parent
5098d27ae9
commit
b179541532
@ -62,17 +62,16 @@ func GenerateCard(c *fiber.Ctx) error {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
c.Set(fiber.HeaderContentType, "text/html")
|
c.Set(fiber.HeaderContentType, "text/html")
|
||||||
return c.SendString(result)
|
converter := services.GotenbergConverter{BaseUrl: "http://localhost:3001"}
|
||||||
// converter := services.GotenbergConverter{BaseUrl: "http://localhost:3001"}
|
pdf, err := converter.ToPdf(result, "a4", false)
|
||||||
// pdf, err := converter.ToPdf(result, "a4", false)
|
if err != nil {
|
||||||
// if err != nil {
|
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||||
// return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
"error": err.Error(),
|
||||||
// "error": err.Error(),
|
})
|
||||||
// })
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// c.Set(fiber.HeaderContentType, "application/pdf")
|
c.Set(fiber.HeaderContentType, "application/pdf")
|
||||||
// return c.Send(pdf)
|
return c.Send(pdf)
|
||||||
}
|
}
|
||||||
|
|
||||||
func invertCardArrayItems(cards []models.Card) []models.Card {
|
func invertCardArrayItems(cards []models.Card) []models.Card {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user