Author Topic: Add watermark to generated document  (Read 920 times)

Uffe

  • EA Practitioner
  • ***
  • Posts: 1274
  • Karma: +93/-8
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Add watermark to generated document
« on: December 12, 2017, 12:39:49 am »
Hi all,


I'd like to stamp "draft" (or whatever) watermarks on certain generated documents. RTF doesn't actually support those, but according to this MSDN article you can achieve the same effect using a \shp.

I tried creating a watermark in a Word document and saving that as RTF (which works, Word can render it correctly when reopening the file), then importing that into a linked document in EA (by creating the linked document, then in the RTF editor selecting File - Import), the idea being that I could use that document in a call to DocumentGenerator.InsertLinkedDocument() to get the watermark to show up on all pages.

The EA RTF editor did not display the watermark, but not to worry, the RTF specification says you're allowed to ignore content you can't handle, but if I export the document, the \shp is gone. I'm not sure the spec says you can do that, but anyway, that means this approach doesn't work.

But is there another way to create a watermark like this?

I can script it, sure. But I was looking for a way to have it incorporated into the template.


/Uffe
My theories are always correct, just apply them to the right reality.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 8467
  • Karma: +207/-26
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Add watermark to generated document
« Reply #1 on: December 12, 2017, 03:32:52 am »
Uffe,

I don't see any options on the templates themselves, but there is an option to set a watermark on the Document generation dialog (F8).
Any reason why you aren't using that?

Geert

Uffe

  • EA Practitioner
  • ***
  • Posts: 1274
  • Karma: +93/-8
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Add watermark to generated document
« Reply #2 on: December 12, 2017, 08:34:23 pm »
Well the thing is I want to automate it so I can control which, if any, watermark gets put on a document without the user having to remember to a) select a watermark when appropriate, or b) deselect it when not (since EA remembers the selected watermark between generations).

I already have linked documents which I use in calls to DocumentGenerator.InsertLinkedDocument() in my document generation scripts to get headers and footers. My idea was to duplicate these and add "draft" watermarks to the duplicates, and then in the script to select one of them based on the status of the model for which the document is being generated.

/Uffe
My theories are always correct, just apply them to the right reality.