The function inserts a web link
onto the current open pdf page.
Typically a PdfWebLink is
created over a picture, in order to create a hyperlink.
The pdf file shown in this
picture is created by the example script
below.
Parameters:
Name |
Type |
Description |
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) |
Width |
Double |
Width of clickable URL area in points |
Height |
Double |
Height of clickable URL area in points |
url |
String |
The parameter URL holds the URL defined as 7 bit ASCII string. A uniform resource locator (URL) is a string that resolves to a
resource on the internet - typically a file that is the destination of a
hypertext link, although it can also resolve to a query or other entity. A
web link opens the standard browser to view the resource by default. |
Returns:
Type |
Value |
Description |
Integer |
-1 or
higher |
Returns 0 or higher if the function succeeds. Returns -1 or a negativer error code 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 |
Create
Seminar Invoice As PDF |
2C3F7F29-A29A-4338-ACF5-51894B709DA5 |
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 '%PdfWebLink%'
Example XojoScript:
If
PdfStart("testfile.pdf")
> 0 Then
// Set coordinate system
to top-left is 0,0
PdfSetPageCoordsTopDown
// Get a new invoice
number from database
Dim inv_no As String = GetinvoiceNumber("OSS-")
// PayPal option
Dim url As String
= "https://www.paypal.com/xclick/"
Dim business As String = "business=oliver.osswald@shopmail.ch"
Dim amount As String
= "&amount=20.00"
Dim currency_code As String = "¤cy_code=EUR"
Dim item_name As String = "&item_name=" + Urlencode("Donation
" + inv_no)
Dim item_number As String = "&item_number="
+ UrlEncode("Item-2016-1")
Dim invoice As String = "&invoice=" + Urlencode(inv_no)
Dim no_note As String = "&no_note=" + "0"
Dim no_shipping As String = "&no_shipping="
+ "1"
// Define Payment Link
url = url + business + amount +
currency_code + item_name + item_number + invoice + no_note + no_shipping
// 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