Proper sizing in the layout
This commit is contained in:
@@ -15,25 +15,25 @@ export interface CardDimensions {
|
||||
export const PAGE_SETTINGS: PageSettings = {
|
||||
pageWidth: 210,
|
||||
pageHeight: 297,
|
||||
margin: 10
|
||||
margin: 15
|
||||
};
|
||||
|
||||
// Dimensions for a single card in the text PDF.
|
||||
// These dimensions will be used to calculate how many cards can fit on a page.
|
||||
export const TEXT_CARD_DIMENSIONS: CardDimensions = {
|
||||
width: 63,
|
||||
height: 40
|
||||
width: 45,
|
||||
height: 30
|
||||
};
|
||||
|
||||
// Dimensions for a single card in the photo PDF.
|
||||
export const PHOTO_CARD_DIMENSIONS: CardDimensions = {
|
||||
width: 25,
|
||||
height: 35
|
||||
width: 27,
|
||||
height: 39
|
||||
};
|
||||
|
||||
// Photo dimensions within the photo card
|
||||
export const PHOTO_DIMENSIONS = {
|
||||
width: 20, // mm
|
||||
width: 25, // mm
|
||||
height: 35 // mm
|
||||
};
|
||||
|
||||
@@ -54,6 +54,9 @@ export interface TextFieldLayout {
|
||||
name: TextPosition;
|
||||
nationality: TextPosition;
|
||||
birthday: TextPosition;
|
||||
studiesAt: TextPosition;
|
||||
esnSection: TextPosition;
|
||||
validityStart: TextPosition;
|
||||
}
|
||||
|
||||
export interface PhotoFieldLayout {
|
||||
@@ -61,36 +64,53 @@ export interface PhotoFieldLayout {
|
||||
name: TextPosition;
|
||||
}
|
||||
|
||||
const FONT_SIZE = 8; // pt
|
||||
|
||||
// Text PDF Field Positions (in mm, relative to cell top-left)
|
||||
export const TEXT_FIELD_LAYOUT: TextFieldLayout = {
|
||||
name: {
|
||||
x: 2,
|
||||
x: 3,
|
||||
y: 5,
|
||||
size: 10 // font size in points
|
||||
size: FONT_SIZE // font size in points
|
||||
},
|
||||
nationality: {
|
||||
x: 2,
|
||||
y: 10,
|
||||
size: 10
|
||||
x: 3,
|
||||
y: 12,
|
||||
size: FONT_SIZE
|
||||
},
|
||||
birthday: {
|
||||
x: 2,
|
||||
y: 15,
|
||||
size: 10
|
||||
x: 30,
|
||||
y: 12,
|
||||
size: FONT_SIZE
|
||||
},
|
||||
studiesAt: {
|
||||
x: 3,
|
||||
y: 20,
|
||||
size: FONT_SIZE
|
||||
},
|
||||
esnSection: {
|
||||
x: 3,
|
||||
y: 28,
|
||||
size: FONT_SIZE
|
||||
},
|
||||
validityStart: {
|
||||
x: 30,
|
||||
y: 28,
|
||||
size: FONT_SIZE
|
||||
}
|
||||
};
|
||||
|
||||
// Photo PDF Field Positions (in mm, relative to cell top-left)
|
||||
export const PHOTO_FIELD_LAYOUT: PhotoFieldLayout = {
|
||||
photo: {
|
||||
x: 2, // 2mm from left of cell
|
||||
y: 2, // 2mm from top of cell
|
||||
x: 2,
|
||||
y: 2,
|
||||
width: PHOTO_DIMENSIONS.width,
|
||||
height: PHOTO_DIMENSIONS.height
|
||||
},
|
||||
name: {
|
||||
x: 2, // 2mm from left of cell
|
||||
y: PHOTO_DIMENSIONS.height + 0, // Below the photo + 5mm gap
|
||||
size: 5 // font size in points
|
||||
x: 2,
|
||||
y: PHOTO_DIMENSIONS.height + 4,
|
||||
size: FONT_SIZE
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user