Table of Contents

Method ReplaceWith

Namespace
BitMiracle.Docotic.Pdf
Assembly
BitMiracle.Docotic.Pdf.dll

ReplaceWith(Stream)

Replaces image with the image in the stream.

public void ReplaceWith(Stream imageStream)

Parameters

imageStream Stream

The stream with an image.

Remarks

This method replaces all occurrences of the image within the document. If the original image was used on several pages, then the new image will be used in the same places of the same pages.

The stream should contain a complete image encoded with one of the supported image compression schemes. This method won't work with only raster bytes or any other partial contents.

This method throws UnsupportedImageException when used on an inline image. You can check IsInline property before invoking this method.

Replacing an image can cause unexpected and/or unpleasant visual results. For example, image masking effects can be broken if you replace a mask image or an image that has a mask. Usually, it is undesirable to replace an image with a new image that has very different size and/or proportions.

ReplaceWith(string)

Replaces image with the image in the file.

public void ReplaceWith(string imageFile)

Parameters

imageFile string

The name of the image file.

Remarks

This method replaces all occurrences of the image within the document. If the original image was used on several pages, then the new image will be used in the same places of the same pages.

The file should contain a complete image encoded with one of the supported image compression schemes. This method won't work with only raster bytes or any other partial contents.

This method throws UnsupportedImageException when used on an inline image. You can check IsInline property before invoking this method.

Replacing an image can cause unexpected and/or unpleasant visual results. For example, image masking effects can be broken if you replace a mask image or an image that has a mask. Usually, it is undesirable to replace an image with a new image that has very different size and/or proportions.

ReplaceWith(byte[])

Replaces image with the image bytes.

public void ReplaceWith(byte[] imageBytes)

Parameters

imageBytes byte[]

The array of image bytes.

Remarks

This method replaces all occurrences of the image within the document. If the original image was used on several pages, then the new image will be used in the same places of the same pages.

The array should contain a complete image encoded with one of the supported image compression schemes. This method won't work with only raster bytes or any other partial contents.

This method throws UnsupportedImageException when used on an inline image. You can check IsInline property before invoking this method.

Replacing an image can cause unexpected and/or unpleasant visual results. For example, image masking effects can be broken if you replace a mask image or an image that has a mask. Usually, it is undesirable to replace an image with a new image that has very different size and/or proportions.