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

Free Support Forum - aspose.com

Table doesn't take CSS width

Hey


I updated my Aspose.PDF from 11.8.0 to 17.4.0.
Since the update my tables won’t take any width I give them but rather choose the automatic one.

HTML
<span style=“font-family: “Courier New”; font-size: small;”>
Hello
.listTable {
width: 9.75in;
word-wrap: break-word;
border: 1px solid black;
border-collapse: collapse;
font-family: Helvetica, Arial, sans-serif;
color: #707173;
font-size: 9pt;
}

.listTable tr td {
padding: 5px;
word-wrap: break-word;
border-top: 1px solid black;
vertical-align: top;
}

.listTable tr th {
padding: 5px;
vertical-align: top;
text-align: left;
background-color: white;
border-bottom: 2px solid black;
}

table {
overflow: hidden;
max-width: 6.25in;
margin-left: 0;
}
Ref. ID Ticket ID Titel Inhalt Klassifizierung Zeitschätzung
B13-9876 A12-1234 Beschreibung der Commandline-Argumente vom Server-Service Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Neuanforderung 1d 0h 0min

Because the Add/Update button is still broke so that I can’t upload my Testproject, I will paste my code below:
using System.IO;
using System.Reflection;
using System.Text;
using Aspose.Pdf;

namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var location = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location);
string html = File.ReadAllText(Path.Combine(location, “test.html”));

var htmloptions = new HtmlLoadOptions();

htmloptions.PageInfo.Width = PageSize.A4.Height;
htmloptions.PageInfo.Height = PageSize.A4.Width;
htmloptions.PageInfo.Margin.Top = MmToPoint(37.5);
htmloptions.PageInfo.Margin.Bottom = MmToPoint(18);
htmloptions.PageInfo.Margin.Left = htmloptions.PageInfo.Margin.Right = MmToPoint(23.5);
htmloptions.PageInfo.IsLandscape = true;

var doc = new Document(new MemoryStream(Encoding.UTF8.GetBytes(html)), htmloptions);
doc.Save(@“C:\temp\testpdf.pdf”);
}

private static double MmToPoint(double mm)
{
return mm * 2.834646;
}
}
}

Hi Ismail,


Thanks for contacting support.

I have tested the scenario and have managed to reproduce same problem. For the sake of correction, I have logged it as PDFNET-42580 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

PS, For your reference, I have also attached the image preview showing columns width issue and the resultant PDF document.