Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
Statistic
FMM
Blog
Replaces an image with another image.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 7.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
The PDF reference returned from DynaPDF.New. | |||
ImageIndex | The index of the image to replace. From 0 to DynaPDF.GetImageCount-1. |
$index | |
Image | The new image. Can be container or native file path. |
Images::ImageContainer | |
ImageIndex | The index of the image. This is for a multi picture tiff file to pick the image. Default is 1 for first image. |
1 | Optional |
Colorspace | The color space to use. Can be DeviceRGB, DeviceCMYK, DeviceGray, CalGray, CalRGB, Lab, ICCBased, Pattern, Indexed, Separation, DeviceN or NChannel. Default is DeviceRGB. |
"DeviceRGB" | Optional |
ColorSpaceHandle | The color space handle. Can be empty if you want to use device colorspace. |
"" | Optional |
Flags | The flags. Can be number or text with various flags. Can be set to DeleteAltImages, DeleteMetadata, DeleteOCG and/or DeleteSoftMask. |
"DeleteAltImages¶DeleteMetadata" | Optional |
Returns OK or error.
See also ReplaceImage function in DynaPDF manual.
Replace image:
# Initialize DynaPDF if needed
If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
Perform Script [ “InitDynaPDF” ]
End If
# Start new PDF session
Set Variable [ $pdf ; Value: MBS("DynaPDF.New") ]
# Import pages
Set Variable [ $r ; Value: MBS("DynaPDF.OpenPDFFromContainer"; $pdf; Replace Image::Input PDF) ]
Set Variable [ $r ; Value: MBS("DynaPDF.ImportPDFFile"; $pdf; 1) ]
# Replace Image
Set Variable [ $r ; Value: MBS("DynaPDF.ReplaceImage"; $pdf; 0; Replace Image::New Image) ]
# Save PDF
Set Field [ Replace Image::Output PDF ; MBS("DynaPDF.Save"; $pdf) ]
# Cleanup
Set Variable [ $r ; Value: MBS( "DynaPDF.Release"; $pdf ) ]
Created 30th September 2017, last changed 15th September 2020
DynaPDF.RenderPage - DynaPDF.ReplacePattern
Feedback: Report problem or ask question.