Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: embed json certificate into pdf #241

Merged
merged 39 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7730393
add pdf-lib dependency for attachments
christophbuehler Feb 15, 2024
57c21d6
remove empty overrides
christophbuehler Feb 15, 2024
ee2224c
attaches a file to a pdf buffer
christophbuehler Feb 15, 2024
caeb5ac
extend generatePdf with functionality to attach the certificate to pdf
christophbuehler Feb 15, 2024
492d52d
update demo code to attach the certificate json
christophbuehler Feb 15, 2024
f522a92
add tests
christophbuehler Feb 15, 2024
5ef4dda
pin pdf-lib
christophbuehler Feb 15, 2024
9f12fc3
add pdf-lib to packages
christophbuehler Feb 15, 2024
c14930b
Remove lato-font dependency and update pdf-lib version
christophbuehler Feb 23, 2024
945db75
Add NotoSans-Bold.ttf, NotoSans-Italic.ttf, NotoSans-Light.ttf, NotoS…
christophbuehler Feb 23, 2024
2d3365b
Add sRGB2014.icc color profile
christophbuehler Feb 23, 2024
55a9d08
Update font references in PDF template utils
christophbuehler Feb 23, 2024
de8eee7
Remove unused dependencies and update font paths
christophbuehler Feb 23, 2024
b6e3f06
Update dependencies in generate-pdf package.json
christophbuehler Feb 23, 2024
12be178
Update font paths and remove unnecessary code
christophbuehler Feb 23, 2024
c042ba7
Remove unnecessary reference to tsconfig.spec.json
christophbuehler Feb 23, 2024
67ec976
Add readable-schema.json and update PDF certificate fixtures
christophbuehler Feb 23, 2024
a55ba11
Add attachCertificateToPdf and attachFileToPdf functions
christophbuehler Feb 23, 2024
c4c197f
Add PDF/A-3a support and validation documentation
christophbuehler Feb 23, 2024
fa5876b
Add buildModule function to generate-pdf package
christophbuehler Feb 23, 2024
b6da377
Refactor code to import PDF related interfaces from pdfmake package
christophbuehler Feb 23, 2024
c23f6bb
Refactor createPdf function to use fs/promises and update font paths
christophbuehler Feb 23, 2024
1e5ff76
Fix bug in login functionality
christophbuehler Feb 23, 2024
c8706bd
Update footer text and link in generate-pdf-template-helpers
christophbuehler Feb 23, 2024
005f3ff
Add PDF/A-3a compliance features
christophbuehler Feb 23, 2024
6e618be
Update ignorePatterns in .eslintrc.json
christophbuehler Feb 23, 2024
39fd4ac
Update semver dependency to version 6.3.1
christophbuehler Feb 23, 2024
01a4924
Update font-family in HTML templates
christophbuehler Feb 23, 2024
4f2d126
Refactor externalStandards in generateHtml function
christophbuehler Feb 23, 2024
4ca7a5a
Add lato again because we would need to update the material identity …
christophbuehler Feb 23, 2024
435df51
Delete test PDF files
christophbuehler Feb 26, 2024
b4b3778
Add references to tsconfig.json
christophbuehler Feb 26, 2024
aaae1c4
add font and color profile to assets
christophbuehler Feb 26, 2024
6fa49f5
move color profile and fonts to assets of generate-pdf
christophbuehler Feb 26, 2024
619aa9b
Add writeFileAndTest function and use it in generate-pdf.spec.ts
christophbuehler Feb 28, 2024
6a9c0ba
Update font paths in create-pdf-certificate.ts
christophbuehler Mar 1, 2024
12614b7
Update pdf2pic version to 3.1.1
christophbuehler Mar 1, 2024
1c20710
Create pdfBufferToHash and add comment to install ImageMagick and Gho…
christophbuehler Mar 1, 2024
a3592b7
Update fixtures
christophbuehler Mar 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ npm run fixtures:interfaces -- -s ../CoA-schemas/schema.json -o packages/generat
To generate `template_hbs.html` (HTML certificate generated from Handlebars template), from the root directory, run the following command, updating the version number and schema name :

```sh
npm run fixtures:html -- -c fixtures/CoA/v1.0.0/valid_cert.json -o fixtures/CoA/v1.0.0/template_hbs.html -t fixtures/CoA/v1.0.0/translations.json -T ../CoA-schemas/template.hbs -e fixtures/CoA/v1.0.0/extra_translations.json -p ../CoA-schemas/partials-map.json
npm run fixtures:html -- -c fixtures/CoA/v1.0.0/valid_cert.json -o fixtures/CoA/v1.0.0/valid_cert.html -t fixtures/CoA/v1.0.0/translations.json -T ../CoA-schemas/template.hbs -e fixtures/CoA/v1.0.0/extra_translations.json -p ../CoA-schemas/partials-map.json
```

For EN10168

```sh
npm run fixtures:html -- -c fixtures/EN10168/v0.4.1/valid_cert.json -o fixtures/EN10168/v0.4.1/template_hbs.html -t fixtures/EN10168/v0.4.1/translations.json -T ../EN10168-schemas/template.hbs -p ../EN10168-schemas/partials-map.json
npm run fixtures:html -- -c fixtures/EN10168/v0.4.1/valid_cert.json -o fixtures/EN10168/v0.4.1/valid_cert.html -t fixtures/EN10168/v0.4.1/translations.json -T ../EN10168-schemas/template.hbs -p ../EN10168-schemas/partials-map.json
```

If external translations are not needed, remove the `-e` command from the above command.
Expand Down
6 changes: 3 additions & 3 deletions fixtures/CoA/v1.0.0/valid_cert.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ <h3>Green Plastics AG</h3>
<th class='table-cells' colspan='4'>
Kunde / Customer
</th>
<th class='table-cells' colspan='6'>
Warenempfänger / Recipient
</th>
<th class='table-cells' colspan='6'>
Warenempfänger / Recipient
</th>
</tr>
<tr class='table-rows'>
<td class='table-cells' colspan='4'>
Expand Down
2 changes: 1 addition & 1 deletion fixtures/EN10168/v0.0.2/valid_cert.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@import url(https://fonts.googleapis.com/css?family=Lato:300,400,700);

html {
font-family: 'Lato', sans-serif;
font-family: "Lato", sans-serif;
font-size: 14px;
text-align: justify;
max-width: 2480px;
Expand Down
2 changes: 1 addition & 1 deletion fixtures/EN10168/v0.4.1/valid_cert.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="version" content="v1.0.0" />
<style rel="stylesheet" type="text/css">
@import url(https://fonts.googleapis.com/css?family=Lato:300,400,700);

html {
font-family: "Lato", sans-serif;
font-size: 14px;
Expand Down
Binary file added fixtures/color-profiles/sRGB2014.icc
Binary file not shown.
Binary file added fixtures/fonts/NotoSans-Bold.ttf
Binary file not shown.
Binary file added fixtures/fonts/NotoSans-Italic.ttf
Binary file not shown.
Binary file added fixtures/fonts/NotoSans-Light.ttf
Binary file not shown.
Binary file added fixtures/fonts/NotoSans-Regular.ttf
Binary file not shown.
Binary file added fixtures/fonts/NotoSansSC-Bold.ttf
Binary file not shown.
Binary file added fixtures/fonts/NotoSansSC-Light.ttf
Binary file not shown.
Binary file added fixtures/fonts/NotoSansSC-Regular.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Loading