I'm building a table in a pdf that contains 2 columns of images. Each image
has a title and comments.
I've discovered that certain images, if placed in specific side (so far I've
only discovered the left side to be a problem), will not be displayed. No
error is thrown.
For example, for a problem image, if it is in the left side of pdf, it will
not display. If I change its location to the right side, it works fine.
All images have previously been resized to the same diminsions.
What should I be looking for to see why the image is not displaying?
I'm looping through an array of images, and on each one, I'm making a table
that contains the title, comments and then the image itself, in three rows,
1 column. Each of these tables gets added to a main table that will give me
the 2 columns I needed.
My application worked fine for a couple of weeks, but then occaisionally
users were creating pdf with missing pictures. I obtained some of the same
images a user was having problems with was able to recreate the problem.
Here is my code.
//Create table in the pdf to hold imgs, their titles and comments
iTextSharp.text.Table aTable = new iTextSharp.text.Table(1);
aTable.TableFitsPage = true;
aTable.CellsFitPage = true;
aTable.Border = iTextSharp.text.Rectangle.TOP_BORDER |
iTextSharp.text.Rectangle.RIGHT_BORDER |
iTextSharp.text.Rectangle.LEFT_BORDER |
iTextSharp.text.Rectangle.BOTTOM_BORDER;
aTable.BorderColor = new
iTextSharp.text.Color(System.Drawing.Color.White);
aTable.Cellpadding = 0;
aTable.Cellspacing = 0;
if (imgFile.title != "" || imgFile.title != null)
{
//Read the contents of the file
Chunk titleChunk = new Chunk(imgFile.title);
iTextSharp.text.Cell titleCell = new iTextSharp.text.Cell(t);
titleCell.AddElement(titleChunk);
titleCell.VerticalAlignment = 0;
titleCell.Border = iTextSharp.text.Rectangle.TOP_BORDER |
iTextSharp.text.Rectangle.RIGHT_BORDER |
iTextSharp.text.Rectangle.LEFT_BORDER |
iTextSharp.text.Rectangle.BOTTOM_BORDER;
titleCell.BorderColor = new
iTextSharp.text.Color(System.Drawing.Color.White);
aTable.AddCell(titleCell);
}
if (imgFile.comments != "" || imgFile.comments != null)
{
//Read the contents of the file
//TextReader commentReader = new
StreamReader(imgTitles[index].ToString());
Chunk commentChunk = new Chunk(imgFile.comments);
iTextSharp.text.Cell commentsCell = new iTextSharp.text.Cell(c);
commentsCell.AddElement(commentChunk);
commentsCell.Border = iTextSharp.text.Rectangle.TOP_BORDER |
iTextSharp.text.Rectangle.RIGHT_BORDER |
iTextSharp.text.Rectangle.LEFT_BORDER |
iTextSharp.text.Rectangle.BOTTOM_BORDER;
commentsCell.BorderColor = new
iTextSharp.text.Color(System.Drawing.Color.White);
//commentReader.Close();
aTable.AddCell(commentsCell);
}
//Add the image the the table
iTextSharp.text.Cell imgCell = new iTextSharp.text.Cell(img);
imgCell.BorderColor = new
iTextSharp.text.Color(System.Drawing.Color.White);
imgCell.Border = iTextSharp.text.Rectangle.TOP_BORDER |
iTextSharp.text.Rectangle.RIGHT_BORDER |
iTextSharp.text.Rectangle.LEFT_BORDER |
iTextSharp.text.Rectangle.BOTTOM_BORDER;
aTable.AddCell(imgCell);
mainTable.InsertTable(aTable);
Thanks. If I can provide any more inforation, please let me know.
--
Sent from the iText - General forum at Nabble.com.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions