Skip to content

Commit

Permalink
feat: use svg dimensions to define pdf page size (#7664)
Browse files Browse the repository at this point in the history
* feat: use svg dimensions to define pdf page size

* docs: update CHANGELOG
  • Loading branch information
Zangetsu101 authored Oct 1, 2024
1 parent 4772c05 commit 9e6ee79
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

- Internally we were storing the `family` name field as a required property which was limiting what how you could capture the name of a person in the forms. Now we are storing it as an optional property which would make more flexible.
- Remove the leftover features from the application config pages, such as certificates and informant notification. [#7156](https://github.com/opencrvs/opencrvs-core/issues/7156)
- **PDF page size** The generated PDF used to be defaulted to A4 size. Now it respects the SVG dimensions if specified

## Bug fixes

Expand Down
4 changes: 4 additions & 0 deletions packages/client/src/views/PrintCertificate/PDFUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ export function svgToPdfTemplate(svg: string, offlineResource: IOfflineData) {
if (widthValue && heightValue) {
const width = Number.parseInt(widthValue)
const height = Number.parseInt(heightValue)
pdfTemplate.definition.pageSize = {
width,
height
}
if (width > height) {
pdfTemplate.definition.pageOrientation = 'landscape'
}
Expand Down

0 comments on commit 9e6ee79

Please sign in to comment.