refactor(exports): renderizar logos SVG em alta resolução no PDF

Atualiza loadExportLogoDataUrl para carregar SVGs e rasterizar no canvas
a 4× a resolução natural antes de retornar o data URL — preserva nitidez
quando o PDF amplia a imagem. Default do path mudou para
/images/logo_text.svg.

Os exports de categorias e lançamentos agora apontam para os arquivos
.svg em vez dos .png removidos.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Felipe Coutinho
2026-04-27 00:11:21 +00:00
parent 29d99cbedb
commit 863ccc0fd2
3 changed files with 13 additions and 8 deletions

View File

@@ -65,8 +65,10 @@ export function getPrimaryPdfColor(): [number, number, number] {
return FALLBACK_PRIMARY_COLOR;
}
const EXPORT_LOGO_RENDER_SCALE = 4;
export async function loadExportLogoDataUrl(
logoPath = "/images/logo_text.png",
logoPath = "/images/logo_text.svg",
): Promise<string | null> {
if (typeof window === "undefined" || typeof document === "undefined") {
return null;
@@ -77,13 +79,16 @@ export async function loadExportLogoDataUrl(
image.crossOrigin = "anonymous";
image.onload = () => {
const width = image.naturalWidth || image.width;
const height = image.naturalHeight || image.height;
if (!width || !height) {
const naturalWidth = image.naturalWidth || image.width;
const naturalHeight = image.naturalHeight || image.height;
if (!naturalWidth || !naturalHeight) {
resolve(null);
return;
}
const width = Math.round(naturalWidth * EXPORT_LOGO_RENDER_SCALE);
const height = Math.round(naturalHeight * EXPORT_LOGO_RENDER_SCALE);
const canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;