We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

HTML to PDF Slow

Hello,
We are using Aspose in most of our web application(.Net Core 2.1) to generate PDF.
But it is too slow while converting HTML to PDF.

Sample Code:

Blockquote
public IActionResult Index()
{
HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
htmlLoadOptions.PageInfo.IsLandscape = true;
htmlLoadOptions.PageInfo.Margin.Bottom = 80;
htmlLoadOptions.PageInfo.Margin.Top = 185;
htmlLoadOptions.PageInfo.Margin.Left = 40;
htmlLoadOptions.PageInfo.Margin.Right = 40;
string TemplateData = @"/@font-face{font-family: ‘CenturyGothic’;src: url(’…/fonts/CenturyGothic-Regular.TTF’) format(‘truetype’);src: url(’…/fonts/CenturyGothic-Italic.TTF’) format(‘truetype’);src: url(’…/fonts/CenturyGothic-Bold.TTF’) format(‘truetype’);src: url(’…/fonts/CenturyGothic-Bold-Italic.TTF’) format(‘truetype’);}/:root,html,body, .table{font-family: ‘Century Gothic’;font-size: 9pt;color: darkslategrey;margin: 0;padding: 0;margin-bottom: 8px;}.ks_footer{position: fixed;height: 100px;bottom: 0px;left: 0px;right: 0px;margin-bottom: 0px;}@page{size: A4 portrait;}.ks_VerticalAlignTop{vertical-align: top;}.width50{width: 50%;}.headerTable{text-align: center;}.headerTable td{text-align: inherit;}.ks_row{content: ‘’;display: block;box-sizing: border-box;}.ks_row:before,.ks_row:after{content: ‘’;display: block;}.ks_row:after{clear: both;}.ks_column{display: inline-block;box-sizing: border-box;}.ks_table,.ks_thead,.ks_tbody,.ks_tfoot,.ks_tr,.ks_th,.ks_td{/vertical-align: middle;/}table{font-size: 9pt;font-family: ‘Century Gothic’;}.ks_table{border: 1px solid #646464;display: table;empty-cells: show;border-spacing: 0;border-collapse: collapse;vertical-align: middle;font-size: 9pt;width: 100%;margin: 0.25em 0;font-family: ‘Century Gothic’;}.ks_colgroup{display: table-column-group;}.ks_thead{display: table-header-group;}.ks_tbody{display: table-row-group;}.ks_tfoot{display: table-footer-group;}.ks_tr{display: table-row;}.ks_th,.ks_td{display: table-cell;padding: 0.5em 0.20em;}.ks_th{font-weight: bold;line-height: 2.5em;}.ks_td{min-width: 20%;line-height: 1em;}.ks_td_copy{line-height: 2em;//font-size: 1.1em;width: 35%;}.ks_widthFull{width: 100%;}.ks_widthTwoThird{width: 75%;}.ks_widthTwoQuarters{width: 66.6666%;}.ks_widthHalf{width: 50%;}.ks_widthOneQuarter{width: 33.3333%;}.ks_widthOneFourth{width: 25%;}.ks_widthOneFifth{width: 20%;}.ks_width70{width: 70%;}.ks_width90{width: 90%;}.ks_width55{width: 55%;}.ks_width45{width: 45%;}.ks_width20{width: 20%;}.ks_width28{width: 28%;}.ks_width30{width: 30%;}.ks_width35{width: 35%;}.ks_width40{width: 40%;}.ks_width50{width: 50%;}.ks_minwidth38{min-width: 38%;}.ks_width60{width: 60%;}.ks_width62{width: 62%;}.ks_width14-28{width: 14.28571429%;}.ks_bgWarning{background: #f00;color: #fff;}.ks_bgDefault{background: #fff;color: #000;}.ks_textRight{text-align: right;}.ks_textLeft{text-align: left;}.ks_textCenter{text-align: center;}.ks_LabelCell{font-size: 1.1em;line-height: 1.4em;color: rgba(60, 60, 60, 0.75);}.ks_lineHeight1{line-height: 1em;}.ks_lineHeight105{line-height: 1.5em;}.ks_AllBorders{border: 1px solid rgba(116, 116, 116, 0.5);}.ks_borderBottom{border-bottom: 0.0625em solid rgba(116, 116, 116, 0.5);}.ks_borderTop{border-top: 0.0625em solid rgba(116, 116, 116, 0.5);}.ks_RedBorder{border: 1px solid #ff0000;}.ks_NoBorders{border: 0 solid transparent;}.ks_thick{font-weight: 600;font-size: 1.1em;}.ks_bold{font-weight: 900;font-family: ‘Century Gothic’;}.ks_AddressTo{/font-family: ‘Century Gothic’;/Font-weight: bold;Font-size: 10pt;Line-height: 18px;}.ks_AddressContent{/font-family: ‘Century Gothic’;/Font-weight: normal;Font-size: 9pt;Line-height: 14px;}.ks_AreaTitle{/font-family: ‘Century Gothic’;/Font-weight: bold;Font-size: 10pt;Line-height: 18px;}.ks_notes{/font-family: ‘Century Gothic’;/Font-weight: Normal;Font-size: 9pt;Line-height: 14px;}.ks_QualityTitle{/font-family: ‘Century Gothic’;/Font-weight: Normal;Font-size: 10pt;Line-height: 18px;}.ks_NetContent{/font-family: ‘Century Gothic’;/Font-weight: Normal;Font-size: 9pt;Line-height: 14px;}.ks_TotalNet{/font-family: ‘Century Gothic’;/Font-weight: bold;Font-size: 9pt;Line-height: 18px;}.ks_ConfirmText{/font-family: ‘Century Gothic’;/Font-weight: normal;Font-size: 9pt;Line-height: 14px;}.ks_boldStage{font-weight: 900;font-size: 1.5em;line-height: 0.84em;}.ks_conceal{display: none;}.ks_paddingTop1{padding-top: 1.2em;}.ks_paddingBottom1{padding-bottom: 1em;}.ks_paddingBottom2{padding-bottom: 2em;}.ks_paddingRight1{padding-right: 1em;}.ks_paddingLeft2{padding-left: 2em;}.ks_croppedImage{background-size: 100% 100%;}.ks_invoiceBody{font-family: ‘Century Gothic’;font-size: 10pt;color: black;margin: 0;padding: 0;margin-bottom: 0px;}.ks_ContentHeader{/padding: 5px 25px;/padding-top: 5px;padding-left: 30px;padding-right: 30px;background-color: black;color: white;}.ks_costhdr{text-align: right;padding-right: 25px;}.ks_innerTable{border-collapse: collapse;}.ks_strong{font-weight: bold;}.ks_blackfont{color: black;}pre{font-size: 9pt;}.pagebreak{page-break-before: always;}

Bill To:
Test
Test
Test
Test
Test
Ship To:
,
RE:
PROJECT :
PO #:
SIDE MARK: header sidemark
S/M : TEST SIDEMARK

AREA(S): HALL

stark Logo

OPTION A :

BEATON - BLACK

CONTENT: 100% WOOL

CONSTRUCT: WILTON

PILE: LOOP PILE

WIDTH: 12’ 0’, ORIGIN: U.S.A.

stark Logo

TYPE: HAND-KNOTTED

QUALITY: CUSTOM HAND KNOTTED

stark Logo

ITEM: NOT 129726

TYPE: NEW ORIENTAL TIBETAN

QUALITY: DOMINA SHADOW

CONTENTS: 85% WOOL / 10% SILK / 5% NETTLE

ORIGIN: NEPAL

DESIGNER NET: $0
FREIGHT: $0
TOTAL PRICE FOR OPTION A: $0
BEDROOM1
NOT LEINAD KRATS
COLOR: LIGHT BLUE
SIZE 9 X 12
6’ X 9’5’
ANTILOCARPA
COLOR: ALMOND
stark Logo

OPTION B :

BEACH LIFE - ANTHRACITE 24

WIDTH: 6’ 7’

DESIGNER NET: $0.42
FREIGHT: $0.00
TOTAL PRICE FOR OPTION B: $0.42

If you have any questions. please email me at Test

Thank you,
Test
Test
";
Document docpdf = new Document(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(TemplateData)), htmlLoadOptions);
return View();
}

This takes more than 32,000 mili sec.

image.png (33.9 KB)

Thank you in advance.
Prakash,

@psahoo,

I have worked with source file shared by you and unable to observe the issue. Can you please share complete working project to reproduce issue so that we may help you out.

Hi Adnan,
Please find the attachment:
TestAspose.zip (1.5 MB)

Thank you,

@psahoo,

We are looking into this and will get back to you with feedback soon.