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

Free Support Forum - aspose.com

Pdf table with image and property keeptogher=true get error: invalid image filename

pdf table with image and property keeptogher=true get error: invalid image filename


if i create a table and in the 3° row i an image from stream and i want the table to don't split row in the next page i get error: invalid image filename.

this appen also whene there is space to write the whole table.

i attached the document doing it without the keeptoghere property on the last paragraph.

this is the code i'm using

S.Paragraphs.Add(tab1)

Dim x As Integer = S.Paragraphs.Count - 1

S.Paragraphs(x).IsKeptTogether = True

tab1.ColumnWidths = "150 200 150"

tab1.DefaultCellBorder = New BorderInfo(BorderSide.All, 0.1F)


margin = New MarginInfo() : margin.Top = 0.0F : margin.Left = 0.0F : margin.Right = 0.0F : margin.Bottom = 0.0F : tab1.DefaultCellPadding = margin

Dim row1 As Aspose.Pdf.Row = tab1.Rows.Add() : row1.Cells.Add(DOCUMENTO_LUOGO) : row1.Cells.Add("") : row1.Cells.Add(myARK.RUOLO)

Dim row2 As Aspose.Pdf.Row = tab1.Rows.Add() : row2.Cells.Add(DOCUMENTO_DATA) : row2.Cells.Add("") : row2.Cells.Add(myARK.AMMINISTRATORE)


Dim image1 As Aspose.Pdf.Image = New Aspose.Pdf.Image(S)


Dim row3 As Aspose.Pdf.Row

row3 = tab1.Rows.Add() : row3.Cells.Add("") : row3.Cells.Add("") : row3.Cells.Add()

'row3.Cells(2).FitWidth = True

row3.Cells(2).Paragraphs.Add(image1)

image1.ImageInfo.ImageFileType = ImageFileType.Bmp

image1.ImageInfo.Alignment = AlignmentType.Right

image1.ImageInfo.SystemImage = IMG_FIRMA

the image source is a transparent gif stored in a db and write from the app on the disk as gif and then load into a variable as system.drawing.bitmap

if i use

image1.ImageInfo.ImageFileType = ImageFileType.MemoryBmp

i get this error: can't open image file


the error occur while saving the document.


to skip this problem i could write the table on the next section , but to do that i need to know the coordinate of a parapraph.

in the sample attached everything is fine but if i have more data and then 2 page i want to have the last '2 detail row' + the total + the bottom table with images all togheter on the next page

last '2 detail rows' are:

13. 0 - ACQUA 3.000,00
13. 1 Bollette ( 100 %) 3.000,00

+ subtotal row TOTALE € 245.447,00

+ the tablle

regards

Ivano Panichelli

i manage to do it using keepwithnext property, but it would be nice to sort it out in the other way as well.

Regards

Ivano Panichelli

Hello Ivano,

In order to keep '2 detail row' + the total + the bottom table with images all together, its better to add the 2 details rows to the same table containing the image and set the property IsBroken of Table object to False, so that the table is not broken if it reaches the end of the page. If all the contents cannot be accommodated over the single page, the complete table will be moved to next page.

Regarding the image issue, as you've mentioned that the image is stored in DB and after it is retrieved, you save it over the disk. Then I would suggest you to simply access the image file using Image.ImageInfo.File property.

In case I've not properly understood your requirement or you've any further query, please feel free to contact.