Click or drag to resize
Pdf Library for .NET

PdfImageSection Class

Represents an image that can be added to the header or footer templates of a pdf document.
Inheritance Hierarchy
SystemObject
  SelectPdf.UniversalPdfSectionElement
    SelectPdf.UniversalPdfImageSection

Namespace: SelectPdf.Universal
Assembly: SelectPdf.HtmlToPdf.Universal (in SelectPdf.HtmlToPdf.Universal.dll) Version: 26.4
Syntax
public class PdfImageSection : PdfSectionElement

The PdfImageSection type exposes the following members.

Constructors
 NameDescription
Public methodPdfImageSection(Single, Single, Single, Stream) Creates an image object that can be added to the header or footer templates of a pdf document.
Public methodPdfImageSection(Single, Single, Single, String) Creates an image object that can be added to the header or footer templates of a pdf document.
Public methodPdfImageSection(Single, Single, Single, Single, Stream) Creates an image object that can be added to the header or footer templates of a pdf document.
Public methodPdfImageSection(Single, Single, Single, Single, String) Creates an image object that can be added to the header or footer templates of a pdf document.
Top
Properties
 NameDescription
Public propertyHeight Gets or sets the element height, in points, in the destination pdf page.
(Inherited from PdfSectionElement)
Public propertyImageStream Gets the image stream.
Public propertyTransparency Gets or sets the pdf element transparency.
Public propertyWidth Gets or sets the element width, in points, in the destination pdf page.
(Inherited from PdfSectionElement)
Public propertyX Gets or sets the element position on the X axis.
(Inherited from PdfSectionElement)
Public propertyY Gets or sets the element position on the Y axis.
(Inherited from PdfSectionElement)
Top
Remarks
The image can be created from a file path or from a stream. When the destination height is not specified, it is auto-determined from the destination width to preserve the image aspect ratio.
Example
HtmlToPdf converter = new HtmlToPdf();
converter.Options.DisplayHeader = true;
PdfImageSection image = new PdfImageSection(0, 5, 120, "logo.png");
converter.Header.Add(image);
PdfDocument doc = converter.ConvertUrl("https://www.google.com");
doc.Save("out.pdf");
doc.Close();
See Also