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
The function retrieves the most important properties of an image file.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 3.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
The PDF reference returned from DynaPDF.New. | |||
Container | The image container value. Pass the container field or a variable with the container content. | $image | |
Index | The index of the image for multi image files. | 1 | Optional |
Returns image format or error message.
Place an image centered on the page with border:
Set Variable [ $r ; Value: MBS("DynaPDF.AppendPage"; $pdf) ]
# put a background in
Set Variable [ $r ; Value: MBS("DynaPDF.SetFillColor"; $pdf; ,8; ,8; ,8) ]
Set Variable [ $r ; Value: MBS("DynaPDF.Rectangle"; $pdf; 0; 0; MBS( "DynaPDF.GetPageWidth"; $PDF ); MBS( "DynaPDF.GetPageHeight"; $PDF ); "fill") ]
# options for saving image
Set Variable [ $r ; Value: MBS("DynaPDF.SetSaveNewImageFormat"; $pdf; 0) ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetResolution"; $pdf; 300) ]
# read size of image
Set Variable [ $r ; Value: MBS("DynaPDF.ReadImageFormat"; $pdf; Merge PDFs::InputImage) ]
Set Variable [ $ImageWidth ; Value: GetAsNumber (LeftValues ( $r ; 1 )) ]
Set Variable [ $imageHeight ; Value: GetAsNumber (MiddleValues ( $r ; 2; 1 )) ]
# The destination area where to put PDF
Set Variable [ $TargetX ; Value: 50 ]
Set Variable [ $TargetY ; Value: 50 ]
Set Variable [ $TargetWidth ; Value: MBS( "DynaPDF.GetPageWidth"; $PDF ) - 100 ]
Set Variable [ $TargetHeight ; Value: MBS( "DynaPDF.GetPageHeight"; $PDF ) - 100 ]
# calculate scale factor
Set Variable [ $factor ; Value: Min( $TargetHeight / $ImageHeight; $TargetWidth / $ImageWidth) ]
# calculate output size
Set Variable [ $DestWidth ; Value: $ImageWidth * $factor ]
Set Variable [ $DestHeight ; Value: $ImageHeight * $factor ]
# Center in target area
Set Variable [ $DestX ; Value: $TargetX + ($TargetWidth-$DestWidth) / 2 ]
Set Variable [ $DestY ; Value: $TargetY + ($TargetHeight-$DestHeight) / 2 ]
# insert the image
Set Variable [ $r ; Value: MBS("DynaPDF.InsertImage"; $pdf; Merge PDFs::InputImage; $DestX; $DestY; $DestWidth; $DestHeight) ]
# close page and move to next record
Set Variable [ $r ; Value: MBS("DynaPDF.EndPage"; $pdf) ]
Created 18th August 2014, last changed 2nd December 2019
DynaPDF.RGB - DynaPDF.ReadImageResolution
Feedback: Report problem or ask question.