Added card types
This commit is contained in:
@@ -6,111 +6,9 @@ export interface PageSettings {
|
||||
margin: number; // mm
|
||||
}
|
||||
|
||||
export interface CardDimensions {
|
||||
width: number; // mm
|
||||
height: number; // mm
|
||||
}
|
||||
|
||||
// A4 Page dimensions in millimeters
|
||||
export const PAGE_SETTINGS: PageSettings = {
|
||||
pageWidth: 210,
|
||||
pageHeight: 297,
|
||||
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: 45,
|
||||
height: 30
|
||||
};
|
||||
|
||||
// Dimensions for a single card in the photo PDF.
|
||||
export const PHOTO_CARD_DIMENSIONS: CardDimensions = {
|
||||
width: 29,
|
||||
height: 41
|
||||
};
|
||||
|
||||
// Photo dimensions within the photo card
|
||||
export const PHOTO_DIMENSIONS = {
|
||||
width: 26, // mm
|
||||
height: 36 // mm
|
||||
};
|
||||
|
||||
export interface TextPosition {
|
||||
x: number; // mm, relative to cell top-left
|
||||
y: number; // mm, relative to cell top-left
|
||||
size: number; // font size in points
|
||||
}
|
||||
|
||||
export interface PhotoPosition {
|
||||
x: number; // mm, relative to cell top-left
|
||||
y: number; // mm, relative to cell top-left
|
||||
width: number; // mm
|
||||
height: number; // mm
|
||||
}
|
||||
|
||||
export interface TextFieldLayout {
|
||||
name: TextPosition;
|
||||
nationality: TextPosition;
|
||||
birthday: TextPosition;
|
||||
studiesAt: TextPosition;
|
||||
esnSection: TextPosition;
|
||||
validityStart: TextPosition;
|
||||
}
|
||||
|
||||
export interface PhotoFieldLayout {
|
||||
photo: PhotoPosition;
|
||||
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,
|
||||
y: 4,
|
||||
size: FONT_SIZE
|
||||
},
|
||||
nationality: {
|
||||
x: 2,
|
||||
y: 12,
|
||||
size: FONT_SIZE
|
||||
},
|
||||
birthday: {
|
||||
x: 30,
|
||||
y: 12,
|
||||
size: FONT_SIZE
|
||||
},
|
||||
studiesAt: {
|
||||
x: 2,
|
||||
y: 20,
|
||||
size: FONT_SIZE
|
||||
},
|
||||
esnSection: {
|
||||
x: 2,
|
||||
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,
|
||||
y: 2,
|
||||
width: PHOTO_DIMENSIONS.width,
|
||||
height: PHOTO_DIMENSIONS.height
|
||||
},
|
||||
name: {
|
||||
x: 2,
|
||||
y: PHOTO_DIMENSIONS.height + 4,
|
||||
size: 6
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user