How to capture a document sent to a specific printer

I need to capture and save (into a database table) a document, sent to a specific printer on a network.  The document is an ms - access report. Thanks in advance.
HARRY222Asked:
Who is Participating?
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
You have a couple of options:

1. Don't "print" to a printer, but have it output directly to a file in PDF format.

2. Setup a printer that prints to a file, then convert to PDF using something like Ghost Script.  Or you can leave it as it and store it, but then you can only send it to a printer that will understand the file (ie. you used a post script driver)

  But there is no way really to intercept output to a standard printer and then re-direct it into the database.

Jim.
0
 
peter57rCommented:
I don't really get what you are after here.

An Access report has no 'existance' outside of the source Access database.  It is an internal object.

You can export your report as a pdf, say, and store that, but it would be separate action to the report being printed.
 
0
 
Rey Obrero (Capricorn1)Commented:
it maybe possible if you control the viewing and printing of reports using a form.

 give more info...
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Jeffrey CoachmanMIS LiasonCommented:
<No Points wanted>

What you seem to be needing here is a "Snapshot" of the report.

In the old days, you would have created a "Snapshot File".

As Pete stated, PDF's are commonly used for this now...
If you are using Access 2007 or newer this is easy (with Access 2007 you have to install the PDF add-in)

Try putting code like this on your "Print" button:

Dim strReportName As String
strReportName = "rptSortYear"
'Print the Report
DoCmd.OpenReport strReportName
'Save the report as a PDF
DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, "C:\YourFolder\" & strReportName & ".pdf"
'Optional, Close the report
'DoCmd.Close acReport, strReportName

If you are using a version of Access prior to 2007 this will require an intermediate step (calling the code to create the PDF) but the principal will be the same...

Keep us posted...

;-)

JeffCoachman
0
 
Jeffrey CoachmanMIS LiasonCommented:
oops...

I misread your request
<I need to capture and save (into a database table) a document, >
Can you state your reasoning behind this request...?

If you save a copy of a report each time it is printed, you will have many duplicates...
Even if they all had different filters applied, how are you planning on managing the different names?
Suppose the report is printed once a day?  At the end if the year you will end up with around 270 reports stored in the DB!...

Also note that these will all be "Snapshots", so they won't include the most recent data, (unless you Print/Save the report again), so again, whats the reason for wanting to "store" it?
Finally how would you go about "Retrieving" these reports?

It is just hard to imagine why you would want to save a copy of the same report to the DB every time it is printed...

Remember that reports can be filtered, so you can "View" a filtered report anytime you want without saving it.

If you truly need a "Snapshot", then you will have to be using Access 2007 or newer and create a table with at least one Record to store all of the reports.
You would have to save the DB in the 2007 format (.accdb) and create a field in the table with a Datatype of "Attachment", then use some fairly complex code to store each printed report into this field...

But again, I just would like to know what your ultimate here need is...?

JeffCoachman
0
 
HARRY222Author Commented:
Thanks for reply. I'll try to explain. For every page than i print from my ms-access report there is a "blind box" -between my PC and printer - that adds to my printed page a text line. This line is different for every page i print. I need to capture my printed page with text line and to store it into a database with an ID.
I want to do that in order to print later the stored page (as a copy) with the text line. Thanks in advance.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<<Thanks for reply. I'll try to explain. For every page than i print from my ms-access report there is a "blind box" -between my PC and printer - that adds to my printed page a text line. This line is different for every page i print. I need to capture my printed page with text line and to store it into a database with an ID.
I want to do that in order to print later the stored page (as a copy) with the text line. Thanks in advance. >>

  I think your only option is to have the printer driver set as "print to file".  Doing that spools the output into a file.  One "printed", you can take the file and store it by labeling it in a certain way (ie.  "PO_<file ID>.prn") and record the ID.  

  To get the output, you'd then do a binary file copy of the file to the real printer port.  You could do that as many times as needed, but the physical printer would need to match the driver you intially used for it to understand the file.

  I use this technique with label files, which I produce locally in the client system, then transmitt to the shipping warehouse.  Warehouse personel then send the files to the thermal printer as needed.

Jim.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.