This commit is contained in:
Michał Chudy
2025-10-31 16:13:30 +01:00
parent d1d9b956c5
commit df0ef23857
13 changed files with 53729 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
node_modules/
.idea
dist/

11
.prettierrc.json Normal file
View File

@@ -0,0 +1,11 @@
{
"trailingComma": "es5",
"singleQuote": true,
"attributeSort": "ASC",
"singleAttributePerLine": true,
"tabWidth": 2,
"useTabs": false,
"bracketSpacing": true,
"semi": true,
"printWidth": 110
}

60
eslint.config.mts Normal file
View File

@@ -0,0 +1,60 @@
// @ts-check
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import stylistics from '@stylistic/eslint-plugin';
module.exports = tseslint.config({
ignores: [
'package.json',
'node_modules',
'package-lock.json',
'dist',
'angular.json',
'tsconfig.json',
'tsconfig.app.json',
'tsconfig.spec.json',
'src/types**/*.ts',
],
files: ['**/*.ts'],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
eslintPluginPrettierRecommended,
],
plugins: {
'@stylistic': stylistics,
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'prettier/prettier': [
'error',
{
endOfLine: 'auto',
},
],
'@typescript-eslint/explicit-member-accessibility': [
'warn',
{
accessibility: 'explicit',
overrides: {
constructors: 'no-public',
accessors: 'off',
},
},
],
'@typescript-eslint/member-ordering': ['warn'],
'@typescript-eslint/explicit-function-return-type': ['error'],
curly: ['error', 'all'],
'@stylistic/padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
{
blankLine: 'any',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var'],
},
],
},
});

257
examples/invoice.xml Normal file
View File

@@ -0,0 +1,257 @@
<?xml version="1.0" encoding="utf-8"?>
<Faktura
xmlns="http://crd.gov.pl/wzor/2025/06/25/13775/">
<Naglowek>
<KodFormularza kodSystemowy="FA (3)" wersjaSchemy="1-0E">FA</KodFormularza>
<WariantFormularza>3</WariantFormularza>
<DataWytworzeniaFa>2026-03-22T03:27:54.0792168Z</DataWytworzeniaFa>
<SystemInfo>Generator danych</SystemInfo>
</Naglowek>
<Podmiot1>
<DaneIdentyfikacyjne>
<NIP>5265877635</NIP>
<Nazwa>Bartkowiak, Dróżdż and Górecki</Nazwa>
</DaneIdentyfikacyjne>
<Adres>
<KodKraju>PL</KodKraju>
<AdresL1>ul. Kępa 332</AdresL1>
<AdresL2>20-892 Tyszowce</AdresL2>
</Adres>
<DaneKontaktowe>
<Email>Prokop77@example.com</Email>
<Telefon>17-756-90-14</Telefon>
</DaneKontaktowe>
</Podmiot1>
<Podmiot2>
<DaneIdentyfikacyjne>
<NIP>6808208874</NIP>
<Nazwa>Strzelczyk LLC</Nazwa>
</DaneIdentyfikacyjne>
<Adres>
<KodKraju>PL</KodKraju>
<AdresL1>ul. Wójcik 7255</AdresL1>
<AdresL2>28-068 Pobiedziska</AdresL2>
</Adres>
<DaneKontaktowe>
<Email>Lidia.Olszewski77@yahoo.com</Email>
<Telefon>76-113-42-55</Telefon>
</DaneKontaktowe>
<NrKlienta>KL-7615</NrKlienta>
<JST>2</JST>
<GV>2</GV>
</Podmiot2>
<Fa>
<KodWaluty>PLN</KodWaluty>
<P_1>2025-10-31</P_1>
<P_1M>Czarnków</P_1M>
<P_2>FA/YUCFO-4342344706/03/2026</P_2>
<P_6>2025-10-03</P_6>
<P_13_1>27292.28</P_13_1>
<P_14_1>6277.22</P_14_1>
<P_15>33569.50</P_15>
<Adnotacje>
<P_16>2</P_16>
<P_17>2</P_17>
<P_18>2</P_18>
<P_18A>2</P_18A>
<Zwolnienie>
<P_19N>1</P_19N>
</Zwolnienie>
<NoweSrodkiTransportu>
<P_22N>1</P_22N>
</NoweSrodkiTransportu>
<P_23>2</P_23>
<PMarzy>
<P_PMarzyN>1</P_PMarzyN>
</PMarzy>
</Adnotacje>
<RodzajFaktury>VAT</RodzajFaktury>
<FaWiersz>
<NrWierszaFa>1</NrWierszaFa>
<P_7>Handcrafted Wooden Gloves Handcrafted Rubber Bike Incredible Granite Shirt Ergonomic Soft Soap Licensed
Metal Soap Sleek Wooden Chips Licensed Soft Soap Unbranded Steel Towels Ergonomic Concrete Keyboard
Awesome Metal Computer Refined Metal Chair Generic Wooden Shoes Fantastic Plastic Sausages Generic
Plastic Computer Gorgeous Plastic Gloves Fantastic Frozen Ball Fantastic Granite Sausages Rustic Soft
Shoes Gorgeous Plastic Cheese Small Granite Gloves Practical Concrete Fish Licensed Concrete Ba
</P_7>
<P_8A>szt.</P_8A>
<P_8B>1</P_8B>
<P_9A>20.41</P_9A>
<P_11>20.41</P_11>
<P_12>23</P_12>
</FaWiersz>
<FaWiersz>
<NrWierszaFa>2</NrWierszaFa>
<P_7>Handcrafted Wooden Gloves Handcrafted Rubber Bike Incredible Granite Shirt Ergonomic Soft Soap Licensed
Metal Soap Sleek Wooden Chips Licensed Soft Soap Unbranded Steel Towels Ergonomic Concrete Keyboard
Awesome Metal Computer Refined Metal Chair Generic Wooden Shoes Fantastic Plastic Sausages Generic
Plastic Computer Gorgeous Plastic Gloves Fantastic Frozen Ball Fantastic Granite Sausages Rustic Soft
Shoes Gorgeous Plastic Cheese Small Granite Gloves Practical Concrete Fish Licensed Concrete Ba
</P_7>
<P_8A>szt.</P_8A>
<P_8B>7</P_8B>
<P_9A>130.83</P_9A>
<P_11>915.81</P_11>
<P_12>23</P_12>
</FaWiersz>
<FaWiersz>
<NrWierszaFa>3</NrWierszaFa>
<P_7>Handcrafted Wooden Gloves Handcrafted Rubber Bike Incredible Granite Shirt Ergonomic Soft Soap Licensed
Metal Soap Sleek Wooden Chips Licensed Soft Soap Unbranded Steel Towels Ergonomic Concrete Keyboard
Awesome Metal Computer Refined Metal Chair Generic Wooden Shoes Fantastic Plastic Sausages Generic
Plastic Computer Gorgeous Plastic Gloves Fantastic Frozen Ball Fantastic Granite Sausages Rustic Soft
Shoes Gorgeous Plastic Cheese Small Granite Gloves Practical Concrete Fish Licensed Concrete Ba
</P_7>
<P_8A>szt.</P_8A>
<P_8B>1</P_8B>
<P_9A>637.15</P_9A>
<P_11>637.15</P_11>
<P_12>23</P_12>
</FaWiersz>
<FaWiersz>
<NrWierszaFa>4</NrWierszaFa>
<P_7>Handcrafted Wooden Gloves Handcrafted Rubber Bike Incredible Granite Shirt Ergonomic Soft Soap Licensed
Metal Soap Sleek Wooden Chips Licensed Soft Soap Unbranded Steel Towels Ergonomic Concrete Keyboard
Awesome Metal Computer Refined Metal Chair Generic Wooden Shoes Fantastic Plastic Sausages Generic
Plastic Computer Gorgeous Plastic Gloves Fantastic Frozen Ball Fantastic Granite Sausages Rustic Soft
Shoes Gorgeous Plastic Cheese Small Granite Gloves Practical Concrete Fish Licensed Concrete Ba
</P_7>
<P_8A>szt.</P_8A>
<P_8B>7</P_8B>
<P_9A>944.48</P_9A>
<P_11>6611.36</P_11>
<P_12>23</P_12>
</FaWiersz>
<FaWiersz>
<NrWierszaFa>5</NrWierszaFa>
<P_7>Handcrafted Wooden Gloves Handcrafted Rubber Bike Incredible Granite Shirt Ergonomic Soft Soap Licensed
Metal Soap Sleek Wooden Chips Licensed Soft Soap Unbranded Steel Towels Ergonomic Concrete Keyboard
Awesome Metal Computer Refined Metal Chair Generic Wooden Shoes Fantastic Plastic Sausages Generic
Plastic Computer Gorgeous Plastic Gloves Fantastic Frozen Ball Fantastic Granite Sausages Rustic Soft
Shoes Gorgeous Plastic Cheese Small Granite Gloves Practical Concrete Fish Licensed Concrete Ba
</P_7>
<P_8A>szt.</P_8A>
<P_8B>2</P_8B>
<P_9A>660.60</P_9A>
<P_11>1321.20</P_11>
<P_12>23</P_12>
</FaWiersz>
<FaWiersz>
<NrWierszaFa>6</NrWierszaFa>
<P_7>Handcrafted Wooden Gloves Handcrafted Rubber Bike Incredible Granite Shirt Ergonomic Soft Soap Licensed
Metal Soap Sleek Wooden Chips Licensed Soft Soap Unbranded Steel Towels Ergonomic Concrete Keyboard
Awesome Metal Computer Refined Metal Chair Generic Wooden Shoes Fantastic Plastic Sausages Generic
Plastic Computer Gorgeous Plastic Gloves Fantastic Frozen Ball Fantastic Granite Sausages Rustic Soft
Shoes Gorgeous Plastic Cheese Small Granite Gloves Practical Concrete Fish Licensed Concrete Ba
</P_7>
<P_8A>szt.</P_8A>
<P_8B>4</P_8B>
<P_9A>558.93</P_9A>
<P_11>2235.72</P_11>
<P_12>23</P_12>
</FaWiersz>
<FaWiersz>
<NrWierszaFa>7</NrWierszaFa>
<P_7>Handcrafted Wooden Gloves Handcrafted Rubber Bike Incredible Granite Shirt Ergonomic Soft Soap Licensed
Metal Soap Sleek Wooden Chips Licensed Soft Soap Unbranded Steel Towels Ergonomic Concrete Keyboard
Awesome Metal Computer Refined Metal Chair Generic Wooden Shoes Fantastic Plastic Sausages Generic
Plastic Computer Gorgeous Plastic Gloves Fantastic Frozen Ball Fantastic Granite Sausages Rustic Soft
Shoes Gorgeous Plastic Cheese Small Granite Gloves Practical Concrete Fish Licensed Concrete Ba
</P_7>
<P_8A>szt.</P_8A>
<P_8B>1</P_8B>
<P_9A>670.77</P_9A>
<P_11>670.77</P_11>
<P_12>23</P_12>
</FaWiersz>
<FaWiersz>
<NrWierszaFa>8</NrWierszaFa>
<P_7>Handcrafted Wooden Gloves Handcrafted Rubber Bike Incredible Granite Shirt Ergonomic Soft Soap Licensed
Metal Soap Sleek Wooden Chips Licensed Soft Soap Unbranded Steel Towels Ergonomic Concrete Keyboard
Awesome Metal Computer Refined Metal Chair Generic Wooden Shoes Fantastic Plastic Sausages Generic
Plastic Computer Gorgeous Plastic Gloves Fantastic Frozen Ball Fantastic Granite Sausages Rustic Soft
Shoes Gorgeous Plastic Cheese Small Granite Gloves Practical Concrete Fish Licensed Concrete Ba
</P_7>
<P_8A>szt.</P_8A>
<P_8B>1</P_8B>
<P_9A>698.02</P_9A>
<P_11>698.02</P_11>
<P_12>23</P_12>
</FaWiersz>
<FaWiersz>
<NrWierszaFa>9</NrWierszaFa>
<P_7>Handcrafted Wooden Gloves Handcrafted Rubber Bike Incredible Granite Shirt Ergonomic Soft Soap Licensed
Metal Soap Sleek Wooden Chips Licensed Soft Soap Unbranded Steel Towels Ergonomic Concrete Keyboard
Awesome Metal Computer Refined Metal Chair Generic Wooden Shoes Fantastic Plastic Sausages Generic
Plastic Computer Gorgeous Plastic Gloves Fantastic Frozen Ball Fantastic Granite Sausages Rustic Soft
Shoes Gorgeous Plastic Cheese Small Granite Gloves Practical Concrete Fish Licensed Concrete Ba
</P_7>
<P_8A>szt.</P_8A>
<P_8B>6</P_8B>
<P_9A>298.84</P_9A>
<P_11>1793.04</P_11>
<P_12>23</P_12>
</FaWiersz>
<FaWiersz>
<NrWierszaFa>10</NrWierszaFa>
<P_7>Handcrafted Wooden Gloves Handcrafted Rubber Bike Incredible Granite Shirt Ergonomic Soft Soap Licensed
Metal Soap Sleek Wooden Chips Licensed Soft Soap Unbranded Steel Towels Ergonomic Concrete Keyboard
Awesome Metal Computer Refined Metal Chair Generic Wooden Shoes Fantastic Plastic Sausages Generic
Plastic Computer Gorgeous Plastic Gloves Fantastic Frozen Ball Fantastic Granite Sausages Rustic Soft
Shoes Gorgeous Plastic Cheese Small Granite Gloves Practical Concrete Fish Licensed Concrete Ba
</P_7>
<P_8A>szt.</P_8A>
<P_8B>6</P_8B>
<P_9A>336.65</P_9A>
<P_11>2019.90</P_11>
<P_12>23</P_12>
</FaWiersz>
<FaWiersz>
<NrWierszaFa>11</NrWierszaFa>
<P_7>Handcrafted Wooden Gloves Handcrafted Rubber Bike Incredible Granite Shirt Ergonomic Soft Soap Licensed
Metal Soap Sleek Wooden Chips Licensed Soft Soap Unbranded Steel Towels Ergonomic Concrete Keyboard
Awesome Metal Computer Refined Metal Chair Generic Wooden Shoes Fantastic Plastic Sausages Generic
Plastic Computer Gorgeous Plastic Gloves Fantastic Frozen Ball Fantastic Granite Sausages Rustic Soft
Shoes Gorgeous Plastic Cheese Small Granite Gloves Practical Concrete Fish Licensed Concrete Ba
</P_7>
<P_8A>szt.</P_8A>
<P_8B>8</P_8B>
<P_9A>408.55</P_9A>
<P_11>3268.40</P_11>
<P_12>23</P_12>
</FaWiersz>
<FaWiersz>
<NrWierszaFa>12</NrWierszaFa>
<P_7>Handcrafted Wooden Gloves Handcrafted Rubber Bike Incredible Granite Shirt Ergonomic Soft Soap Licensed
Metal Soap Sleek Wooden Chips Licensed Soft Soap Unbranded Steel Towels Ergonomic Concrete Keyboard
Awesome Metal Computer Refined Metal Chair Generic Wooden Shoes Fantastic Plastic Sausages Generic
Plastic Computer Gorgeous Plastic Gloves Fantastic Frozen Ball Fantastic Granite Sausages Rustic Soft
Shoes Gorgeous Plastic Cheese Small Granite Gloves Practical Concrete Fish Licensed Concrete Ba
</P_7>
<P_8A>szt.</P_8A>
<P_8B>6</P_8B>
<P_9A>13.51</P_9A>
<P_11>81.06</P_11>
<P_12>23</P_12>
</FaWiersz>
<FaWiersz>
<NrWierszaFa>13</NrWierszaFa>
<P_7>Handcrafted Wooden Gloves Handcrafted Rubber Bike Incredible Granite Shirt Ergonomic Soft Soap Licensed
Metal Soap Sleek Wooden Chips Licensed Soft Soap Unbranded Steel Towels Ergonomic Concrete Keyboard
Awesome Metal Computer Refined Metal Chair Generic Wooden Shoes Fantastic Plastic Sausages Generic
Plastic Computer Gorgeous Plastic Gloves Fantastic Frozen Ball Fantastic Granite Sausages Rustic Soft
Shoes Gorgeous Plastic Cheese Small Granite Gloves Practical Concrete Fish Licensed Concrete Ba
</P_7>
<P_8A>szt.</P_8A>
<P_8B>8</P_8B>
<P_9A>877.43</P_9A>
<P_11>7019.44</P_11>
<P_12>23</P_12>
</FaWiersz>
<Platnosc>
<Zaplacono>1</Zaplacono>
<DataZaplaty>2025-10-31</DataZaplaty>
<FormaPlatnosci>7</FormaPlatnosci>
</Platnosc>
</Fa>
</Faktura>

22
examples/upo.xml Normal file
View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Potwierdzenie xmlns="http://upo.schematy.mf.gov.pl/KSeF/v4-2">
<NazwaPodmiotuPrzyjmujacego>Ministerstwo Finansów</NazwaPodmiotuPrzyjmujacego>
<NumerReferencyjnySesji>36950822-93-9D5A28BFDA-47C899773E-5C</NumerReferencyjnySesji>
<Uwierzytelnienie>
<IdKontekstu>
<IdZlozonyVatUE>5265877635-ATU12345678</IdZlozonyVatUE>
</IdKontekstu>
<SkrotDokumentuUwierzytelniajacego>kyqH+QUgP8ATWd/95IY632mP4uqibwG66Oqclq9+qno=</SkrotDokumentuUwierzytelniajacego>
</Uwierzytelnienie>
<NazwaStrukturyLogicznej>1-0E</NazwaStrukturyLogicznej>
<KodFormularza>FA (3)</KodFormularza>
<Dokument>
<NipSprzedawcy>5265877635</NipSprzedawcy>
<NumerKSeFDokumentu>5265877635-20250916-0200A0D6723E-C2</NumerKSeFDokumentu>
<NumerFaktury>FA/XVQUD-9997622510/04/2027</NumerFaktury>
<DataWystawieniaFaktury>2025-09-16</DataWystawieniaFaktury>
<DataPrzeslaniaDokumentu>2025-09-16T11:05:40.841+02:00</DataPrzeslaniaDokumentu>
<DataNadaniaNumeruKSeF>2025-09-16T11:05:41.045+02:00</DataNadaniaNumeruKSeF>
<SkrotDokumentu>GZMGNVzs3krF6URKgvaw77OOeG3nJ+WGziT5xguliQ8=</SkrotDokumentu>
</Dokument>
</Potwierdzenie>

6491
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

40
package.json Normal file
View File

@@ -0,0 +1,40 @@
{
"name": "ksef-pdf-generator",
"version": "0.0.26",
"scripts": {
"start": "vite ./src/app"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "^4.50.1"
},
"devDependencies": {
"@eslint/js": "^9.33.0",
"@stylistic/eslint-plugin": "^5.2.3",
"@types/pdfmake": "^0.2.11",
"@typescript-eslint/eslint-plugin": "^8.40.0",
"@typescript-eslint/parser": "^8.40.0",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/ui": "^3.2.4",
"eslint": "^9.33.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-no-relative-import-paths": "^1.6.1",
"eslint-plugin-prettier": "^5.5.4",
"globals": "^16.3.0",
"jiti": "^2.5.1",
"jsdom": "^26.1.0",
"prettier": "^3.6.2",
"typescript": "^5.8.3",
"typescript-eslint": "^8.40.0",
"vite": "^7.0.6",
"vite-plugin-dts": "^4.5.4",
"vitest": "^3.2.4"
},
"dependencies": {
"pdfmake": "^0.2.20",
"xml-js": "^1.6.11"
}
}

66
readme.md Normal file
View File

@@ -0,0 +1,66 @@
# Biblioteka do generowania wizualizacji PDF faktur i UPO
Biblioteka do generowania wizualizacji PDF faktur oraz UPO na podstawie plików XML po stronie klienta.
---
### Informacje wstępne
Niniejsza wersja Biblioteki stanowi wydanie wstępne, zawierające zbudowaną paczkę JavaScript oraz aplikacje służące do
testowania rozwiązania.
Wersja pełna, obejmująca kompletny kod źródłowy w TypeScript, możliwość budowania biblioteki oraz generowania typów TS,
zostanie udostępniona w dniu 14 listopada 2025 r.
## 1. Jak uruchomić aplikację
1. Zainstaluj Node.js w wersji **22.14.0**
Możesz pobrać Node.js z oficjalnej strony: [https://nodejs.org](https://nodejs.org)
2. Sklonuj repozytorium i przejdź do folderu projektu:
```bash
git clone https://github.com/CIRFMF/ksef-pdf-generator#
cd ksef-pdf-generator
```
3. Zainstaluj zależności:
```bash
npm install
```
4. Uruchom aplikację:
```bash
npm run start
```
Aplikacja uruchomi się domyślnie pod adresem: [http://localhost:5173/](http://localhost:5173/)
---
## 2. Jak wygenerować fakturę
1. Po uruchomieniu aplikacji przejdź do **Wygeneruj wizualizacje faktury PDF**.
2. Wybierz plik XML zgodny ze schemą **FA(1), FA(2) lub FA(3)**.
3. Przykładowy plik znajduje się w folderze:
```
examples/invoice.xml
```
4. Po wybraniu pliku, PDF zostanie wygenerowany.
---
## 3. Jak wygenerować UPO
1. Po uruchomieniu aplikacji przejdź do **Wygeneruj wizualizacje UPO PDF**.
2. Wybierz plik XML zgodny ze schemą **UPO v4_2**.
3. Przykładowy plik znajduje się w folderze:
```
examples/upo.xml
```
4. Po wybraniu pliku, PDF zostanie wygenerowany.
---
## Uwagi
- Upewnij się, że pliki XML są poprawnie sformatowane zgodnie z odpowiednią schemą.
- W przypadku problemów z Node.js, rozważ użycie menedżera wersji Node, np. [nvm](https://github.com/nvm-sh/nvm).

File diff suppressed because one or more lines are too long

19
src/app/index.html Normal file
View File

@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>KSEF PDF GENERATOR</title>
</head>
<body>
<h1 style="margin: auto;width: fit-content">📄 KSEF PDF GENERATOR</h1>
<h1> Wygeneruj wizualizacje faktury PDF </h1>
<input accept=".xml" id="xmlInput" type="file" />
<h1> Wygeneruj wizualizacje UPO PDF</h1>
<input accept=".xml" id="xmlInputUPO" type="file" />
<script src="./main.ts" type="module"></script>
</body>
</html>

54
src/app/main.ts Normal file
View File

@@ -0,0 +1,54 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import { generateInvoice, generatePDFUPO } from './build/ksef-pdf-generator.es.js';
const input = document.getElementById('xmlInput') as HTMLInputElement;
const inputUPO = document.getElementById('xmlInputUPO') as HTMLInputElement;
input.addEventListener('change', async () => {
const file = input.files?.[0];
if (!file) {
return;
}
const additionalData: any = {
nrKSeF: '5265877635-20250808-9231003CA67B-BE',
qrCode:
'https://ksef-te.mf.gov.pl/client-app/invoice/5265877635/26-10-2025/HS5E1zrA8WVjDNq_xMVIN5SD6nyRymmQ-BcYHReUAa0',
}; // Example data
generateInvoice(file, additionalData, 'blob').then((data: any) => {
const url = URL.createObjectURL(data);
const a = document.createElement('a');
a.href = url;
a.download = 'test.pdf'; // nazwa pobieranego pliku
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
});
});
inputUPO.addEventListener('change', async () => {
const file = inputUPO.files?.[0];
if (!file) {
return;
}
generatePDFUPO(file).then((blob: any) => {
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'test.pdf'; // nazwa pobieranego pliku
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
});
});

10
tsconfig.json Normal file
View File

@@ -0,0 +1,10 @@
{
"compilerOptions": {
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"module": "commonjs", /* Specify what module code is generated. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"strict": true, /* Enable all strict type-checking options. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}

6
vite.config.ts Normal file
View File

@@ -0,0 +1,6 @@
/// <reference types="vitest" />
/// <reference types="vite/client" />
import { defineConfig } from 'vite';
export default defineConfig({});