Insert a
picture from the template folder on a pdf page.
If the coordinate
system is bottom-up the point X, Y defines the lower left corner of the
bounding rectangle.
If the
coordinate system is top-down it defines the upper left corner.
Parameters:
Name |
Type |
Description |
picName |
String |
The name of
a pdf file which exists in the templates folder. To add or
remove template files, select New
Template Manager from menu Script |
X |
Double |
Position
from Left in points |
Y |
Double |
Position
from Top in points (If PdfSetPageCoordsTopDown is set) Position
from Bottom in points (If PdfSetPageCoordsBottomUp is
set) |
ScaleWidth |
Double |
Width of
picture in points |
ScaleHeight |
Double |
Height of
picture in points |
Returns:
Type |
Value |
Description |
Integer |
-1 or
higher |
Returns 0 or higher if the picture has been
inserted to a pdf page. Returns -1 upon failure |
Available
in:
WindowMain |
WindowLink |
YES |
YES |
Used in:
XojoScript
Name |
GUID |
Create
Seminar Invoice With Slip As PDF |
739DA58E-17EE-41CE-BB54-E7362CFE17D4 |
Hint: You can
find references to XojoScripts which make use of this function by sending the
following SQL statement to the database:
Select id,GUID, ScriptName,ScriptCode from
im_scripts where ScriptCode Like '%PdfInsertPicture%'
Example
XojoScript:
If
PdfStart("testfile.pdf")
> 0 Then
// Set coordinate system
to top-left is 0,0
PdfSetPageCoordsTopDown
// Define Link
Dim url As String = "https://www.seminar.pro"
// Define size and position
of button
Dim Factor As Double = 0.66 // Resizing factor
Dim btnWidth As Double = 150.0 *
Factor //
Original Width: 150.0
Dim btnHeight As Double = 52.0 * Factor
// Original Height: 52.0
Dim btnLeft As
Double = 30.0
Dim btnTop As
Double = 30.0
// Color of weblink
Dim colorstring As String = "&cFFFFFF00"
Call PdfSetStrokeColor(colorstring)
Call PdfSetFillColor(colorstring)
// Add a picture from
templates folder
Call PdfInsertPicture("PayPalE.png",btnLeft,btnTop,btnWidth,btnHeight)
// Create a weblink on
the picture
Call PdfWebLink(btnLeft,btnTop,btnWidth,btnHeight,url)
// Finalize PDF
Call PdfCloseFile
// Show it to the user
Call Pdflaunch
End
If