Hello, I have the code that follows below that uses Bootstrap 4 styles. I run the HTML as is (with the Bootstrap styles) thru EO-PDF (latest version 18.1.56.0), with Letter and Landscape settings (see C# code that runs it below the HTML code) and I get 4 pages of content. However If I change the first div line from:-
<div class="main-content my-normal-text">
to
<div class="main-content my-small-normal-text">
...I get 4 pages of content with a blank page at the end.
Any ideas how I get rid of the blank page ?
Note - as a solution
- I would prefer pure HTML/CSS (no 'remove-blank-page' logic in the API)
- I cannot simply reduce the sizes (height or width as I have a blue colored background). Changing the size would potentially leave a white vertical/horizontal strip
- I would prefer also not to use the ShrinkToFit/ScaleToFit settings for the same reason (potential horizontal/vertical white strip)
Code: HTML/ASPX
<style type="text/css">
.letter-landscape {
overflow: hidden;
height: 8.5in !important;
max-height: 8.5in !important;
min-height: 8.5in !important;
width: 11in !important;
max-width: 11in !important;
min-width: 11in !important;
}
.my-normal-text {
font-size: 8pt !important;
line-height: 14px !important;
}
.my-small-normal-text {
font-size: 8pt !important;
line-height: 12px !important;
}
</style>
<div class="main-content my-normal-text">
<div class="container-fluid">
<div class="letter-landscape">
<div class="row mb-1">
<div class="col-12 col-sm-9 large-text font-weight-bold mt-1 mb-1"><span class="dark-blue">1111</span>2222</div>
<div class="col-12 col-sm-3 text-left text-sm-right">3333</div>
</div>
<div class="row">
<div class="col-12">
<div>4444</div>
</div>
</div>
<div class="row">
aaaa
</div>
</div>
<div class="letter-landscape">
<div class="row mb-1">
xxxx
</div>
<div class="row">
yyyy
</div>
<div>
zzzz
</div>
</div>
<div class="letter-landscape">
<div class="row mb-1">
<div class="col-12 col-sm-9 large-text font-weight-bold mt-1 mb-1"><span class="dark-blue">1111</span>2222</div>
<div class="col-12 col-sm-3 text-left text-sm-right">3333</div>
</div>
<div class="row">
<div class="col-12">
<div>4444</div>
</div>
</div>
<div class="row">
aaaa2
</div>
</div>
<div class="letter-landscape">
<div class="row mb-1">
xxxx2
</div>
<div class="row">
yyyy2
</div>
<div>
zzzz2
</div>
</div>
</div>
</div>
Code: C#
SizeF sizeF;
if (uploadData.PageSize.ToLower() == "letter")
{
sizeF = (uploadData.PageOrientation.ToLower() == "portrait")
? new SizeF(PdfPageSizes.Letter.Width, PdfPageSizes.Letter.Height)
: new SizeF(PdfPageSizes.Letter.Height, PdfPageSizes.Letter.Width);
}
else
{
sizeF = (uploadData.PageOrientation.ToLower() == "portrait")
? new SizeF(PdfPageSizes.Tabloid.Width, PdfPageSizes.Tabloid.Height)
: new SizeF(PdfPageSizes.Tabloid.Height, PdfPageSizes.Tabloid.Width);
}
HtmlToPdf.Options.BaseUrl = uploadData.BaseUrl;
HtmlToPdf.Options.PageSize = sizeF;
HtmlToPdf.Options.OutputArea = new RectangleF(0, 0, sizeF.Width, sizeF.Height);
HtmlToPdf.Options.AutoFitX = HtmlToPdfAutoFitMode.None;
HtmlToPdf.Options.UsePrintMedia = true;
HtmlToPdf.DebugConsole = Console.Out;
HtmlToPdf.Options.NoLink = true;
EO.Pdf.Runtime.AddLicense("xxxxxxxx");
using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
HtmlToPdf.ConvertHtml(uploadData.InputHtml, stream);
bytes = stream.ToArray();
}
result = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new ByteArrayContent(bytes)
};