Adding watermark to PDF


06-05-2009, 12:34 PM

Hello,

I'm working on adding a watermark that would read "Preliminary" to our reports that we produce for our end users after we collect all their information.  I am currently working with an .rpx file wiht ActiveReports and the language being used inside the .rpx being VB Script.

I have found some code that I thought would work, but so far hasn't.....here it is:

Sub OnReportStart

(other code)

set rpt.Watermark.object = System.Drawing.Image.FromFile("C:\...blahblah.bmp")

(other code)

End Sub

Any advice at all??

Thanks,

Brian

 

Re: Adding watermark to PDF


06-05-2009, 1:37 PM

Brian,

Please use the following lines of script in the script editor to generate the watermark.

 

Sub OnReportStart

rpt.Watermark = LoadPicture("C:\...picture.bmp")

End Sub

 

Regards,

Prantik

 

Re: Adding watermark to PDF


06-09-2009, 2:37 PM

Excellent! That worked!  Thank you so much!

One final question...I have other controls on this PDF print out, and I would like to place the watermark on three of them (but not all of them)...so the user can read Preliminary Report in its entirety.

 

Any thoughts on that?

 

Thank you!

Re: Adding watermark to PDF


06-09-2009, 11:46 PM

Hello,

Could you please let us know what do you mean by “other controls in the PDF printout”? If I understand you correctly, you are exporting the report generated by ActiveReports to the PDF format and you wish to add   watermarks in some particular pages. If that is the case then, you could add watermark according to the condition of page number with code as follows:-

If pagenumberof report=requiredpagenumber then

      Me. Watermark=LoadPicture (“FilePath”)

Else
     Me. Watermark=LoadPicture ()

End if

Regards,
Prantik
 

Re: Adding watermark to PDF


06-10-2009, 7:24 AM

Hmm...I guess I explained this the wrong way.  I'm trying to find the property to put some of the controls (grids I use in my report to separate certain areas) BEHIND the watermark (Watermark to the front for those specific controls) but not all of them.

Hope this helps!!

Re: Adding watermark to PDF


06-11-2009, 5:31 AM
Hello,

I would like to inform you that the watermark property is available for the entire report and not some specific controls. Could you please provide us the RPX and the RDF of your report and please point out where you require the watermark to display and the content of the same, so that we could analyze and provide a better solution.

Regards,
Prantik

Re: Adding watermark to PDF


06-18-2009, 12:35 PM

For your above comment on which page to display watermark...where would that go?  OnReportStart?

The watermark we used...we changed the angle of it so the controls aren't interfering.  However, we would like the 1st page to have the full watermark but the following pages to have a watermark (which is actually a label on the footer) to display on the proceeding pages and not the full watermark.

 

Any thoughts?

Thank you!

Re: Adding watermark to PDF


06-18-2009, 1:26 PM
rpt.watermark = loadpicture() also throws a wicked error message at you as well... =\

Re: Adding watermark to PDF


06-18-2009, 2:30 PM

Here is the current code I'm twinkering with:

Sub OnFormat

  Const enuIsCompleted = 277
 
  strData = rptWriterClass.strData
 
    If rpt.pageNumber = 1 Then
     if strData(enuIsCompleted) <> "True" then
      rpt.watermark = loadpicture("C:\Program Files\...\pr.jpg")
      if err.number <> 0 then
      msgbox "The Preliminary Report file could not be found.  Please us to resolve this issue."
    end if
   end if
   rpt.srHeader1.Visible = True
   rpt.srHeader2.Visible = False
    Else
     'rpt.watermark = loadpicture()
   rpt.srHeader1.Visible = False
   rpt.srHeader2.Visible = True
   if strData(enuIsCompleted) <> "True" then
    rpt.Sections("PageFooter").Controls("Label2").visible = true
   end if
    End If

End Sub

Re: Adding watermark to PDF


06-19-2009, 8:08 AM
Hello,

Thank you for providing the details. Please take a look at the attached sample which illustrates your requirements. Please change the connection properties to connect to the NorthWind database.

Regards,
Prantik

Re: Adding watermark to PDF


06-19-2009, 11:13 AM

Prantik,

That worked!!! OMG...thank you so much for your help on this!

If this was Arby's, I would ring that Customer Sastified bell at least ten times!

Regards,

Brian