I'm using the .NET wrapper to allow our users to dynamically request a PDF version of a web page. The problem we're facing, however, is that our pages rely on a customer having selected their country (set in a cookie) in order to tailor the content to them.
I wasn't able to find a way to do this using the Prince .NET wrapper, but perhaps I'm missing something. Is there a way?
Not in the .NET wrapper at the moment, but we may be able to add one. Currently Prince has a --cookiejar command-line option which can be used to specify a file containing cookie definitions, which may be sufficient. But if the cookie changes frequently, it would be more convenient to just pass it dynamically on the command-line instead of writing it to a file. We may need to add a new option for that.
I think your analysis is correct: the ideal solution would be to enable a feature to add a cookie to the request with several parameters (name, value, expiration, domain, path). And making that feature available through the .NET wrapper would be even better!
Where is this documented? the User Guide command-line reference does not have an entry for --cookie. Does it use the same tab delimited format as a cookie in the cookiejar file? must it be within quotes?
Help from the prince.exe program states the value should be a Set-Cookie header, so if I have two cookies, would I add the following to the options to prince.exe?
--cookie=cookie1=value1 --cookie=cookie2=value2; Expires=Wed, 09 Jun 2021 10:18:14 GMT
using the --cookie option, "--cookie=name=value; Domain=localhost" fails to send the cookie to URLs to localhost. Using the --cookiejar option, this succeeds. Omitting the domain attribute to --cookie, will allow the cookie to be sent, but it sends to all domains.
Prince 10 Copyright 2002-2015 YesLogic Pty. Ltd. Non-commercial License