Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
DynaPDF.InsertImageFile
The function inserts an image from a file.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 3.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
The PDF reference returned from DynaPDF.New. | |||
FilePath | The native file path to the image file. | $path | |
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 | The index of the image for multi image files. | 1 | Optional |
Result
Returns image handle number or error message.
Description
The function inserts an image from a file.The parameter Index specifies the image index of a multi- page image. The first image index is denoted by 1. If the image file is not a multi-page image, the parameter Index will be ignored. To determine the number of images stored in an image file call the function DynaPDF.GetImageCount.
Positions and sizes are in PDF coordinates which normally is 72 dpi.
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.
See also InsertImageFile function in DynaPDF manual.
Examples
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.InsertImageFile"; $PDF; "C:\test.jpg"; 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.InsertImageFile"; $PDF; "C:\test.jpg"; 72; 72; 300; 200; 1 )
See also
- DynaPDF.AppendImagePages
- DynaPDF.GetPageHeight
- DynaPDF.GetPageWidth
- DynaPDF.InsertImage
- DynaPDF.InsertMetafile
- DynaPDF.New
- DynaPDF.SetAlpha
- DynaPDF.SetJPEGQuality
- DynaPDF.SetResolution
- DynaPDF.SetUseTransparency
Release notes
- Version 7.2
- Fixed a bug with DynaPDF.InsertImageFile.
Example Databases
Blog Entries
- DynaPDF graphics flags
- Things you can do with DynaPDF
- MBS FileMaker Plugin, version 7.2pr1
- MBS FileMaker Plugin, version 5.0pr10
FileMaker Magazin
This function checks for a license.
Created 18th August 2014, last changed 2nd September 2022