Html Div structure In Aspose Pdf

I have added a .png file…

I want to the same thing using aspose pdf .

How to do this…

Hi Som,


Thanks for your inquiry. I am afraid I am not clear about your requirements, we will appreciate it if you please share some more details about it.

However in reference to query subject, if you have the table in HTML then you can convert HTML to PDF using DOM approach. It will help you to accomplish the task.

Looking forward to detailed requirements.

Best Regards,

Hi,

These are not the hardcoded values.(3,0,0,3).

I have to get these values from c# and show these values as upper diagram in the top of pdf…




Hi Som,


Thanks for your feedback. You can add you values as table cell into table and created table in PDF header as following. Hopefully it will help you to accomplish the task.

Document doc = new
Document(myDir + “HelloWorld.pdf”);<o:p></o:p>

Aspose.Pdf.HeaderFooter header = new Aspose.Pdf.HeaderFooter();

header.Margin.Top = 20;

Aspose.Pdf.Table table = new Aspose.Pdf.Table();

//table.ColumnAdjustment = ColumnAdjustment.AutoFitToContent;

//table.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.Box, 0.5F);

//table.DefaultCellPadding = new Aspose.Pdf.MarginInfo() { Left = 2, Top = 2, Bottom = 2, Right = 2 };

table.ColumnWidths = "25 25 25 25";

Aspose.Pdf.Row row = table.Rows.Add();

Aspose.Pdf.Cell cell= new Aspose.Pdf.Cell();

cell.DefaultCellTextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center;

cell = row.Cells.Add("3", new TextState() { HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center });

cell.BackgroundColor = Aspose.Pdf.Color.Gray;

cell = row.Cells.Add("0", new TextState() { HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center });

cell.BackgroundColor = Aspose.Pdf.Color.Green;

cell = row.Cells.Add("0", new TextState() { HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center });

cell.BackgroundColor = Aspose.Pdf.Color.Red;

cell = row.Cells.Add("3", new TextState() { HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center });

cell.BackgroundColor = Aspose.Pdf.Color.LightGray;

header.Paragraphs.Add(table);

for (int cnt = 1; cnt <= doc.Pages.Count; cnt++)

{

doc.Pages[cnt].Header = header;

}

doc.Save(myDir + "Output_DOMheaderfooter.pdf");

Please feel free to contact us for any further assistance.


Best Regards,