Hi,
I am pretty new to this PDF software. I was trying to load an image and put some text besides it in a Table row. I managed to get the text shown, but not the image
Can you take a quick look at the follow code, and let me know if I miss something (The Image URL, I test it in the IE, I can see it from browser so Image is there in my localhost)
Another notes, can you also give me a hint how to decide BitPerComponent and Component? I check my gif the only info I can get (right click on file–>properties) is BitPerPiexl=24. Did I set them right in the following code? Thanks
Attached code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim strLicFile As String
strLicFile = Server.MapPath(“bin”) & “/” & “Aspose.Pdf.lic”
Dim apdf As Pdf = New Pdf(strLicFile, Me)
apdf.Security = New Security
apdf.Security.IsCopyingAllowed = False
apdf.PageSetup.PageHeight = PageSize.LetterHeight
apdf.PageSetup.PageWidth = PageSize.LetterWidth
Dim aPageMargin As New MarginInfo
aPageMargin.Top = 20
aPageMargin.Left = 30
aPageMargin.Right = 30
aPageMargin.Bottom = 20
apdf.PageSetup.Margin = aPageMargin
Select Case Request.QueryString(“type”)
Case 1
Dim Headsection As Section = New Section(apdf)
apdf.Sections.Add(Headsection)
'now we add the table
Dim HeadTable As New Aspose.Pdf.Table
Headsection.Paragraphs.Add(HeadTable)
Dim HeadRow As New Aspose.Pdf.Row(HeadTable)
HeadTable.Rows.Add(HeadRow)
Dim LogoCell As New Aspose.Pdf.Cell(HeadTable)
HeadRow.Cells.Add(LogoCell)
Dim HeadTextCell As New Aspose.Pdf.Cell(HeadTable)
HeadRow.Cells.Add(HeadTextCell)
Dim LogoImage As New Aspose.Pdf.Image(Headsection)
LogoCell.Paragraphs.Add(LogoImage)
LogoImage.ImageInfo.File =“http://localhost/agpclite/images/mainlogo.jpg”
LogoImage.ImageInfo.ImageFileType=ImageFileType.Jpeg
LogoImage.ImageInfo.OpenType = ImageOpenType.Url
LogoImage.ImageWidth = 400
LogoImage.ImageHeight = 230
LogoImage.ImageInfo.BitsPerComponent = 8
LogoImage.ImageInfo.ComponentNumber = 3
Dim HeadText As New Text(Headsection)
Dim HeadTextSegment As New Segment(HeadText)
HeadText.Segments.Add(HeadTextSegment)
HeadTextSegment.Content = “my text”
HeadTextCell.Paragraphs.Add(HeadText)
'Dim text1 As Text = New Text(Headsection)
'text1.Margin.Top = 21
'section.Paragraphs.Add(text1)
'Dim segment1 As Segment = New Segment(text1)
'text1.Segments.Add(segment1)
'segment1.Content = “Centrilift - a Baker Hughes Company”
'Dim segment2 As Segment = New Segment(text1)
'text1.Segments.Add(segment2)
'segment2.Content = “. We are currently working on this report. Coming soon.”
apdf.Save(Response)
Response.End()
Case 2
Case 3
Case 4
End Select
End Sub