Image formatting issues


#1

We have an application that saves various text to a database, and the user can save gif or jpg files to the filesystem.

We use aspose.pdf to write out the text in somewhat complex tables. We are also writing out any images in a simple table at the bottom of the text. The textual portion of the report can run 3-5 pages long, we'd like to put the images at the bottom, one page for each image.

If we have no images, the report is fine. If we have 1 image that is a pretty simple gif, its embedded nicely into the report. However, if the image is complete .jpg, it tends to hang up the site. The image size tends to be around 500x500 pixels. Eventually we can forsee embedding as many as 6 images, some very simple, most in some degree of complexity.

What way can we embed images into our reports with the greatest chance of them being displayed in the report correctly?

Thank you


#2

Dear northop_grumman,

Could you provide us resources including the codes and images that can reproduce the error?

We will investigate this issue and respond you quickly.

Regards,


#3

There isnt an error message to show, the page just hangs and times out. Below is the code.

if (al.Count>0) // iterate through arraylist of attachments in AttachmentForReport class
{
foreach (AttachmentForReport aft in al)
{

// each attachment is placed in a new table instance
Aspose.Pdf.Table tbl1 = new Aspose.Pdf.Table();
S1.Paragraphs.Add(tbl1); // S1 defined above
this.SetTableParameters(eReportIdentifier.Rpt831, tbl1, "900");

Row tbl1r1 = tbl1.Rows.Add();
this.CellBuilder(S1, tbl1r1 , aft.FormattedFullFileName, aft.DisplayText,aft.FileExtension);
}

}

public void CellBuilder(Aspose.Pdf.Section pdfSection, Aspose.Pdf.Row pdfTabRow, string imageFile,string imageTitle,string fileExtension)
{
Aspose.Pdf.ImageFileType ift = ImageFileType.Unknown;
if (fileExtension == "GIF")
ift = ImageFileType.Gif;
else if (fileExtension == "JPG")
ift = ImageFileType.Jpeg;
Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();
Cell tblRowCell = pdfTabRow.Cells.Add();
tblRowCell.Border = new BorderInfo((int)BorderSide.All, 0.5F);
Text tblRowCellText = new Text(pdfSection);
tblRowCell.Paragraphs.Add(image1);
image1.ImageInfo.Title = imageTitle;
image1.ImageInfo.File = imageFile;
image1.ImageInfo.ImageFileType = ift;
}

public void SetTableParameters(eReportIdentifier eRid, Aspose.Pdf.Table pdfTable, string columnWidths)
{
pdfTable.ColumnWidths = columnWidths;
pdfTable.Margin.Left = 4F;
if (eRid == eReportIdentifier.Rpt835HeaderRow1)
{
pdfTable.DefaultCellPadding.Top = 3F;
}
pdfTable.DefaultCellPadding.Bottom = 3F;
pdfTable.DefaultCellPadding.Left = 3F;
pdfTable.DefaultCellPadding.Right = 3F;
}


#4

Dear northrop_grumman,

The codes above looks correct. Could you provide the jpg files that can reproduce the same error at kevin.zuo@aspose.com?

Regards,