我创建了一个 PDF,但图像出现在页面的中间,我无法弄清楚如何将图像和文本单元格对齐到页面的左侧。
这是我的代码
PdfWriter.GetInstance(mydoc, New FileStream(filename, FileMode.Create))
mydoc.Open()
Dim titleTable As New Table(2, 1)
titleTable.Border = 0
titleTable.BorderWidth = 0
titleTable.Cellpadding = 3
titleTable.SetWidths({20, 80})
titleTable.DefaultCellBorder = iTextSharp.text.Rectangle.NO_BORDER
titleTable.TableFitsPage = True
Dim myCell As Cell
'add impero logo
Dim imperoImage As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(GetBytesForImage(<my image>))
imperoImage.ScalePercent(15)
myCell = New iTextSharp.text.Cell(imperoImage)
myCell.SetHorizontalAlignment(Cell.ALIGN_LEFT)
titleTable.AddCell(myCell)
'title
Dim myChunk As New iTextSharp.text.Chunk(ImperoClientApp.LanguageResources.GetPhrase("some text", Nothing), _
iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 16, iTextSharp.text.Font.BOLD, New iTextSharp.text.Color(0, 0, 0)))
myCell = New iTextSharp.text.Cell(myChunk)
myCell.VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE
titleTable.AddCell(myCell)
mydoc.Add(titleTable)