Issue with table column width after exporting to PDF

I have attached my sample HTML used for the export. i found that the % width of the table columns don’t seems to be respected after exporting to PDF.

My expected result is for the table to be same as what is seen on the browser. that issue after exporting the PDF could be due to the image using its original size. wondering if there is any way for the table column to obey the width styling being set during the export.

i am using Aspose.PDF(20.6)

my C# Code

try
{
Aspose.Pdf.License pdflic = new Aspose.Pdf.License();
pdflic.SetLicense(“Aspose.Total.lic”);
string webRequestURL = Request.Url.ToString();
if (string.IsNullOrEmpty(Request.QueryString[“ContactID”]) == false && int.TryParse(Request.QueryString[“ContactID”], out _) == true)
{
webRequestURL = webRequestURL + “&mode=pdfexport”;
}
else if (string.IsNullOrEmpty(Request.QueryString[“IssueID”]) == false && int.TryParse(Request.QueryString[“IssueID”], out _) == true)
{
webRequestURL = webRequestURL + “&mode=pdfexport”;
}
else
{
webRequestURL = webRequestURL + “?mode=pdfexport”;
}
WebRequest request = WebRequest.Create(webRequestURL);
request.Credentials = CredentialCache.DefaultCredentials;
// Request.Timeout = 100;

HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
responseFromServer = responseFromServer.Replace(“col-md-9”, “”);
responseFromServer = responseFromServer.Replace(“col-md-3”, “”);
responseFromServer = responseFromServer.Replace(“col-md-12”, “”);
responseFromServer = responseFromServer.Replace(“col-md-2”, “”);
responseFromServer = responseFromServer.Replace(“col-md-10”, “”);
responseFromServer = responseFromServer.Replace(“bootstrap.css”, “”);
// responseFromServer = responseFromServer.Replace("<table width="100 % “>”, "<table width="300px “>”);

reader.Close();
dataStream.Close();
response.Close();

MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseFromServer));

HtmlLoadOptions options = new HtmlLoadOptions(Request.Url.ToString());
options.PageInfo.IsLandscape = false;
options.PageInfo.Margin.Top = 0;
options.PageInfo.Margin.Left = 0.4;
options.PageInfo.Margin.Right = 0;
options.PageInfo.Margin.Bottom = 0.1;

Document pdfDocument = new Document(stream, options);
pdfDocument.Info.Title = pdfTitle;

for(int index=1; index <= pdfDocument.Pages.Count; index++)
{
if (pdfDocument.Pages[index].IsBlank(0.01d))
{
pdfDocument.Pages.Delete(index);
}
}

// Create page number stamp
PageNumberStamp pageNumberStamp = new PageNumberStamp();
// Whether the stamp is background
pageNumberStamp.Background = false;
pageNumberStamp.Format = "Page # / " + pdfDocument.Pages.Count;
pageNumberStamp.BottomMargin = 10;
pageNumberStamp.HorizontalAlignment = HorizontalAlignment.Center;
pageNumberStamp.StartingNumber = 1;
// Set text properties
pageNumberStamp.TextState.Font = FontRepository.FindFont(“Arial”);
pageNumberStamp.TextState.FontSize = 9.0F;
pageNumberStamp.TextState.FontStyle = FontStyles.Regular;
pageNumberStamp.TextState.FontStyle = FontStyles.Regular;
pageNumberStamp.TextState.ForegroundColor = Color.Black;

for (int i = 1; i <= pdfDocument.Pages.Count; i++)
{
pdfDocument.Pages[i].AddStamp(pageNumberStamp);
}

// pdfDocument.Pages[1].AddStamp(pageNumberStamp);

MemoryStream ms = new MemoryStream();

pdfDocument.Save(ms);
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.Charset = “UTF-8”;
Response.AddHeader(“content-length”, ms.Length.ToString());
Response.AddHeader(“content-disposition”, String.Format(“attachment;filename=” + pageURL + “.pdf”, “FileName”));
Response.ContentType = “application/pdf”; Response.BinaryWrite(ms.ToArray());
Response.Flush();
Response.End();

}
catch (Exception ex)
{
throw ex;
}
finally
{
}

Test.zip (793.0 KB)

I have uploaded the view I see from browser and after export
PDF View.png (72.5 KB)
Browser View.png (31.5 KB)

@bczm8703

We were able to reproduce the issue in our environment and logged it as PDFNET-48502 in our issue tracking system. We will further look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.