I work on asp.net mvc application . I face issue on print report div container .
this issue happen on bottom section that have signature date and reference No that display out side bottom border
div class container is my issue it display outside bottom border .
I display signature and date on the bottom of page but this section display on second page and outside bottom border so how to solve that
so How to solve this issue
html code
Code
@model HR.WorkforceRequisition.Models.WorkforceRequest
@{
Layout = null;
}
Print Request
@Styles.Render("~/Content/PrintStyle")
DATE:
@Model.CreatedDate.ToString("dd/MM/yyyy")
@Html.DisplayNameFor(model => model.WorkforceRequestID):
@Model.WorkforceRequestID
DEPARTMENT:
@Model.DepartmentName
@Html.DisplayNameFor(model => model.Section):
@Model.Section
REQUIRED POSITION:
@Model.RequiredPosition
@Html.DisplayNameFor(model => model.Qty):
@Model.Qty
REPORTING TO:
@Model.ReportingTo
REASONS FOR REQUISITION:
@*check mark codes => ✓ / ? / ✓*@
@if (Model.Budgeted.Value)
{✓}
Budgeted Position, If Budgeted, Pls.Specify,
@if (Model.Replacement == false && Model.Adjustment == false)
{✓}
New
@if (Model.Replacement == true)
{
✓
}
Replacement
@if (Model.Adjustment == true)
{✓}
Adjustment
@if (Model.Replacement == true)
{
@Html.DisplayNameFor(model => model.ReplacmentTo) :
@Model.ReplacmentTo
@* @Model.ReplacmentTo
*@
@Html.DisplayNameFor(model => model.ReplacementReason):
@Model.ReplacementReason
}
@if (!Model.Budgeted.Value)
{✓}
Non Budgeted (Justification)
JOB DESCRIPTION AVAILABILITY:
@if (Model.JobDescriptionAvailable.Value)
{✓}
Yes
@if (!Model.JobDescriptionAvailable.Value)
{✓}
No (If No,Kindly fill & attach the Job Description Questionnaire form)
REQUIREMENTS:
Gender
@if (Model.Gender.GenderDescription.ToUpper() == "MALE")
{✓}
Male
@if (Model.Gender.GenderDescription.ToUpper() == "FEMALE")
{✓}
Female
@if (Model.Gender.GenderDescription.ToUpper() == "NO PREFERENCE")
{✓}
No Preference
Age Range:
@if (Model.AgeRange.AgeRangeDesc.ToUpper() == "18 - 35")
{✓}
18 - 35
@if (Model.AgeRange.AgeRangeDesc.ToUpper() == "35 - 50")
{✓}
35 - 50
@if (Model.AgeRange.AgeRangeDesc.ToUpper() == "NO PREFERENCE")
{✓}
No Preference
Years of Experience: @Model.ExperienceYears
As per Job Description
FACILITY/ASSET REQUIREMENT
PROVIDED BY I.T. DEPARTMENT
PROVIDED BY ADMIN DEPARTMENT
DESCRIPTION
YES
NO
DESCRIPTION
YES
NO
@Html.DisplayNameFor(model => model.PC)
@if (Model.PC.Value)
{ ✓ }
@if (!Model.PC.Value)
{ ✓ }
@Html.DisplayNameFor(model => model.OfficeFurniture)
@if (Model.OfficeFurniture.Value)
{ ✓ }
@if (!Model.OfficeFurniture.Value)
{ ✓ }
@Html.DisplayNameFor(model => model.UserID)
@if (Model.UserID.Value)
{ ✓ }
@if (!Model.UserID.Value)
{ ✓ }
@Html.DisplayNameFor(model => model.SpaceAvailability)
@if (Model.SpaceAvailability.Value)
{ ✓ }
@if (!Model.SpaceAvailability.Value)
{ ✓ }
@Html.DisplayNameFor(model => model.Email)
@if (Model.Email.Value)
{ ✓ }
@if (!Model.Email.Value)
{ ✓ }
@Html.DisplayNameFor(model => model.BusinessCard)
@if (Model.BusinessCard.Value)
{ ✓ }
@if (!Model.BusinessCard.Value)
{ ✓ }
@Html.DisplayNameFor(model => model.LandLine)
@if (Model.LandLine.Value)
{ ✓ }
@if (!Model.LandLine.Value)
{ ✓ }
Others Pls Specify: @Model.OtherAssetFromIT
Others Pls Specify: @Model.OtherAssetFromAdminDep
TARGET EMPLOYMENT DATE:
@**@
@if (Model.TargetEmploymentDate != null)
{
@Model.TargetEmploymentDate.Value.ToString("dd/MM/yyyy")
}
PREFERRED NATIONALITY:
@if (Model.PreferredNationality.NationalityName.ToUpper() == "UAE NATIONALS")
{✓}
UAE Nationals
@if (Model.PreferredNationality.NationalityName.ToUpper() == "GCC Countries".ToUpper())
{✓}
GCC Countries
@if (Model.PreferredNationality.NationalityName.ToUpper() == "Other Arab Nationals".ToUpper())
{✓}
Other Arab Nationals
@if (Model.PreferredNationality.NationalityName.ToUpper() == "Other Expats".ToUpper())
{✓}
Other Expats
Other Remarks (If Any):
@Model.Remarks
Name
Position
Status / Signature
Date
@if (!string.IsNullOrEmpty(Model.CreatedByName))
{
@Model.CreatedByName
Requester
Requested
@Model.CreatedDate.ToString("dd/MM/yyyy")
}
@if (Model.LineManagerUserName != null && !string.IsNullOrEmpty(Model.LineManagerUserName.ToString()) && Model.LineManagerUser > 0)
{
@Model.LineManagerUserName
Line Manager
@if (@Model.LineManagerApproved == true)
{
Approved
}
else
{
Rejected
}
@if (@Model.LineManagerApprovalDate != null)
{
@Model.LineManagerApprovalDate.Value.ToString("dd/MM/yyyy")
}
}
@if (Model.DepartementHeadUserName != null && !string.IsNullOrEmpty(Model.DepartementHeadUserName.ToString()) && Model.DepartementHeadUser > 0)
{
@Model.DepartementHeadUserName
Department Head
@if (@Model.DepartementHeadApproved == true)
{
Approved
}
else
{
Rejected
}
@if (@Model.DepartementHeadApprovalDate != null)
{
@Model.DepartementHeadApprovalDate.Value.ToString("dd/MM/yyyy")
}
}
@if (Model.PlanningUser != null && !string.IsNullOrEmpty(Model.PlanningUser.ToString()) && Model.PlanningUser > 0)
{
@Model.PlanningUserName
Planning
@if (@Model.PlanningApproved == true)
{
@*Approved*@
Reviewed
}
else
{
Rejected
}
@if (@Model.PlanningApprovalDate != null)
{
@Model.PlanningApprovalDate.Value.ToString("dd/MM/yyyy")
}
}
@if (Model.RecruitmentUserName != null && !string.IsNullOrEmpty(Model.RecruitmentUserName.ToString()) && Model.RecruitmentUser > 0)
{
@Model.RecruitmentUserName
Recruitment
@if (@Model.RecruitmentApproved == true)
{
@*Approved*@
Reviewed
}
else
{
Rejected
}
@if (@Model.RecruitmentApprovalDate != null)
{
@Model.RecruitmentApprovalDate.Value.ToString("dd/MM/yyyy")
}
}
@if (Model.HREDUser != null && !string.IsNullOrEmpty(Model.HREDUser.ToString()) && Model.HREDUser > 0)
{
@Model.HREDUserName
HRE Director
@if (@Model.HREDApproved == true)
{
Approved
}
else
{
Rejected
}
@if (@Model.HREDApprovalDate != null)
{
@Model.HREDApprovalDate.Value.ToString("dd/MM/yyyy")
}
}
@if (Model.CEOUser != null && !string.IsNullOrEmpty(Model.CEOUser.ToString()) && Model.CEOUser > 0)
{
@Model.CEOUserName
CEO
@if (@Model.CEOApproved == true)
{
Approved
}
else
{
Rejected
}
@if (@Model.CEOApprovalDate != null)
{
@Model.CEOApprovalDate.Value.ToString("dd/MM/yyyy")
}
}
CEO
Received By
Signature and Date
Signature and Date
HR FM 04-03-E Version No: 09. Effective Date : 15/03/2020
css file as below PrintStyle
CSS
/* Created By Fathi */
@page {
size: auto; /* auto is the initial value */
margin: 0mm; /* this affects the margin in the printer settings */
}
body {
/*height:29.7cm;
width:21cm;
margin: 20mm 18mm;*/
margin-top: 20mm;
margin-left: 21mm;
}
/*@page {
size: 21cm 29.7cm;
margin: 20mm 18mm;
}*/
.container {
width: 17cm;
border: solid 2px black;
}
.header {
width: 100%;
border-bottom: solid 2px black;
/* display:grid;
grid-template-columns:34mm 102mm 34mm;*/
display: flex;
}
.header-HRlogo {
width: 34mm;
border-right: solid 2px black;
display: flex;
justify-content: center;
}
.header-Title {
flex: 1;
text-align: center;
font-family: Arial;
}
.header-CompanyLogo {
width: 34mm;
border-left: solid 2px black;
display: flex;
justify-content: center;
}
.requestInfo {
padding-top: 5px;
}
.requestInfo-lable-1 {
font-size: 9px;
font-family: Tahoma;
font-weight: bold;
/*padding: 1px 10px;*/
white-space: nowrap;
}
.requestInfo-lable-2 {
font-size: 10px;
font-family: Tahoma;
/*white-space: nowrap;*/
}
.flex {
display: flex;
}
.requestInfo-flex-div-1 {
width: 37mm;
}
.requestInfo-flex-div-2 {
width: 50mm;
border-bottom: solid 1px black;
text-align: center;
}
.requestInfo-flex-div-4 {
width: 57mm;
border-bottom: solid 1px black;
text-align: center;
margin-left: 5px;
}
.modelData {
font-size: 12px;
}
.square {
padding: 1px;
height: 10px;
width: 10px;
border: solid 1px black;
display: flex;
}
.checkMark {
font-size: 13px;
margin-top: -4px;
}
.tableBorderCollaps {
border: 1px solid black;
border-collapse: collapse;
padding: 0px;
}
.footer {
font-size: 6.5px;
margin-left: 4.5mm;
margin-top: 2mm;
}
Amira BedhiafiRank #601 · 4K reputationPosted Jan 14, 2025, 8:48 AM EST
You have some margin settings, but it could help to further control the margins to ensure that the footer section stays within the page bounds. So you need to make sure the div containing the signature, date, and reference number is not being forced to a new page and you can control this with
page-break-before,page-break-after, andpage-break-inside.You can use
page-break-inside: avoid;on the section that contains the signature and date, so it doesn't break across pages and adjustmargin-topandmargin-bottomso you get enough space for the footer to fit on the same page..container { width: 17cm; border: solid 2px black; page-break-inside: avoid; /* Avoid breaking the container */ } .footer { font-size: 6.5px; margin-left: 4.5mm; margin-top: 2mm; page-break-before: always; /* Force this section to appear on the next page */ } .signature-section { page-break-before: auto; page-break-after: always; /* Here you make sure the signature section starts fresh on the page */ margin-top: 10px; }When you do the printing, the content is should be scaled correctly to fit within the page without cutting off and this how you need to add the
@pagerule:@page { size: auto; margin: 10mm 10mm; }