Clickable Links

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for .NET (v4)  /  Clickable Links

DynamicPDF Generator for .NET (v4) Forum

 Aug 06 2008 7:17 PM
Hello,

I have an original pdf file with a "hotlink" url address within the page.

I have imported this page into generator and then i am essentially covering up the "original" url with a white box and then creating a new url with variable data being applied for certain parts of the "new" url.

Issue: Since all I did was to cover-up the original url in the imported PDF my issue is:

#1 Original url is still clickable even when covered
#2 New url is not clickable at all

Example:

Original URL - http://www.somewhere.com
---Covered up
New URL on top -- http://www.somewhere.com/978452

Solutions?:

#1 My new url is clickable and resolves to the value provide to the label?

#2 Turn off hot click when original PDF is created and then overlay with new url, not clickable.

#3 Read original text from the url and then append it programitically?

Number three seems ideal but not sure how to read in this copy block programitically.

Any help or direction to address this issue would be appreciated.

Thanks in advance. If you require further information please advise.

 Aug 07 2008 6:15 AM
Posted by a ceTe Software moderator
Hello,

We are able to add a white rectangle on an existing link and added a new link which is working fine. Please make sure that you are adding the rectangle in correct X, Y position on the existing link element. Can you please send over the code you are using so that we can take a look at it.

If you are using the Merger product to merge the existing PDF document then you can use the MergeOptions class to stop the links from being preserved when merging. You will have to set the PageAnnotations property of the MergeOptions to false.

Thanks,
ceTe Software Support Team.
 Aug 07 2008 11:46 AM
string sImportPath = Server.MapPath(Request.ApplicationPath) + @"docs\ORIGINAL.pdf";

if (System.IO.File.Exists(sImportPath))
{

document.Title = "test";

//Create new page for document
ceTe.DynamicPDF.Page page_1 = new ceTe.DynamicPDF.Page(PageSize.Letter, PageOrientation.Portrait, 0 );

//Import the existing document path (ie "\docs\") and add to page
page_1.Elements.Add( new ImportedPageArea( sImportPath, 1, 0, 0 ) );

//Add page(s) to document
document.Pages.Add( page_1 );

if(this.ResellerRepID != 0)
{
        //Add a white box to cover  of url
        ceTe.DynamicPDF.PageElements.Rectangle urlcoverbox = new ceTe.DynamicPDF.PageElements.Rectangle(329, 529, 275, 60, 0, RgbColor.White);
        page_1.Elements.Add(urlcoverbox);

        
        //Create the Label for the URL
        ceTe.DynamicPDF.PageElements.Label url = new ceTe.DynamicPDF.PageElements.Label("", 329, 569, 250, 20, futuraHeavy, 9);

        //Assign Url Value
        url.Text = "http://www.purchasedge.com/join/" + this.ResellerRepID.ToString() + ".";
        url.TextColor = RgbColor.Black;
        page_1.Elements.Add(url);
}


document.DrawToWeb( "NEW.pdf" );
Response.End();

}
else
{
        //DO SOMETHING
}
 Aug 07 2008 12:12 PM
Posted by a ceTe Software moderator
Hello,

In your code you are using the ImportedPageArea to import the existing page and this will not preserve the link page element. So the page will have only the link text but not the link address.

When you add a new link with text, the new link will only work. We are unable to recreate the behavior you are having? Please send over the input, output PDF documents and the code you are using for this to our Support Team so that they can look into it further.

Thanks,
ceTe Software Support Team.
 May 01 2013 5:38 PM
The solution is to use the ImportedPage class instead.  The code is slightly different, but it will preserve links.

For example:

      var importedPage = new ImportedPage(docPath, pageNumber);
      document.Pages.Add(importedPage);

All times are US Eastern Standard time. The time now is 2:16 AM.