Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.4   7.5   8.0   8.1   8.2   8.3   8.4   8.5   9.0   9.1    Statistic  


The function inserts an image from a container.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
DynaPDF 3.1 Yes Yes Yes Yes Yes
MBS( "DynaPDF.InsertImage"; PDF; Container; PosX; PosY; ScaleWidth; ScaleHeight { ; Index } )   More


Parameter Description Example value
PDF The PDF reference returned from DynaPDF.New. $pdf
Container The image container value. Pass the container field or a variable with the container content. $image
PosX The X position (from left of page) 0
PosY The Y position (from bottom of page) 0
ScaleWidth The scaled width of the image. $width
ScaleHeight The scaled height of the image. $height
Index Optional
The index of the image for multi image files.


Returns image handle number or error message.


The function inserts an image from a container.
Same as DynaPDF.InsertImageFile, but reading from container. A specific image of a multi-page image can be selected with the parameter Index; the first image is denoted by the index 1. If the image file is not a multi-page image, the parameter Index is ignored. To determine the number of images stored in an image file use the function DynaPDF.GetImageCount. The usage of the function is described in detail at DynaPDF.InsertImageFile.
See also pdfInsertImage in dynapdf manual.

Please use DynaPDF.SetCompressionFilter to define the compression of your images. Use "flate" there for no jpeg compression. Use DynaPDF.SetJPEGQuality to define JPEG compression quality. also use DynaPDF.SetSaveNewImageFormat with parameter 0 to embed JPEGs to PDF without recompression. Also you should turn off transparency by key color using DynaPDF.SetUseTransparency.
You can use DynaPDF.SetAlpha to set fill transparency to affect how images gain extra transparency.

Coordinates in PDF are by default in a 72dpi raster with lower left being 0/0 point. You can query page size by DynaPDF.GetPageWidth and DynaPDF.GetPageHeight functions.


Set a few options and insert image from file:

MBS( "DynaPDF.SetCompressionFilter"; $PDF; "flate" )
MBS( "DynaPDF.SetSaveNewImageFormat"; $PDF; 0 )
MBS( "DynaPDF.SetResolution"; $PDF; 300 )
MBS( "DynaPDF.SetUseTransparency"; $PDF; 0 )
MBS( "DynaPDF.InsertImage"; $PDF; MyDatabase::ImageContainer; 72; 72; 300; 200; 1 )

Insert and reduce qualty to save space:

MBS( "DynaPDF.SetJPEGQuality"; $PDF; 75 )
MBS( "DynaPDF.SetCompressionFilter"; $PDF; "jpeg" )
MBS( "DynaPDF.SetSaveNewImageFormat"; $PDF; 1 )
MBS( "DynaPDF.SetResolution"; $PDF; 100 )
MBS( "DynaPDF.SetUseTransparency"; $PDF; 0 )
MBS( "DynaPDF.InsertImage"; $PDF; MyDatabase::ImageContainer; 72; 72; 300; 200; 1 )

See also

Example Databases

Blog Entries

Created 18th August 2014, last changed 1st February 2015

DynaPDF.InsertBookmarkEx   -   DynaPDF.InsertImageFile

Feedback: Report problem or ask question.

MBS Xojo tutorial videos