How Print PDF with HyperLink

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Partenaire
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 33
Joined: Tue Apr 17, 2012 9:50 am
Location: SAINT NAZAIRE FRANCE

How Print PDF with HyperLink

Post by Partenaire » Sat Jul 13, 2013 3:30 pm

Hello

I try to print PDF with HyperLink, without succes

I have a lock field "etat" with data

Data are formatted like:

Code TAB Nom TAB Adress TAB Ville
56 Eric rue caboteur ST NAZAIRE
87 Franc rue Midin ST brevin
etc

the textStyle of item 3 "Adress" set to "Link and linktext set to ""http://maps.google.fr/maps?f=q&hl=fr&q=theadresse"

When i click on hyperlink item in field "etat" that work fine

Now i would like have the same result after printing this field in PDF

I use this code for printing

Code: Select all

on mouseUp
   local theResult,thepDF
   ask file "" with type "PDF file|pdf|PDF "
   if it = "" then
      exit mouseUp
   end if
   
   put it into thePDF
   
   put the htmltext of fld "etat" into theResult
   
   --set the fileType to "revoPDF "
   open printing to pdf thePDF
   revPrintField the name of field "etat"
   --revPrintText theResult,"<%pageNumber%> of <%numPages%>","<%pageNumber%> of <%numPages%>",the long id of field "etat" of stack "CDH"
   close printing
   
end mouseUp 
I have a nice PDF with clicked words, but the click don't launch google maps

The dictionary say for command "print link"

"When printing fields, any text that has its linkText property set together with the link textStyle is treated as if a print link command had been executed with the contents of the property as link, and the formattedRect of the text as rectangle."

But no work.... I have a big headache

Thank for yours help to achieve this

Eric

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: How Print PDF with HyperLink

Post by LCNeil » Mon Jul 15, 2013 8:39 am

Dear Eric,

The following LiveCode lesson gives a great example on how to include hyperlinks within your printed PDF

http://lessons.runrev.com/s/lessons/m/4 ... -livecode/

The relevant section that will explain the process is "Creating a document outline"

Kind Regards,

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
--

Partenaire
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 33
Joined: Tue Apr 17, 2012 9:50 am
Location: SAINT NAZAIRE FRANCE

Re: How Print PDF with HyperLink

Post by Partenaire » Sun Jul 21, 2013 4:26 pm

Hi Neil,

Sorry for the late reply, i was not coding last week.

I read this lesson That OK.

I take an other way to achieve my goal

1) the data are in tabbed field like
Item 1 I item 2 I item 3
xox I xoxox I xoxox
--------------------------
xox I xoxox I xoxox
etc....

if i set the item 3 with the hyperLink don't work
ex text of item 3
26 rue des caboteur, ST NAZAIRE and the linkText is http://maps.google.fr/maps?f=q&hl=fr&q= ... NT+NAZAIRE
the linktext is build with function when the data are preparing


if i prepare the data in tabbed field in other order like
Item 1 I item 2 I item 3
thelinktext " hpps://........... here
xox I xoxox I xoxox
--------------------------
thelinktext " hpps://........... here
xox I xoxox I xoxox
etc....

Work very well and now i use a Stack call CDHPrint with this code in button "Print"

Code: Select all

on mouseUp
   local h
   answer "Voulez vous imprimer la liste" with "Non" OR "Oui"
   if it is "non" then
      exit top
   end if
   
   ask "quelle entête" with "Liste du Jour"&& the system date
   if the result is "cancel" then
      exit top
   end if
   local entete
   put it into entete
   put the htmltext of fld "etat" into h
   
   set the htmltext of fld "printtext" of card 1 of stack "CDHPrint" to h
 
   set  tabStops of of fld "printtext" of card 1 of stack "CDHPrint" to the tabStops of fld "etat"
   set vGrid of fld "printtext" of card 1 of stack "CDHPrint" to true
   
   CDHFormatPrintField
   
   revShowPrintDialog false,true
   set the backcolor of the templatecard to "white"
   
  

   revPrintText h ,entete,"page <%pageNumber%> of <%numPages%> imprimé le <%the long system date%> <%the time%>",the long name of field "printText" of stack "CDHPrint"
   set the topleft of stack "CDHPrint" to 142,120
   --put "" into field "printtext"
   
end mouseUp [code/]

I have a PDF List with hyperlink when i click on hppt:// ....and get the google map.
Now i have an other question :

When  i send this PDF on my email and after i open it in IPad  the hyperLink don't work.... strange 

In any case thank for you and alls

Regards

Eric

Post Reply

Return to “Talking LiveCode”