IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Topic Options
#57763 - 11/24/20 01:29 PM Hyperlink in PDF suddenly stopped generating
rdaneel72 Offline
OL Toddler

Registered: 02/25/08
Posts: 34
We produce PDF e-stmts for a water utility company using PPDesign7 and PPWorkflow, which include a hyperlink to access an online payment system.

We have used this form and process for many, many years, but earlier this month the hyperlink in the output PDF no longer functions. Neither the PPDesign form nor the Workflow process has been edited recently, and I can think of no reason why this process has suddenly stopped working.

The global function to create the hyperlink follows:

function @ShowHyperlink(&sText:string, &sLink:string)
%---------------------------------------------------------
% Function that shows a hyperlink in PDF. -
%---------------------------------------------------------
% Input: &Text Text to show. -
% &Link Link to open when the text is clicked.-
% Uses: None. -
%---------------------------------------------------------
% Written by: Marty Jacques, Objectif Lune -
% Last updated: December 17, 2007 -
%---------------------------------------------------------
% Show the text
moveto(0,0)
show(&sText)
% Create the link region (same width as text, 0.25" height)
passthrough('/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse')
passthrough('[ /Rect [0 -0.200 '+FloatToStr(StringWidth(&sText))+' 0.20]')
passthrough('/Border [0 0 0]')
passthrough('/Color [0 0 0]')
passthrough('/MK << /BC [ 0 0 0 ] % border color in rgb')
passthrough(' >>')
passthrough('/Action << /Subtype /URI /URI ('+&sLink+') >>')
passthrough('/Subtype /Link')
passthrough('/ANN pdfmark')
endfunction()


And the code to call the function is a simple PP talk object:

moveto(0,0)

@ShowHyperlink('Click Here','https://eps.mvpbanking.com/cgi-bin/login.pl?access=51173771')


The Workflow process uses PPImage to create the PDFs, and until earlier this month, this process has been automatic, with no issues.

Please let me know if there is any further information you might require. Any insight into this problem would be greatly appreciated.

Thank you,

Mike Reilly

Top
#57765 - 11/24/20 04:55 PM Re: Hyperlink in PDF suddenly stopped generating [Re: rdaneel72]
RobertOtis Offline
OL User

Registered: 08/26/13
Posts: 90
Loc: Montreal,Quebec
Dear rdaneel72,

You must use this 2 fonctions in order for this to work. this first fonction @InitPDFMark

Quote:
function @InitPDFMark()
%---------------------------------------------------------
% Function that initializes the PDF Mark features. -
% -
% IMPORTANT: -
% ---------- -
% - This function must be called only once, in the -
% documents's "PressTalk Before" section. -
% - The functions in this library were designed -
% specifically for version 7 of the PlanetPress Suite -
% and might not work with previous or future versions. -
%---------------------------------------------------------
% Input: None. -
% Output: None. -
% Uses: None (no dependency). -
%---------------------------------------------------------
% Written by: Marty Jacques, Objectif Lune -
% Change log: -
% Created: October 29, 2009 -
%---------------------------------------------------------
% Set __pdfMark__ true if pdfmark is already defined
%%BeginPDFMarkPrefix
passthrough('~/pdfmark where {')
passthrough('~pop')
passthrough('~/__pdfMark__ true def')
passthrough('~}{')
passthrough('~/pdfmark {cleartomark} def')
passthrough('~/__pdfMark__ false def')
passthrough('~} ifelse')
%%EndPDFMarkPrefix

%%AcroForm Begin
passthrough('~[/BBox [0 0 100 100] /_objdef {Check} /BP pdfmark')
passthrough('~__pdfMark__ {')
passthrough('~0 0 1 setrgbcolor /ZapfDingbats 119 selectfont 0 7 moveto (4)')
passthrough('~show')
passthrough('~} if')
passthrough('~[/EP pdfmark')

passthrough('~[/BBox [0 0 100 100] /_objdef {Cross} /BP pdfmark')
passthrough('~__pdfMark__ {')
passthrough('~0 0 1 setrgbcolor /ZapfDingbats 119 selectfont 9.7 7.3 moveto')
passthrough('~(8) show')
passthrough('~} if')
passthrough('~[/EP pdfmark')

% Up/Down button appearances
passthrough('~[/BBox [0 0 200 100] /_objdef {Up} /BP pdfmark')
passthrough('~__pdfMark__ {')
passthrough('~0.3 setgray 0 0 200 100 rectfill 1 setgray 2 2 moveto 2 98')
passthrough('~lineto 198 98 lineto 196 96 lineto 4 96 lineto 4 4 lineto fill 0.34 setgray 198 98')
passthrough('~moveto 198 2 lineto')
passthrough('~2 2 lineto 4 4 lineto 196 4 lineto 196 96 lineto fill')
passthrough('~0 setgray 8 22.5 moveto 1 0 0 setrgbcolor /Helvetica 72')
passthrough('~selectfont ( Up) show')
passthrough('~} if')
passthrough('~[/EP pdfmark')

passthrough('~[/BBox [0 0 200 100] /_objdef {Down} /BP pdfmark')
passthrough('~__pdfMark__ {')
passthrough('~0.7 setgray 0 0 200 100 rectfill 1 setgray 2 2 moveto 2 98')
passthrough('~lineto 198 98 lineto')
passthrough('~196 96 lineto 4 96 lineto 4 4 lineto fill 0.34 setgray 198 98')
passthrough('~moveto 198 2 lineto')
passthrough('~2 2 lineto 4 4 lineto 196 4 lineto 196 96 lineto fill')
passthrough('~0 setgray 8 22.5 moveto 0 0 1 setrgbcolor /Helvetica 72')
passthrough('~selectfont (Down) show')
passthrough('~} if')
passthrough('~[/EP pdfmark')

% Submit button appearances
passthrough('~[/BBox [0 0 250 100] /_objdef {Submit} /BP pdfmark')
passthrough('~__pdfMark__ {')
passthrough('~0.6 setgray 0 0 250 100 rectfill 1 setgray 2 2 moveto 2 98')
passthrough('~lineto 248 98 lineto')
passthrough('~246 96 lineto 4 96 lineto 4 4 lineto fill 0.34 setgray 248 98')
passthrough('~moveto 248 2 lineto')
passthrough('~2 2 lineto 4 4 lineto 246 4 lineto 246 96 lineto fill')
passthrough('~/Helvetica 76 selectfont 0 setgray 8 22.5 moveto (Submit)')
passthrough('~show')
passthrough('~} if')
passthrough('~[/EP pdfmark')

passthrough('~[/BBox [0 0 250 100] /_objdef {SubmitP} /BP pdfmark')
passthrough('~__pdfMark__ {')
passthrough('~0.6 setgray 0 0 250 100 rectfill 0.34 setgray 2 2 moveto 2 98')
passthrough('~lineto 248 98 lineto')
passthrough('~246 96 lineto 4 96 lineto 4 4 lineto fill 1 setgray 248 98')
passthrough('~moveto 248 2 lineto')
passthrough('~2 2 lineto 4 4 lineto 246 4 lineto 246 96 lineto fill')
passthrough('~/Helvetica 76 selectfont 0 setgray 10 20.5 moveto (Submit)')
passthrough('~show')
passthrough('~} if')
passthrough('~[/EP pdfmark')

passthrough('~[ /_objdef {pdfDocEncoding}')
passthrough('~/type /dict')
passthrough('~/OBJ pdfmark')
passthrough('~[ {pdfDocEncoding}')
passthrough('~<<')
passthrough('~/Type /Encoding')
passthrough('~/Differences [')
passthrough('~24 /breve /caron /circumflex /dotaccent /hungarumlaut /ogonek')
passthrough('~/ring')
passthrough('~/tilde 39 /quotesingle 96 /grave 128 /bullet /dagger /daggerdbl')
passthrough('~/ellipsis /emdash /endash /florin /fraction /guilsinglleft /guilsinglright')
passthrough('~/minus /perthousand /quotedblbase /quotedblleft /quotedblright /quoteleft')
passthrough('~/quoteright /quotesinglbase /trademark /fi /fl /Lslash /OE /Scaron')
passthrough('~/Ydieresis /Zcaron /dotlessi /lslash /oe /scaron /zcaron 164')
passthrough('~/currency')
passthrough('~166 /brokenbar 168 /dieresis /copyright /ordfeminine 172 /logicalnot')
passthrough('~/.notdef /registered /macron /degree /plusminus /twosuperior')
passthrough('~/threesuperior')
passthrough('~/acute /mu 183 /periodcentered /cedilla /onesuperior /ordmasculine')
passthrough('~188 /onequarter /onehalf /threequarters 192 /Agrave /Aacute /Acircumflex')
passthrough('~/Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex')
passthrough('~/Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde')
passthrough('~/Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash')
passthrough('~/Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls')
passthrough('~/agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla')
passthrough('~/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex')
passthrough('~/idieresis /eth /ntilde /ograve /oacute /ocircumflex /otilde')
passthrough('~/odieresis')
passthrough('~/divide /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis')
passthrough('~]')
passthrough('~>>')
passthrough('~/PUT pdfmark')

passthrough('~[ /_objdef {Helv}')
passthrough('~/type /dict')
passthrough('~/OBJ pdfmark')
passthrough('~[ {Helv}')
passthrough('~<<')
passthrough('~/Type /Font')
passthrough('~/Subtype /Type1')
passthrough('~/Name /Helv')
passthrough('~/BaseFont /Helvetica')
passthrough('~/Encoding {pdfDocEncoding}')
passthrough('~>>')
passthrough('~/PUT pdfmark')

passthrough('~[ /_objdef {TiIt}')
passthrough('~/type /dict')
passthrough('~/OBJ pdfmark')
passthrough('~[ {TiIt}')
passthrough('~<<')
passthrough('~/Type /Font')
passthrough('~/Subtype /Type1')
passthrough('~/Name /TiIt')
passthrough('~/BaseFont /Times-Italic')
passthrough('~/Encoding {pdfDocEncoding}')
passthrough('~>>')
passthrough('~/PUT pdfmark')

passthrough('~[ /_objdef {TiRo}')
passthrough('~/type /dict')
passthrough('~/OBJ pdfmark')
passthrough('~[ {TiRo}')
passthrough('~<<')
passthrough('~/Type /Font')
passthrough('~/Subtype /Type1')
passthrough('~/Name /TiRo')
passthrough('~/BaseFont /Times-Roman')
passthrough('~/Encoding {pdfDocEncoding}')
passthrough('~>>')
passthrough('~/PUT pdfmark')

passthrough('~[ /_objdef {ZaDb}')
passthrough('~/type /dict')
passthrough('~/OBJ pdfmark')

passthrough('~[ {ZaDb}')
passthrough('~<<')
passthrough('~/Type /Font')
passthrough('~/Subtype /Type1')
passthrough('~/Name /ZaDb')
passthrough('~/BaseFont /ZapfDingbats')
passthrough('~>>')
passthrough('~/PUT pdfmark')

%%BeginPDFMarkPrefix
passthrough('~systemdict /currentdistillerparams known not {')
passthrough('~/str 256 string def')
passthrough('~{currentfile str readline not {exit} if')
passthrough('~(%%EndPDFMarkPrefix) eq {exit} if } loop')
passthrough('~} if')

%%AcroForm Begin
passthrough('~[ /_objdef {ZaDb}')
passthrough('~/type /dict')
passthrough('~/OBJ pdfmark')

passthrough('~[ {ZaDb}')
passthrough('~<<')
passthrough('~/Type /Font')
passthrough('~/Subtype /Type1')
passthrough('~/Name /ZaDb')
passthrough('~/BaseFont /ZapfDingbats')
passthrough('~>>')
passthrough('~/PUT pdfmark')

passthrough('~[ /_objdef {Helv}')
passthrough('~/type /dict')
passthrough('~/OBJ pdfmark')

passthrough('~[ {Helv}')
passthrough('~<<')
passthrough('~/Type /Font')
passthrough('~/Subtype /Type1')
passthrough('~/Name /Helv')
passthrough('~/BaseFont /Helvetica')
passthrough('~/Encoding {pdfDocEncoding}')
passthrough('~>>')
passthrough('~/PUT pdfmark')

passthrough('~[ /_objdef {aform}')
passthrough('~/type /dict')
passthrough('~/OBJ pdfmark')

passthrough('~[ /_objdef {afields}')
passthrough('~/type /array')
passthrough('~/OBJ pdfmark')

passthrough('~[ {aform}')
passthrough('~<<')
passthrough('~/Fields {afields}')
passthrough('~/DR << /Font << /ZaDb {ZaDb} /Helv {Helv} >> >>')
passthrough('~/DA (/Helv 0 Tf 0 g)')
passthrough('~/NeedAppearances true')
passthrough('~>>')
passthrough('~/PUT pdfmark')

passthrough('~[ {Catalog}')
passthrough('~<<')
passthrough('~/AcroForm {aform}')
passthrough('~>>')
passthrough('~/PUT pdfmark')
%%End AcroForm
endfunction()


And this other for to replace the existing code you have @ShowPDFHyperlink
Quote:

function @ShowPDFHyperlink(&sText:string, &sLink:string)
%---------------------------------------------------------
% Function that shows a Hyperlink text using the PDF Mark-
% commands. The hyperlink will only function once the -
% PDF is ripped. -
% -
% To change the appearance of the text, set the -
% appropriate properties (color, underline) in the style -
% of the calling object. -
% -
% IMPORTANT: -
% ---------- -
% - Preview will not work using the internal PostScript -
% interpreter. -
% - When using Image or Digital Imaging, disable the -
% "Compress text and line art" and "Optimize for fast -
% web view" options. -
% - This function was designed specifically for version -
% 7 of the PlanetPress Suite and might not work with -
% previous or future versions. -
%---------------------------------------------------------
% Input: &sText Text to show. -
% &sLink Defines the link to follow. -
% Use "http://..." to open a web -
% site or "mailto:..." to send an -
% E-Mail. -
% Output: Shows a Hyperlink text. -
% Uses: None, but InitPDFMark must be executed before -
% using the function (see the comments in the -
% InitPDFMark function for more details). -
%---------------------------------------------------------
% Written by: Marty Jacques, Objectif Lune -
% Change log: -
% Created: October 29, 2009 -
%---------------------------------------------------------
% Show the text
margin(0,0.2)
show(&sText)
% Create the link region (same width as text, 0.2" height)
%passthrough('/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse')
passthrough('[ /Rect [0 0 '+FloatToStr(StringWidth(&sText)*72)+' '+FloatToStr(0.2*72)+']')
passthrough('/Border [0 0 0]')
passthrough('/Color [0 0 0]')
passthrough('/MK << /BC [ 0 0 0 ] % border color in rgb')
passthrough(' >>')
passthrough('/Action << /Subtype /URI /URI ('+&sLink+') >>')
passthrough('/Subtype /Link')
passthrough('/ANN pdfmark')
endfunction()

Top
#57766 - 11/25/20 11:10 AM Re: Hyperlink in PDF suddenly stopped generating [Re: rdaneel72]
rdaneel72 Offline
OL Toddler

Registered: 02/25/08
Posts: 34
This doesn't make sense. This process worked for over a decade without this second function. What could have possibly changed in the last 2 weeks?

Thank you for your input. I will try this, but it doesn't make sense to me.

EDIT: This solution worked. I don't understand what happened, but you, sir, have saved my butt. Thank you very much for a quick solution.


Edited by rdaneel72 (11/25/20 11:32 AM)

Top
#57767 - 11/25/20 03:10 PM Re: Hyperlink in PDF suddenly stopped generating [Re: rdaneel72]
Raphael Lalonde Lefebvre Offline
OL Expert

Registered: 10/14/05
Posts: 4956
Loc: Objectif Lune Montreal
Hi rdaneel72,

It's worth noting that the pdf hyperlinks was never an "official" feature of PlanetPress. Passthrough commands are custom lines of PostScript code that may or may not work, and depends entirely on your pdf reader's or PostScript interpreter's ability to execute them properly.

Now, this is just my opinion, but assuming neither the PlanetPress document nor the Workflow changed, one other thing that could've happened is an update or change to the configuration of Adobe Reader, or whichever other app you use to read your pdf, that changed the way the code is executed and broke your old solution. Perhaps the PDF Marks used to be initialized by default, but the update changed that, and now you need to use Robert's "InitPDFMark" function to make it work.

Again, just my two cents, but it seems a likely explanation to me.

Regards,
Raphaël Lalonde-Lefebvre

Top