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
This function marks the current path as clipping path.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 3.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example |
---|---|---|
The PDF reference returned from DynaPDF.New. | ||
ClipMode | The clipping mode. Can be EvenOdd for using the Even-Odd rule or winding for using the nonzero Winding Number rule. | "winding" |
FillMode | Fill mode. Can be FillNoClose, StrokeNoClose, FillStrokeNoClose, Fill, Stroke, FillStroke, FillEvOdd, FillStrokeEvOdd, FillEvOddNoClose, FillStrokeEvOddNoClose, NoFill or Close. | "fill" |
Returns OK or error.
See also ClipPath function in DynaPDF manual.
Clip image to circle:
# Initialize DynaPDF if needed
If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
Perform Script [ “InitDynaPDF” ]
End If
# Clear current PDF document
Set Variable [ $pdf ; Value: MBS("DynaPDF.New") ]
# Add image on page
Set Variable [ $destPage ; Value: 1 ]
Set Variable [ $r ; Value: MBS("DynaPDF.AppendPage"; $pdf) ]
# no recompression if possible! But if needed, we use JPEG 90%
Set Variable [ $r ; Value: MBS("DynaPDF.SetSaveNewImageFormat"; $pdf; 0) ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetJPEGQuality"; $pdf; 90) ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetCompressionFilter"; $pdf; "jpeg") ]
# Save old state to restore later
Set Variable [ $r ; Value: MBS( "DynaPDF.SaveGraphicState"; $pdf ) ]
# Draw circle for clipping
Set Variable [ $r ; Value: MBS( "DynaPDF.DrawCircle"; $pdf; 260; 220; 100; "nofill" ) ]
Set Variable [ $r ; Value: MBS( "DynaPDF.ClipPath"; $pdf; "Winding"; "fill" ) ]
# Draw clipped image
Set Variable [ $r ; Value: MBS("DynaPDF.InsertImage"; $pdf; Merge PDFs::InputImage; 100; 100; 320; 200) ]
# restore graphics static to get unclipped drawing
Set Variable [ $r ; Value: MBS( "DynaPDF.RestoreGraphicState"; $pdf ) ]
# Close page and store PDF in container
Set Variable [ $r ; Value: MBS("DynaPDF.EndPage"; $pdf) ]
Set Field [ Merge PDFs::FinalPDF ; MBS("DynaPDF.Save"; $pdf; "Merged.pdf") ]
Set Variable [ $r ; Value: MBS("DynaPDF.Release"; $pdf) ]
Created 18th August 2014, last changed 17th January 2019
DynaPDF.Clear - DynaPDF.CloseImportFile
Feedback: Report problem or ask question.