Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
815
Transparent Images Get A Black Background
posted

Hello,

I am using Infragistics version 15.2.20152.1027.

When I generate PDF documents using the Infragistics.Documents framework, I frequently include JPEG or PNG images with transparent backgrounds. However, sometimes those images are rendered in my PDF with a black background even though the background is supposed to be transparent.

This doesn't happen every time. For example, I could generate one document and the image might have a black background. But then 5 minutes later I could generate the same document and the image would have a transparent background.

Please see my code sample below:

Dim report As Report
Dim section As ISection
Dim table As ITable
Dim row As ITableRow
Dim cell As ITableCell
Dim canvas As ICanvas
Dim img As Image

' set printing options report = New Report()
report.Preferences.Printing.PaperSize = Preferences.Printing.PaperSize.Legal
report.Preferences.Printing.PaperOrientation = PaperOrientation.Portrait

' set section options
section = report.AddSection()
section.PageOrientation = Infragistics.Documents.Reports.Report.PageOrientation.Portrait
section.PageSize = PageSizes.Legal
section.PageMargins.Left = 40
section.PageMargins.Right = 40
section.PageMargins.Top = 30
section.PageMargins.Bottom = 30

table = section.AddTable()
table.Width = New RelativeWidth(100)
row = table.AddRow()
cell = row.AddCell()
cell.Width = New RelativeWidth(100)
cell.Alignment.Horizontal = Alignment.Center
cell.Alignment.Vertical = Alignment.Middle
img = New Image("C:/project/images/logo.jpg")
canvas = cell.AddCanvas()
canvas.Width = New FixedWidth(300)
canvas.Height = New FixedHeight(65)
canvas.DrawImage(img, 0, 0, 300, 65)

' save the PDF document
report.Publish("C:/project/reports/sample_report.pdf", FileFormat.PDF)
Parents
  • 25665
    Offline posted

    Hello,

    Thank you for contacting Infragistics!

    I will investigate this matter to see what may be causing this behavior. Can you please attach the image you are using that reproduces this behavior you so I may use it in creating my own sample to attempt to reproduce this behavior?

Reply Children