Added some print margins
This commit is contained in:
parent
88a3f85635
commit
c643b0d8f8
136
frontend/src/components/ui/ResumeInfo.css
Normal file
136
frontend/src/components/ui/ResumeInfo.css
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
/* A4 Portrait simulation for MuiMarkdown */
|
||||||
|
.a4-document {
|
||||||
|
/* A4 dimensions: 210mm x 297mm */
|
||||||
|
width: 210mm;
|
||||||
|
min-height: 297mm;
|
||||||
|
|
||||||
|
/* Alternative pixel-based approach (96 DPI) */
|
||||||
|
/* width: 794px; */
|
||||||
|
/* height: 1123px; */
|
||||||
|
|
||||||
|
/* Document styling */
|
||||||
|
background: white;
|
||||||
|
padding: 8mm; /* 1/4" margins all around */
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
|
||||||
|
/* Typography for document feel */
|
||||||
|
font-family: 'Times New Roman', serif;
|
||||||
|
font-size: 12pt;
|
||||||
|
line-height: 1.6;
|
||||||
|
color: #333;
|
||||||
|
|
||||||
|
/* Page break lines - repeating dotted lines every A4 height */
|
||||||
|
background-image:
|
||||||
|
repeating-linear-gradient(
|
||||||
|
transparent,
|
||||||
|
transparent calc(8mm - 1px),
|
||||||
|
#00f calc(8mm),
|
||||||
|
transparent calc(8mm + 1px),
|
||||||
|
transparent calc(288mm - 1px), /* 297mm - 8mm top/bottom margins */
|
||||||
|
#00f calc(288mm),
|
||||||
|
transparent calc(288mm + 1px),
|
||||||
|
transparent calc(296mm - 1px),
|
||||||
|
#000 calc(296mm),
|
||||||
|
transparent calc(296mm + 1px)
|
||||||
|
);
|
||||||
|
background-size: 100% 297mm;
|
||||||
|
background-repeat: repeat-y;
|
||||||
|
|
||||||
|
/* Ensure proper page breaks for printing */
|
||||||
|
page-break-after: always;
|
||||||
|
|
||||||
|
/* Prevent content overflow */
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Container to center the document */
|
||||||
|
.document-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
min-height: 100vh;
|
||||||
|
padding: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Responsive adjustments */
|
||||||
|
@media screen and (max-width: 900px) {
|
||||||
|
.a4-document {
|
||||||
|
width: 95vw;
|
||||||
|
height: auto;
|
||||||
|
min-height: 134vw; /* Maintains A4 aspect ratio (297/210 ≈ 1.414) */
|
||||||
|
margin: 10px auto;
|
||||||
|
padding: 6vw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Print styles */
|
||||||
|
@media print {
|
||||||
|
.document-container {
|
||||||
|
background: none;
|
||||||
|
padding: 0mm !important;
|
||||||
|
margin: 0mm !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.a4-document {
|
||||||
|
width: 210mm;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
border: none;
|
||||||
|
page-break-after: always;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Additional MuiMarkdown specific adjustments */
|
||||||
|
.a4-document h1,
|
||||||
|
.a4-document h2,
|
||||||
|
.a4-document h3,
|
||||||
|
.a4-document h4,
|
||||||
|
.a4-document h5,
|
||||||
|
.a4-document h6 {
|
||||||
|
font-size: 1em;
|
||||||
|
margin-top: 0.25em;
|
||||||
|
margin-bottom: 0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Put after above so they take precedence */
|
||||||
|
.a4-document h1,
|
||||||
|
.a4-document h2 {
|
||||||
|
font-size: 1.1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.a4-document p {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
text-align: justify;
|
||||||
|
}
|
||||||
|
|
||||||
|
.a4-document ul,
|
||||||
|
.a4-document ol {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
padding-left: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.a4-document blockquote {
|
||||||
|
margin: 1em 0;
|
||||||
|
padding-left: 1em;
|
||||||
|
border-left: 3px solid #ccc;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.a4-document code {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
padding: 0.2em 0.4em;
|
||||||
|
border-radius: 3px;
|
||||||
|
font-family: 'Courier New', monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.a4-document pre {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
padding: 1em;
|
||||||
|
border-radius: 5px;
|
||||||
|
overflow-x: auto;
|
||||||
|
margin: 1em 0;
|
||||||
|
}
|
@ -51,6 +51,7 @@ import { StyledMarkdown } from 'components/StyledMarkdown';
|
|||||||
import { Resume } from 'types/types';
|
import { Resume } from 'types/types';
|
||||||
import { BackstoryTextField } from 'components/BackstoryTextField';
|
import { BackstoryTextField } from 'components/BackstoryTextField';
|
||||||
import { JobInfo } from './JobInfo';
|
import { JobInfo } from './JobInfo';
|
||||||
|
import './ResumeInfo.css';
|
||||||
|
|
||||||
interface ResumeInfoProps {
|
interface ResumeInfoProps {
|
||||||
resume: Resume;
|
resume: Resume;
|
||||||
@ -81,7 +82,7 @@ const ResumeInfo: React.FC<ResumeInfoProps> = (props: ResumeInfoProps) => {
|
|||||||
const printContentRef = useRef<HTMLDivElement>(null);
|
const printContentRef = useRef<HTMLDivElement>(null);
|
||||||
const reactToPrintFn = useReactToPrint({
|
const reactToPrintFn = useReactToPrint({
|
||||||
contentRef: printContentRef,
|
contentRef: printContentRef,
|
||||||
pageStyle: '@page { margin: 10px; }',
|
pageStyle: '@page { margin: 8mm !important; }',
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -407,7 +408,6 @@ const ResumeInfo: React.FC<ResumeInfoProps> = (props: ResumeInfoProps) => {
|
|||||||
<StyledMarkdown
|
<StyledMarkdown
|
||||||
content={activeResume.resume}
|
content={activeResume.resume}
|
||||||
sx={{
|
sx={{
|
||||||
p: 2,
|
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
maxHeight: '100%',
|
maxHeight: '100%',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
@ -492,22 +492,23 @@ const ResumeInfo: React.FC<ResumeInfoProps> = (props: ResumeInfoProps) => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{tabValue === 'preview' && (
|
{tabValue === 'preview' && (
|
||||||
<>
|
<Box className="document-container">
|
||||||
<StyledMarkdown
|
<Box className="a4-document">
|
||||||
sx={{
|
<StyledMarkdown
|
||||||
p: 2,
|
sx={{
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
maxHeight: '100%',
|
maxHeight: '100%',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
flex: 1 /* Take remaining space in some-container */,
|
flex: 1 /* Take remaining space in some-container */,
|
||||||
overflowY: 'auto' /* Scroll if content overflows */,
|
// overflowY: 'auto' /* Scroll if content overflows */,
|
||||||
}}
|
}}
|
||||||
content={editContent}
|
content={editContent}
|
||||||
/>
|
/>
|
||||||
<Box sx={{ pb: 2 }}></Box>
|
</Box>
|
||||||
</>
|
<Box sx={{ p: 2 }}> </Box>
|
||||||
|
</Box>
|
||||||
)}
|
)}
|
||||||
{tabValue === 'job' && activeResume.job && (
|
{tabValue === 'job' && activeResume.job && (
|
||||||
<JobInfo
|
<JobInfo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user