Number: 455
Title: Links in PDF Output allowes only http:// Syntax
Submitter: Wolfgang Lang
Date: Tue May 25 08:23:35 2004
Subsys: Output generation
Version: 1.12
System: x86-Windows-5.1
Severity: minor
Problem:
If you create PDF files with hyperlinks, the links are created as external web references (the PostScript code looks something like this)

[ /Rect [ 78 98 128 114 ]
  /Border [ 0 0 0 ]
  /Action << /Subtype /URI /URI (./scripts/example.pl.pdf) >>
  /Subtype /Link
/ANN pdfmark

After the conversion to PDF the link is shown as something like http://./scripts/example.pl.pdf If you klick on this link, Acrobat Reader tries to open the file within Mozilla (or IE) instead of Acrobat Reader.

It would be more suitable for PDF files if the PostScript would contain something like


[ /Rect [ 78 98 128 114 ]
  /Border [ 0 0 0 ]
  /Action /Launch
  /File (./scripts/example.pl.pdf)
  /Subtype /Link
/ANN pdfmark

in order to use Acrobat Reader directly to launch other PDF files
Input:
digraph G {
label="Workflow example" fontsize=10 fontname="Helvetica"
MAIN [style=filled,color=".7 .3 1.0",fontsize=10,fontname="Helvetica",height=0.2,width=0.4]
END [style=filled,color=".7 .3 1.0",fontsize=10,fontname="Helvetica",height=0.2,width=0.4]
example [label="example",shape=box,style=filled,color=".1 .5 1.0", URL="./scripts/example.pl.pdf",fontsize=10,fontname="Helvetica",height=0.2,width=0.4]
example -> END [label="NEXT",fontsize=8,fontname="Helvetica",height=0.2,width=0.4]
MAIN -> example [label="BEGIN",fontsize=8,fontname="Helvetica",height=0.2,width=0.4]
MAIN -> END [color=red,label="ERROR",fontsize=8,fontname="Helvetica",height=0.2,width=0.4]
END [color=red,style=filled,fontsize=10,fontname="Helvetica",height=0.2,width=0.4]
}
Fix:
I suggest changing line 180 from mapgen.c to differentiate PDF and non PDF Links Sorry that I have no clue how to figure out if the given link points to a pdf. Maybe it's the easiest way to check the file extension

else if (Output_lang == POSTSCRIPT || Output_lang == PDF)
        {
        if (IsPdfFile (url))
            {
        fprintf(Output_file,"[ /Rect [ %d %d %d %d ]n"
		"  /Border [ 0 0 0 ]n"
		"  /Action /Launchn"
                "  /File (%s)"
		"  /Subtype /Linkn"
		"/ANN pdfmarkn",
	    pp1.x,pp1.y,pp2.x,pp2.y,
	    ps_string(url));
            }
        else
            {
            fprintf(Output_file,"[ /Rect [ %d %d %d %d ]n"
		"  /Border [ 0 0 0 ]n"
		"  /Action << /Subtype /URI /URI %s >>n"
		"  /Subtype /Linkn"
		"/ANN pdfmarkn",
	    pp1.x,pp1.y,pp2.x,pp2.y,
	    ps_string(url));
           }
        }

Owner: *
Status: Request