Displaying images with transparency in Adobe Acrobat

2018-04-04

Images with transparency are often called images with an alpha channel. What does this mean? The alpha channel contains information about partial or full transparency of the image. It is mainly used in computer animation. RGB images can have up to 24 alpha channels. Each of them contains information about the transparency of a part of the image. Managing these channels can make parts of the image transparent at the right time. This creates an animation effect.

The most common raster formats of images with support for transparency:

  • PSD - the native format of Adobe Photoshop. Supports full and partial transparency;
  • TIFF - most often used to store scanned images, because it allows you to store information about the great depth of color. This quality has made the format of tiff popular in printing. Supports partial and full transparency;
  • GIF - this format is most popular in the Web graphics, because the file has a very small size. Allows you to store information about full transparency only. That is, you can not make a semi-transparent image;
  • PNG is also common in Web graphics, but the file is larger and supports translucency.

 

In this article, we'll look at how to turn off the support for translucency when exporting the FastReport .NET report to PDF. This can be done from the application code:

Report report = new Report();

report.Load("@/../../Transparency.frx");

PDFExport export = new PDFExport();

export.TransparentImages = false;

report.Prepare();

report.Export(export, "result.pdf");

As you can see from the code, PDF export has a TransparentImages property that allows you to disable (false) or enable (true) transparency support.

Three report objects are represented as a picture when exporting to PDF: Picture, RichText and Chart. The TransparentImages property works for all of them.

And now I propose to see how these objects will look like with the TransparentImages property turned on and off.

Export Image

The original image in png format does not have a background:


Now add the Picture object to the band and load this picture into it.

A colored background is set for the band.

As you can see, the red tint is noticeable on the background of the image, it means the picture has a transparent background.

Let's see how the export of this report to the PDF format will look like with the value of the TransparentImages = ture property:

Just like in the designer.

And now, install TransparentImages = false:

The transparent background of the picture is now painted in white.

RichText Export

Let's see how RichText looks like with a transparent background:

Although the object has a transparent background, but you cannot get rid of the white substrate for the text.

Set the property TransparentImages = false:

The background is painted white. Given that the white substrate text cannot be removed, for RichText the TransparentImages property is not very useful.

Export Chart object

The Chart object has many background settings. To get a transparent background of the object, you need to set the following settings in the object properties:

  • BackColor = Transparent;
  • BorderSkin(SkinStyle) = None;
  • BorderLineColor = Transparent;
    • Open the Legends collection, select the legend and set TitleBackColor = Transparent for the title.
    • Open the ChartAreas collection, select an entry, and set the value of Transparent to BackColor.

Here's a chart:

 

When exporting to PDF with the value of the property TransparentImages = true, the chart looks the same as in the picture above.

And if you set TransparentImages = false, you get a white background:

12. August 2024

Erstellen und Installieren des Postgres-Plugins in FastReport .NET

In diesem Artikel wird beschrieben, wie Sie mit dem FastReport .NET-Plugin für den Berichtsdesigner aus Visual Studio über den NuGet-Server eine Verbindung zur Datenbank herstellen.
8. August 2024

Installation von FastReport .NET und ihren Komponenten unter Windows

Schritt für Schritt Anleitung zur Online- und manuellen Installation über den Registrierungscode FastReport .NET und seine Komponenten in Windows.
26. Juli 2024

Aktualisierung von HTMLObject als Plugin für FastReport .NET

Ausführliche Anleitung zur Verwendung des neuen HTMLObject-Plugins, das die Aufteilung des HTML-Doms in FastReport-Berichtsobjekte verwendet.
Fast Reports
  • 800-985-8986 (Englisch, die USA)
  • +4930568373928 (Deutsch)
  • +55 19 98147-8148 (Portugiesisch)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314

© 1998-2024 Fast Reports Inc.