Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .ai/constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Central package management is on (`ManagePackageVersionsCentrally=true`). An inl
→ Add `<PackageVersion>` to `Directory.Packages.props`, reference without a version.

### Never add a package for a capability the repository already has
`Grand.Mediator`, FluentValidation, `Grand.Mapping`, `MongoDB.Driver`, `StackExchange.Redis`, DotLiquid, Scryber, ImageSharp, MailKit, Scrutor are already present. Adding a second library for the same job splits the codebase.
`Grand.Mediator`, FluentValidation, `Grand.Mapping`, `MongoDB.Driver`, `StackExchange.Redis`, DotLiquid, PdfPig, SkiaSharp, MailKit, Scrutor are already present. Adding a second library for the same job splits the codebase.
→ See the table in `.ai/standards/dependencies.md`.

### Never use Newtonsoft.Json
Expand Down
1 change: 0 additions & 1 deletion .ai/knowledge/repository-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ Important folders:
- `Controllers`
- `Views`
- `Views/Shared`
- `Views/PdfTemplates`
- `Components`
- `Commands`
- `Features`
Expand Down
17 changes: 9 additions & 8 deletions .ai/knowledge/template-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,15 @@ Follow existing patterns:
- Preserve Vue props, component names, and model shape.
- Keep generated bundle requirements in sync with `src/Web/Grand.Web/vueapp`.

## PDF Templates
Use for PDF views under:
- `src/Web/Grand.Web/Views/PdfTemplates`

Follow existing PDF patterns:
- Keep markup simple and deterministic.
- Avoid interactive JavaScript.
- Use inline or existing PDF-compatible styling.
## PDF documents
Order invoices and packaging slips are not views. `PdfService` in
`src/Business/Grand.Business.Common/Services/Pdf` lays them out in code through `PdfComposer`
(text, tables, images, page breaks) on top of PdfPig.

- Change the layout in `PdfService`; add a layout primitive to `PdfComposer` only when two documents need it.
- HTML from the database (attribute descriptions, invoice header and footer) goes through `PdfHtmlText`, which drops markup.
- Text is drawn with the embedded Noto Sans fonts; characters outside them print as `?`.
- Plugins add lines below the payment method by handling `OrderPdfPaymentLinesEvent`; views and widget zones do not reach a PDF.
- Preserve order, shipment, address, tax, and currency formatting.

## DotLiquid Message Templates
Expand Down
4 changes: 2 additions & 2 deletions .ai/standards/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ Do not add a new third-party package when the repository already has a capabilit
| MongoDB | `MongoDB.Driver` |
| Caching / distributed cache | `Microsoft.Extensions.Caching.Memory`, `StackExchange.Redis` |
| Templating for messages | `DotLiquid` |
| PDF | `Scryber.Core` |
| Images | `SixLabors.ImageSharp`, `SkiaSharp` |
| PDF | `PdfPig` for writing PDF objects; layout in `Grand.Business.Common/Services/Pdf/PdfComposer` |
| Images | `SkiaSharp` |
| Mail | `MailKit` |
| DI scanning | `Scrutor` |
| API docs | `Microsoft.AspNetCore.OpenApi`, `Scalar.AspNetCore` |
Expand Down
8 changes: 3 additions & 5 deletions .trivyignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
# on that date, so it has to be reviewed rather than forgotten.

# SixLabors.ImageSharp 3.1.12 (fixed in 4.1.2), a transitive dependency of
# Scryber.Core, which pins 3.1.12 up to its latest release (9.7.5).
# GrandNode does not reference ImageSharp; Scryber.Imaging only detects and
# decodes images (TiffFormat, TiffMetadata, DecoderOptions). The affected code
# is never called: the TIFF CCITT T4/T6 encoders and HistogramEqualization.
# Drop these entries once Scryber.Core moves to ImageSharp 4.1.2 or later.
# elFinder.Net.Core 1.5.0, lifted from 2.0.0 by Grand.Web.AdminShared.
# GrandNode does not reference ImageSharp in code. 4.x is not verified with
# elFinder. Drop these entries once ImageSharp moves to 4.1.2 or elFinder goes.
CVE-2026-106110 exp:2027-01-16
CVE-2026-106113 exp:2027-01-16
CVE-2026-106115 exp:2027-01-16
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
<PackageVersion Include="Microsoft.FeatureManagement.AspNetCore" Version="4.8.0" />
<PackageVersion Include="Microsoft.OpenApi" Version="2.12.2" />
<PackageVersion Include="Scalar.AspNetCore" Version="2.17.13" />
<PackageVersion Include="Scryber.Core" Version="9.7.4.4" />
<PackageVersion Include="Scryber.Core.OpenType" Version="9.7.4" />
<PackageVersion Include="PdfPig" Version="0.1.16" />
<PackageVersion Include="MailKit" Version="4.18.1" />
<PackageVersion Include="AWSSDK.Core" Version="4.0.102.8" />
<PackageVersion Include="AWSSDK.S3" Version="4.0.104.1" />
Expand Down Expand Up @@ -51,6 +50,7 @@
<PackageVersion Include="elFinder.Net.AspNetCore" Version="1.5.0" />
<PackageVersion Include="elFinder.Net.Core" Version="1.5.0" />
<PackageVersion Include="elFinder.Net.Drivers.FileSystem" Version="1.5.0" />
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.12" />
<PackageVersion Include="Azure.Extensions.AspNetCore.DataProtection.Blobs" Version="1.5.4" />
<PackageVersion Include="Azure.Extensions.AspNetCore.DataProtection.Keys" Version="1.6.4" />
<PackageVersion Include="Azure.Identity" Version="1.21.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
<ItemGroup>
<PackageReference Include="ExcelMapper" />
<PackageReference Include="Microsoft.Build.Tasks.Git" PrivateAssets="All" />
<PackageReference Include="Scryber.Core" />
<PackageReference Include="Scryber.Core.OpenType" />
<PackageReference Include="System.Security.Cryptography.Xml" />
<PackageReference Include="PdfPig" />
<PackageReference Include="System.Security.Cryptography.Xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Services\Pdf\Fonts\*.ttf" LogicalName="Grand.Business.Common.Pdf.Fonts.%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\Grand.Domain\Grand.Domain.csproj" />
Expand Down
Binary file not shown.
Binary file not shown.
93 changes: 93 additions & 0 deletions src/Business/Grand.Business.Common/Services/Pdf/Fonts/OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright 2022 The Noto Project Authors (https://github.com/notofonts/latin-greek-cyrillic)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
132 changes: 0 additions & 132 deletions src/Business/Grand.Business.Common/Services/Pdf/HtmlToPdfService.cs

This file was deleted.

Loading
Loading