Skip to content

ImageConverter

ImageConverter is the BaseConverter subclass selected by ConverterFactory for .gif/.jpg/.jpeg/.png source files. It produces exactly one output page per source image and stretches the image to fill the entire page frame, with no cropping or aspect-ratio preservation logic.

Purpose

  • Convert a single raster image to a single-page PDF (BR-SFC-003, BR-SFC-016).
  • Stretch the source image to fill the full output page frame (BR-SFC-017).
  • Identify itself to ConverterFactory and downstream consumers as the Image conversion type.

Context

  • Namespace: PdfAPI.SyncFusionCore
  • Assembly/package: PdfAPI.SyncFusionCore (Pdf.Local.Client NuGet package)

Public members

Member Signature Purpose
ImageConverter ImageConverter() Creates a ready-to-use ImageConverter instance for ConverterFactory to invoke against raster image source documents (.gif/.jpg/.jpeg/.png); the constructor body is empty*, so no state is established beyond the base type's fields.
ConversionType override SourceConversionType ConversionType { get; } Returns SourceConversionType.Image, identifying this converter's source format to ConverterFactory and to the assembled PdfResult.

Inherited public members

Members in this section are inherited from BaseConverter in PdfAPI.SyncFusionCore. They are available on this type through inheritance.

Member Signature Purpose Origin
Convert PdfResult Convert(Stream stream, ConvertRequest request) Executes the full conversion: times the operation, invokes ConfigureConverter and ConvertItem, and assembles a PdfResult with Status, Elapsed, and PdfProcessorType = Syncfusion; captures rather than propagates conversion exceptions (BR-SFC-006, BR-SFC-010). PdfAPI.SyncFusionCore — BaseConverter

Behavioral notes

  • Because the image is stretched to the full page frame rather than fit with letterboxing, an image whose aspect ratio differs from the target page will appear distorted in the output PDF (BR-SFC-017).
  • A conversion failure is captured by the inherited Convert method and reported through the result rather than thrown (BR-SFC-010).

Constraints and usage notes

  • Not intended to be constructed directly by application code; ConverterFactory constructs and invokes it based on the source file extension.
  • Only single-frame images are supported by this converter; multi-frame TIFF images are handled by TiffConverter instead.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

Sources

  • PdfApi.SyncFusionCore\Convert\ImageConverter.cs