Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

DynaPDF.GetImageCount

Queries number of images in PDF.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 6.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.GetImageCount"; PDF )   More

Parameters

Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $pdf

Result

Returns number or error.

Description

Queries number of images in PDF.
Returns the number of image objects which were loaded with DynaPDF functions or imported from external PDF files. This does not include inline images.
The images can be accessed with DynaPDF.GetImage.
If you need to write all files to disk, you can use DynaPDF.ExtractImages or use DynaPDF.ListImages to list them all with details.

See also GetImageCount function in DynaPDF manual.

Examples

Loop and get all images in various formats:

Go to Layout [ “Start” (Start) ; Animation: None ]
Set Variable [ $pdf ; Value: MBS("DynaPDF.New") ]
# Load PDF from container
Set Variable [ $r ; Value: MBS("DynaPDF.OpenPDFFromContainer"; $pdf; Start::SourcePDF) ]
Set Variable [ $r ; Value: MBS("DynaPDF.ImportPDFFile"; $pdf) ]
# Put result in records
Go to Layout [ “List” (List) ; Animation: None ]
Delete All Records [ With dialog: Off ]
Set Variable [ $imageCount ; Value: MBS( "DynaPDF.GetImageCount"; $PDF ) ]
Set Variable [ $imageIndex ; Value: 0 ]
If [ $imageCount > 0 ]
    Loop
        New Record/Request
        Set Field [ List::Index ; $imageIndex ]
        Set Field [ List::Image ; MBS("DynaPDF.GetImage"; $pdf; $ImageIndex; "Picture"; ""; "") ]
        Set Field [ List::JPEG ; MBS("DynaPDF.GetImage"; $pdf; $ImageIndex; "Picture"; "test.jpg"; "JPEG") ]
        Set Field [ List::BMP ; MBS("DynaPDF.GetImage"; $pdf; $ImageIndex; "Picture"; "test.bmp"; "BMP") ]
        Set Field [ List::PNG ; MBS("DynaPDF.GetImage"; $pdf; $ImageIndex; "Picture"; "test.png"; "PNG") ]
        Set Field [ List::TIFF ; MBS("DynaPDF.GetImage"; $pdf; $ImageIndex; "Picture"; "test.tif"; "TIFF") ]
        Commit Records/Requests [ With dialog: On ]
        Set Variable [ $imageIndex ; Value: $imageIndex + 1 ]
        Exit Loop If [ $imageIndex >= $imageCount ]
    End Loop
End If
Set Variable [ $r ; Value: MBS("DynaPDF.Release"; $pdf) ]

See also

Example Databases

Blog Entries

This function checks for a license.

Created 5th August 2016, last changed 9th November 2021


DynaPDF.GetImageContainerCount - DynaPDF.GetImageFileCount