11

I need to put a corporate logo at the top of every JavaDoc page. I'm trying to use the -top option, but don't know how to code the image path -- the path is always relative to the package sub-directory. I don't want to put the same image file in every package sub-directory.

javadoc -top '' is what I've tried but the image (which is in the root of the javadoc tree) only shows up on the index page.

Edit: Unfortunately, this is going to be distributed as a ZIP and we won't be able to access the logo via a URL.

artk2002
  • 141
  • 1
  • 8
  • Is this for internal use, or distribution? I would suspect you could use a URL to the logo on a webserver if it is internal. – KevinO May 12 '16 at 15:31
  • It's external. I'll update the request. A URL won't do it, unfortunately. – artk2002 May 12 '16 at 19:24
  • 3
    An alternative idea inspired by [this question](http://stackoverflow.com/q/24554762/3080094) and answers: generate the Javadocs, open the "stylesheet.css", add `.topNav { background: #4c6b87 url(resources/companyLogo.jpg) no-repeat right top; }` and store the companyLogo.jpg in the resources folder. It's not perfect but it could be a start. – vanOekel May 13 '16 at 00:34
  • @vanOekel Thanks! That works. Well, mostly. I have to scale the image so I imagine any resizing of the top nav bar will cause some strange effects. For my purposes, though, this should be sufficient. – artk2002 May 13 '16 at 14:19

1 Answers1

2

Pulling comments into an answer.

If you can, the easiest thing to do would be to just host your image externally and link to the full URL. If you can't host the image on your own website you could upload it to an image host like Imgur or a cloud hosting solution like Google Cloud Storage.

If you really need to distribute the image with the docs, your best bet will be to modify stylesheet.css after generating your docs as suggested in this question. Add:

.topNav {
  background: #4c6b87 url(resources/companyLogo.jpg) no-repeat right top;
 }

and store companyLogo.jpg in the resources folder.

Community
  • 1
  • 1
dimo414
  • 47,227
  • 18
  • 148
  • 244