Developer forum

Forum » Ecommerce - Standard features »  URL in link changes when in PDF

URL in link changes when in PDF

Christian Valentin
Reply

*Edited english version:

Hello! This is my first post here, so please feel free to correct me if I'm not following best practices in one way or another :)

I'm working on a task for a client where we've set up PDF downloads through DW by using the suffix pdf=true. We're experiencing that links in the PDF get a different URL than when clicking the link on the site: domainname.com is replaced with ironsoftwarescheme.com, which causes the link not to work.

Is there any way to overwrite this so that the path remains as originally intended? And for the sake of learning, is there a reason why this isn't the standard? I'm thinking there might be some security considerations or other benefits through Ironpdf :)

Best regards, Christian Valentin, frontend developer!


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Crhistian

Welcome - nice to meet you. As you might have seen from the other forum posts - they are all in English. So that would be a best practice.

I have not heard this or seen this before. When you do pdf=true the URL is read from httpcontext. So the only thing I can think of that causes this is that you are using pdf=true outside of a httpcontext - e.g. in a scheduled task or a background thread.

A simple workaround is to add the URL to your templates.

We can also have a look at the solution if you provide the URL. Also maybe you can tell what version of Dynamicweb this is?

Thanks, Nicolai

 
Christian Valentin
Reply

Thank you for your answer Nicolai, and apologies for my late one :)

Though I'm not veteran enough to completely understand what is and is not inside httpcontext, I think I'm using it inside of it. The logic for downloading the PDF is inside of a cshtml file, where a simple button has a click function, that is defined in the script:



Regarding the workaround you suggest, can I add a URL to the template, even though it's dynamically created?

Also, you can recreate the problem by going to this page, clicking the "Download PDF" button and scrolling down to the links under "Dokumenter", and hover/click on them. They will have the ironsoftwarescheme in the URL :)

Thank you, once again!
Christian

 

You must be logged in to post in the forum