Image and table positioning - best practice help


#1

We are evaluating the Aspose PDF and so far we are VERY happy with the results. We are using the XML with an XSLT stylesheet.

Please can you help:

Our test invoice needs a header that has a logo on left 50% of the page, with Company details and address on right 50% of the page.

We have setup a table as:
< Section PageHeight="1684" >
< Table ColumnWidths="60 140 100 180" >
...etc...

Our question is how to get the logo to appear on the right 50% of the page? And what is the best practice way to do this?

We have tried a background image but this does not work properly.
In a std. html table we would merge the 2 columns on the left and place the logo in that.

Thanks

Howard
Syncrony.com


#2

Dear Howard,

Thank you for considering Aspose.

You can add a table with 2 columns into the header , put your logo image in one column and company details in another column.


#3

Hi

Thanks for the prompt reply.

Yes I know that.

Problem is that the table has multiple rows with Company address details.

We need a way to add image to one column with all cells in that colums to be merged. So that the image does not expand in just one top row and push all the other rows below.

Is it possible to put sub-table in column where the company details go?

Thanks


#4

Dear Howard,

Thank you for considering Aspose.

Yes. Nested table is supported.


#5

Thanks for your reply.

I tried to make a nested table work - because I saw a forum post that said it was supported BUT I could not get it to work properly.

Please can you give me a small example of nesting in XML.

Thanks!

Howard


#6

Dear Howard,

Thank you for considering Aspose.

Here is a small example of nested table in XML.









company info1
company info2


company info3
company info4


company info5
company info6






#7

Can you please post VB.Net code for netstated table?. Also How will I add image in table cell using VB code.

Thanks
Sundaram


#8

Dear Sundaram,

Thank you for considering Aspose.

Please refer to Nested Table in our programmer’s guide.


#9

Thanks for your link.

How will I add image in table cell using VB code? Also In table cell I want to added first part of text in bold and second part of text in normal format. can you some sample code for this?

-Sundaram


#10

Dear Sundaram,

Thank you for considering aspose.

I have write an example in VB code for you:

Dim pdf1 As Pdf = New Pdf
Dim sec1 As Section = pdf1.Sections.Add

Dim tab1 As Table = New Table
sec1.Paragraphs.Add(tab1)
tab1.ColumnWidths = "100 200"
tab1.DefaultCellBorder = New BorderInfo(BorderSide.All)
Dim row1 As Row = tab1.Rows.Add

Dim cell1 As Cell = row1.Cells.Add
Dim img1 As Image = New Image
img1.ImageInfo.File = "c:/images/apple.jpg"
img1.ImageInfo.ImageFileType = ImageFileType.Jpeg
cell1.Paragraphs.Add(img1)

Dim cell2 As Cell = row1.Cells.Add
Dim text1 As Text = New Text("This is text para 1")
text1.Segments(0).TextInfo.FontName = "Times-Bold"
cell2.Paragraphs.Add(text1)

Dim text2 As Text = New Text("This is text para 2")
cell2.Paragraphs.Add(text2)

pdf1.Save("e:/temp/test.pdf")