Hi
I am unable to print the pdf that I have created using aspose.pdf. I have converted HTML string to pdf.
Printer: HP M4345 MFP
Driver: HP Universal Printing PS (v5.9.0).
Driver: HP Universal Printing PS (v5.9.0).
Below is the code:
var pdfLicense = new Aspose.Pdf.License();
pdfLicense.SetLicense(HttpContext.Current.Server.MapPath("~") + “\Aspose.Total.lic”);
string path = HttpContext.Current.Server.MapPath("~");
try
{
var pdfHTML = new StringBuilder();
pdfHTML.AppendFormat("" +
//"<link rel=“stylesheet” type=“text/css” href="{0}\Content\print.css">" +
//"<link rel=“stylesheet” type=“text/css” href="{0}\Content\bootstrap.min.css">" +
“<body class=“print-body”>”
, path);
pdfHTML.Append(
“<div class=“row print-header”>” +
“<div class=“pull-left”>” +
“<div class=“inline big-font”>” +
" TEST PDF" +
“
” + “
” + “<div class=“pull-right”>” +
“<div class=“profileWrapper”>” +
“” +
“Employy Name” +
“” +
“
” + “<div class=“right-padding-15”>” +
“” +
“Today’s Date” +
“” +
“
” + “
” + “
”); pdfHTML.Append("
");
");
pdfHTML.AppendFormat(
“<div class=“col-xs-20 mainContent”>” +
“<div class=“row”>” +
“<div class=“pull-left printPage-submitOffice”>” +
“” +
“Submitted to {0}” +
“” +
“
” + “
” + “<div class=“row”>” +
“<div class=“col-sm-14”>” +
“<div id=“viewByWrapper”> " +
“<div id=“viewBy”>” +
“Items Found: {1}” +
" " +
“Total {2} Amount: {3} {2}” +
“
” + “
” + “
” + “
” , “City Name”
, “1”
, “Currency”
, “500.00”);
pdfHTML.Append(”<div class=“row”>");
pdfHTML.Append("<table class=“print-table”>
# <th style=“width: 100px”>DATECODE <th style=“width: 230px”>TYPECURRENCY
FOREIGN AMOUNT
EXCHANGE RATE
LOCAL AMOUNT <th style=“width: 90px”>TAX ");
pdfHTML.Append("");
"); pdfHTML.AppendFormat(
“” + ”
“{0} ” +
“{1} ” +
“{2} ” +
“{3} ” +
“{4} ” +
“{5} ” +
“{6} ” +
“{7} ” +
“{8} ” +
“
, “1”
, “23-Mar-2017”
, “XYZ”
, “XYZ”
, “INR”
, “”
, “”
, “500.00”
, “19.00%”);
pdfHTML.Append("
pdfHTML.Append("");
var htmlLoadOptions = new HtmlLoadOptions();
htmlLoadOptions.PageInfo.Margin.Top = 270;
htmlLoadOptions.PageInfo.Margin.Left = 30;
htmlLoadOptions.PageInfo.IsLandscape = true;
var pdf = new Document(new MemoryStream(Encoding.UTF8.GetBytes(pdfHTML.ToString())), htmlLoadOptions);
for (int i = 1; i <= pdf.Pages.Count; i++)
pdf.Pages[i].SetPageSize(792, 612);
pdf.PageMode = PageMode.UseThumbs;
JavascriptAction javascript = new JavascriptAction(“this.print({bUI:true,bSilent:false,bShrinkToFit:true});”);
pdf.OpenAction = javascript;
pdf.Save(path + “\ThisPDFNotPrinting.pdf”);
I am using 17.1.0 version of Aspose.
I am using 17.1.0 version of Aspose.
I am able to print other pdf files. Only the pdf files generated using Aspose are not printing.