Forum How do I...?

Partially Absolute URLS

popcornmanager
Hi

I am generating web content in my web page, and the organization system I have requires I use "partially absolute URLs". What I mean by this is they are not relative, but not completely absolute. Basically, every image and css url starts with a '/' so it is relative to the domain.

This does not seem to work with Prince as the beginning slash means to look in the root of the filesystem, not of a web directory! Also, specifying the base-url as "http://mydomain/" does not work, mainly because I the urls are not relative and only uses the base-url when relative.

The not-so-good solutions I have for this at the moment include:
    Performing some complex regexp on the HTML to find all these URLs and replace them with completely absolute URLs
    Creating symbols links in the root directory of the filesystem to all necessary folders and files

I hope there is a better way than that!

Thanks,
Jeff
mikeday
Perhaps run Prince on the HTTP URL, rather than the local file? That way the links should all work, and performance shouldn't be an issue if it's on the same host.
popcornmanager
That would probably work, except that I am in an odd situation. The HTML is dynamically generated and is not accessible via the http:// and exist only in memory. The pages are similar to the pages that are generated when viewed with HTTP, however they are slightly different for PDF creation (no toolbars on the left, and a few other things). I would prefer not to save them to disk. I have done a regex that does what I want without negatively effecting performance that much. It seems the only option instead of saving the files to disk.

Thanks,
Jeff
mikeday
In Prince 7.1 we have added an experimental new command-line option called --fileroot, which allows you to specify a path that will be used to resolve absolute filenames.