Skip to content

Commit

Permalink
Fix page dimension issue #24
Browse files Browse the repository at this point in the history
  • Loading branch information
PejmanNik committed Aug 15, 2023
1 parent 03c7fc9 commit e075fd5
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 21 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]


## [0.4.1]

### Fixed
- Fix page dimension issues

## [0.4.0]

### Changed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.4.0",
"version": "0.4.1",
"name": "jikji",
"workspaces": [
"packages/*",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jikji/react",
"version": "0.4.0",
"version": "0.4.1",
"main": "lib/index.cjs.js",
"module": "lib/index.esm.js",
"files": [
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/Page/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ function Page(

const pageStyle: CSSProperties = {
display: 'flex',
width: dimension.width,
height: dimension.height,
maxHeight: dimension.height,
width: `calc(${dimension.width} - 2px )`,
height: `calc(${dimension.height} - 2px )`,
maxHeight: `calc(${dimension.height} - 2px )`,
position: 'relative',
flexDirection: 'column',
padding: shorthand(margin),
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Section/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ function Section({
// #${sectionName} {
// page: ${sectionName}
// }
style.appendChild(document.createTextNode(`
style.appendChild(document.createTextNode(`
@page {
margin: 0px;
margin: none;
size:${sectionInfo.dimension.width} ${sectionInfo.dimension.height};
width:${sectionInfo.dimension.width};
height:${sectionInfo.dimension.height};
Expand Down
26 changes: 12 additions & 14 deletions packages/react/src/core/pageConst.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import { PageDimension, PageMargin } from './pageType';

// the height is not based on the size specification, it has been decreased
// by 0.2 due to the last version of the chromium issue in printing as PDF
const _pageSize = {
A1: { height: '840.8mm', width: '594mm' },
A2: { height: '593.8mm', width: '420mm' },
A3: { height: '419.8mm', width: '297mm' },
A4: { height: '296.8mm', width: '210mm' },
A5: { height: '209.8mm', width: '148mm' },
A6: { height: '147.8mm', width: '105mm' },
B3: { height: '499.8mm', width: '353mm' },
B4: { height: '352.8mm', width: '250mm' },
B5: { height: '249.8mm', width: '176mm' },
Letter: { height: '275.8mm', width: '216mm' },
Legal: { height: '364.8mm', width: '216mm' },
Tabloid: { height: '431.8mm', width: '279mm' },
A1: { height: '841mm', width: '594mm' },
A2: { height: '594mm', width: '420mm' },
A3: { height: '420mm', width: '297mm' },
A4: { height: '297mm', width: '210mm' },
A5: { height: '210mm', width: '148mm' },
A6: { height: '148mm', width: '105mm' },
B3: { height: '500mm', width: '353mm' },
B4: { height: '353mm', width: '250mm' },
B5: { height: '250mm', width: '176mm' },
Letter: { height: '8.5in', width: '11in' },
Legal: { height: '11in', width: '8.5in' },
Tabloid: { height: '11in', width: '17in' },
};

const _pageMargin = {
Expand Down

0 comments on commit e075fd5

Please sign in to comment.