How to add ad-hoc watermark to a report

spikepl

Eledittingent Beliped
Local time
Today, 21:45
Joined
Nov 3, 2010
Messages
6,142
I am playing with the idea of adding a watermark to a report, to identify the specific copy. The report will be output as PDF.

Has anybody an idea how to do that in some simple fashion? I'd like to plaster the background with customer name. Googling reveals different methods, one could always do some fancy manual prostprocessing and add a watermark to a PDF, or do the thing in Word and then print it as PDF.I' prefer a one-shot solution to the entire cycle.

If anybody has tried anything like this, please give me a hint.
 
Some printers have text watermark feature in the printer settings. If your printer doesn't have that then create a grayscale picture with very light black shade (with text or image) and save it as a .jpg image.

  1. Open your Report in Design View.
  2. Display the Property Sheet of the Report.
  3. Select the Picture Property and click on the Build (...) button to browse to the location of the image and open it.
  4. Set the following Property Values as given below:
    • Picture Tiling Value = No
    • Picture Alignment = Center
    • Picture Size Mode = Zoom
 
Thanks. Perhaps I should have been more clear. I am not in doubt about what it takes to put a watermark in. I was hoping for a fully automated solution, starting of with a string, and ending with that strign tiling the background of the report.
 
With the following VBA Routine you can add a picture in the Report Background:

Code:
Public Function ReportWaterMark(ByVal txtRpt As String, ByVal imgPath As String)
Dim rpt As Report

DoCmd.OpenReport txtRpt, acViewDesign

Set rpt = Reports(txtRpt)
With rpt
    .Picture = imgPath
    .PictureAlignment = 2
    .PictureTiling = False
    .PictureSizeMode = 3
End With
DoCmd.Close acReport, txtRpt, acSaveYes
Set rpt = Nothing

DoCmd.OpenReport txtRpt, acViewPreview

End Function

You need a .bmp image (with Text or photo) to insert it as a background image to the Report to print or to convert into pdf. See that the Report controls' Background Style is set as Transparent.

The Report will open up in Print Preview. Call the program using the following Syntax:

Code:
ReportWaterMark "MyReport", "C:\MyLibrary\Pictures\Company.bmp"

The current setting is Picture Alignment = Center and Size mode= Zoom. Change the following property values to apply different styles:

Image Centered and Normal Mode

Code:
    .PictureAlignment = 2
    .PictureTiling = False
    .PictureSizeMode = 0

Image Centered and Zoom Mode

Code:
  .PictureAlignment = 2
    .PictureTiling = False
    .PictureSizeMode = 3


Picture Tiling

Code:
    .PictureAlignment = 0
    .PictureTiling = True
    .PictureSizeMode = 0
 
Thanks again. My trouble is to generate the desired image on the fly. There is a millions apps out there that can go from text to image, so the essence of my question is has anybody married Access with such a generator. I know how I would go about doing it, for a command-line driven image generator (if I could find it), but don't want to reinvent the wheel.
 
Lebans has some code here that appears to put text into a bitmap. So then you could save the bitmap and follow apr pillai's proposal. Needs some work though.

Chris
 
Last edited:
#6 Thanks for that, I had a peek.

Meanwhile, in my meanderings through the web, I ran across a pretty powerful but yet free application that can do image processing from command line: http://www.imagemagick.org/script/index.php

I have to put this little subproject on hold for the moment, but I'll be back.
 
It's raining so I had a play with Stephen Lebans' code.

Here's an example using his picture class (which I can't even begin to understand). But it does a decent job (although I've not tested much).

I didn't need to save to a bitmap file. I just used the controls PictureData properties to pass the picture within code.

So no external code or files, just API calls.

I did try to remove redundant routines from the class but gave up. Decided to just leave it intact :)

Chris
 

Attachments

Users who are viewing this thread

Back
Top Bottom