It is currently 31 October 2020, 12:40 Advanced search

Set Time and Date when Printing

Questions and answers on how to best use Instant Developer

Set Time and Date when Printing

Postby Ted Giles » 26 September 2019, 11:42

I have my Book resizing nicely, depending on the volume of text in the page sections of the PDF which is created.
Next challenge is to automatically insert the time and date of printing when the Book Icon in the Menu - (which appears if you create a Book/Report) - is pressed.

To summarise;
When a user hits the Print Icon created by the Book process, I would like to record the time and date when this happens in a table field to save entering it manually.
If it is possible, I would also like to have this happen on the successful download of the PDF instead of when the Icon is pressed. Whether the user saves to document locally or not is up to them.

Years ago I had to handle secure document printing for Chase Manhattan, where the printed page and character count had to match the date sent to the printer so as to ensure completeness.
In addition I had to handle reprint requests but at this stage I can ignore that part.
User avatar
Ted Giles
 
Posts: 496
Joined: 29 November 2013, 12:58
Location: The Wolds, Lincolnshire, UK

Re: Set Time and Date when Printing

Postby lucabaldini » 27 September 2019, 6:36

There are several options... I would do this:
- add a box with a span on the page where you want your date to be
- in the OnFormatting page event I would write something like that:
Code: Select all
  if (Book.IsPrinting)
     DateSpan.text = Format(now())

or something like that... If I've understood correctly your request...
User avatar
lucabaldini
Pro Gamma
Pro Gamma
 
Posts: 4641
Joined: 1 October 2010, 17:03
Location: Bologna

Re: Set Time and Date when Printing

Postby lucabaldini » 27 September 2019, 6:37

The IsPrinting property allows you to check if the book is "actually printing" :-)

https://doc.instantdeveloper.com/eng/default.aspx?artid=7cea81c4-c1a6-4142-ae5c-355ded9d61fd&lang=eng
User avatar
lucabaldini
Pro Gamma
Pro Gamma
 
Posts: 4641
Joined: 1 October 2010, 17:03
Location: Bologna

Re: Set Time and Date when Printing

Postby Ted Giles » 27 September 2019, 12:15

Thanks Luca. I am away for the weekend and will try it Monday.
The time and date just need to be saved to the table for the specific I'D, so I will fiddle with it.
Many thanks.
User avatar
Ted Giles
 
Posts: 496
Joined: 29 November 2013, 12:58
Location: The Wolds, Lincolnshire, UK

Re: Set Time and Date when Printing

Postby lucabaldini » 27 September 2019, 12:33

Ah... I completely misunderstood...
Let's try again... :-DDD

If you have to store in your DB the exact time the user pressed the "PRINT" toolbar button the solution is different...
For that you have to implement the OnCommand book event and write something like that:
Code: Select all
Book.OnCommand event

if (Command == Print)
   update UserTable
      set PrintTime = now()
   where
      ID = UserID
User avatar
lucabaldini
Pro Gamma
Pro Gamma
 
Posts: 4641
Joined: 1 October 2010, 17:03
Location: Bologna

Re: Set Time and Date when Printing

Postby lucabaldini » 27 September 2019, 12:34

User avatar
lucabaldini
Pro Gamma
Pro Gamma
 
Posts: 4641
Joined: 1 October 2010, 17:03
Location: Bologna

Re: Set Time and Date when Printing

Postby Ted Giles » 28 September 2019, 7:49

Thanks Luca, that looks good!
User avatar
Ted Giles
 
Posts: 496
Joined: 29 November 2013, 12:58
Location: The Wolds, Lincolnshire, UK


Return to Tips & Tricks

Who is online

Users browsing this forum: No registered users and 7 guests

cron