Re: Printing Saved Files
- From: "Doug" <doug54@xxxxxxx>
- Date: Tue, 01 Nov 2005 22:24:02 GMT
Thanks for your help. I'm using a program called XFRX that seems to work
pretty good. I have it creating the PDF files now and when I'm ready to
print the files I read the PDF files into an array and then print each one
in a FOR ... NEXT loop. This displays each of the reports with Adobe Acrobat
but does anyone know how I can get the reports to go directly to the
printer? I use the command "RUN /N &cAFile &cFileName" where cAFile is the
directory and file name of the Acrobat program and cFileName is the name of
the PDF file to print.
Doug
"Lee Mitchell" <Leemi@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:rqCxT%23x3FHA.2984@xxxxxxxxxxxxxxxxxxxxxxxx
> Hi Doug:
>
> Here is some code to create a PDF file using Visual FoxPro:
>
> 1. Get the PDF995 driver from http://site4.pdf995.com/download.html.
> 2. Make sure Windows Scripting Host is installed
> 3. Run code below.
>
> Note: The PDF995 driver displays a web site advertisement when you
complete
> printing. You can turn this off by buying a key from the maker of PDF995.
>
>
>
> *-----------------------------------
> * AUTHOR: Trevor Han*** (TrevorH@xxxxxxxxxxxxx)
> * CREATED: 02/19/2004
> *
> * ABSTRACT: Demo showing how to print a Fox report to a PDF
> * via the PDF995 driver (http://site4.pdf995.com/download.html).
> * You need to download and install the Pdf995 Printer Driver and the
> * "Free Converter" from the site above in order to run this code.
> * Once that is done, save this to a .PRG and run it. It will create
> * it's own table, report, etc. for demo purposes.
> *
> * When finished, you will get a messagebox saying "COMPLETE!" and
> * there will be a file named "MYPDF.PDF" in the same DIR as this .PRG.
> *-----------------------------------
> DECLARE INTEGER Sleep IN Win32API INTEGER
> DECLARE INTEGER FindWindow IN WIN32API STRING, STRING
> DECLARE SetWindowPos IN WIN32API ;
> LONG HWND, ;
> LONG hwndafter, ;
> LONG x, ;
> LONG Y, ;
> LONG cx, ;
> LONG cy, ;
> LONG flags
>
> CLOSE DATA ALL
> LOCAL i AS INTEGER, ;
> lcThisDir AS STRING, ;
> lcPDFFileName AS STRING
> i = 0
> lcThisDir = ADDBS(JUSTPATH(SYS(16)))
> lcPDFFileName = lcThisDir + [MYPDF.PDF]
> CD (lcThisDir)
> ERASE *.PDF
>
> *-- Create a temp table to report off of.
> CREATE CURSOR TEST (cID c(10), FNAME c(30), LNAME c(30))
> FOR i = 1 TO 10
> INSERT INTO TEST VALUES ;
> (SYS(2015), [F] + TRANS(i), [L] + TRANS(i))
> ENDFOR
> *-- Create a dummy report
> CREATE REPORT MyReport FROM TEST
>
> *-- Run the report after setting the printer to
> *-- PDF driver.
> SET PRINTER TO NAME PDF995
> REPORT FORM MyReport TO PRINTER NOCONSOLE
>
> *-- Call the help procedure that
> *-- processes the saving via the PDF995 dialog.
> SetPDF_FileName(lcPDFFileName)
>
> *-- Clean up and bail
> CLOSE DATA ALL
> ERASE MyReport.*
> CLEAR DLLS
> RELEASE ALL
> MESSAGEBOX([Complete!])
>
>
>
> *~~~~~~~~~~~
> FUNCTION SetPDF_FileName(lpFileName AS STRING)
> #DEFINE HWND_TOPMOST -1
> #DEFINE SWP_HIDEWINDOW 80
>
> LOCAL lnPDFWinHand AS LONG, ;
> loWSH AS wscript.SHELL
> lnPDFWinHand = 0
> *-- Create an instance of the wscript.shell
> *-- object. We use this to fill in the file name
> *-- on the PDF995 "Save As" dialog via the SendKeys()
> *-- method of the object. Poor-mans automation. <g>
> loWSH = NEWO([wscript.shell])
>
> *-- Get a handle to the PDF995 "Save As" dialog
> DO WHILE lnPDFWinHand = 0
> lnPDFWinHand = FindWindow(0, [PdF995 Save As])
> DOEVENTS
> ENDDO
>
> *-- Once we have a handle, move it off screen
> *-- and hide it ASAP via the SetWindowPos API.
> *-- Not necessary, but looks cleaner. You DO need to set
> *-- that dialog to the foreground window. That's taken
> *-- care of by passing the hwnd_topmost param to
> *-- SetWindowPos.
>
> *-- NOTE: You need error trapping here to prevent this next call
> *-- if we DIDN'T get a handle to the "Save As" dialog
> *-- for some reason.
> SetWindowPos(lnPDFWinHand, HWND_TOPMOST, ;
> -500, -500, 0, 0, SWP_HIDEWINDOW)
>
> *-- The textbox on the "Save As" dialog that accepts the
> *-- file name has focus when this dialog opens, so we just
> *-- fill it with the file name via SendKeys().
> loWSH.SendKeys(lpFileName)
> *-- Sleep for 1/2 a second to make sure it went in fine.
> Sleep(500)
> *-- Click the "Save" button on the "Save As" dialog
> *-- via SendKeys()
> loWSH.SendKeys([%s])
>
> *-- Release our scripting object and bail
> RELEASE loWSH
> RETURN
>
>
> I hope this helps.
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> Sincerely,
> Microsoft FoxPro Technical Support
> Lee Mitchell
>
> *-- VFP9 HAS ARRIVED!! --*
> Read about all the new features of VFP9 here:
> http://msdn.microsoft.com/vfoxpro/
>
> *--Purchase VFP 9.0 here:
>
http://www.microsoft.com/PRODUCTS/info/product.aspx?view=22&pcid=54787e64-52
> 69-4500-8bf2-3f06689f4ab3&type=ovr
>
> Keep an eye on the product lifecycle for Visual FoxPro here:
> http://support.microsoft.com/gp/lifeselectindex
> - VFP5 Mainstream Support retired June 30th, 2003
> - VFP6 Mainstream Support retired Sept. 30th, 2003
>
>
>
>
> >I'd print it out to a file in PDF format. That way, the printer involved
> >later would be irrelevant.
>
> --
> >Fred
> >Microsoft Visual FoxPro MVP
>
>
> >"Doug" <doug54@xxxxxxx> wrote in message
> >news:AeL9f.377029$oW2.84978@xxxxxxxxxxx
> > What are your thoughts on how I can set up the reports so they don't
> > right away but spool the print jobs to print them later. I was told all
I
> > had to do was print the report to a file and then when I'm ready to
> > it, copy the file to the printer. I was told that this way you could
send
> > somebody the file you created and they'd be able to print it on their
> > printer. How would you handle this job?
> >
> > Doug
> >
> >
> > "Fred Taylor" <ftaylor@xxxxxxxx!REMOVE> wrote in message
> > news:OJvoSno3FHA.2816@xxxxxxxxxxxxxxxxxxxxxxx
> >> Is your printer and the client's printer the same kind and model
number?
> > If
> >> not, you won't be able to copy a file that contains printer codes to it
> >> no
> >> matter what.
> >>
> >> --
> >> Fred
> >> Microsoft Visual FoxPro MVP
> >>
> >>
> >> "Doug" <doug54@xxxxxxx> wrote in message
> >> news:NHu9f.371997$1i.83566@xxxxxxxxxxx
> >> > Tried that but it just seems to print to LPT1. I even tried the
command
> >> > SET
> >> > PRINTER TO NAME \\storage\lexmark and then the command to copy to PRN
> > but
> >> > it
> >> > just printed to the LPT printer which is at port \\doug\brotherh.
> >> >
> >> > Doug
> >> >
> >> >
> >> > "Lee Mitchell" <Leemi@xxxxxxxxxxxxxxxxxxxx> wrote in message
> >> > news:GiNxrok3FHA.3936@xxxxxxxxxxxxxxxxxxxxxxxx
> >> >> Hi Doug:
> >> >>
> >> >> Try this. This line copies the file to the printer connected to
LPT1:
> > in
> >> >> Windows. You may also specify LPT1 or LPT2 instead of PRN.
> >> >>
> >> >> COPY FILE final.txt TO PRN
> >> >>
> >> >> I hope this helps.
> >> >>
> >> >> This posting is provided "AS IS" with no warranties, and confers no
> >> > rights.
> >> >>
> >> >> Sincerely,
> >> >> Microsoft FoxPro Technical Support
> >> >> Lee Mitchell
> >> >>
> >> >> *-- VFP9 HAS ARRIVED!! --*
> >> >> Read about all the new features of VFP9 here:
> >> >> http://msdn.microsoft.com/vfoxpro/
> >> >>
> >> >> *--Purchase VFP 9.0 here:
> >> >>
> >> >
> >
>
http://www.microsoft.com/PRODUCTS/info/product.aspx?view=22&pcid=54787e64-52
> >> >> 69-4500-8bf2-3f06689f4ab3&type=ovr
> >> >>
> >> >> Keep an eye on the product lifecycle for Visual FoxPro here:
> >> >> http://support.microsoft.com/gp/lifeselectindex
> >> >> - VFP5 Mainstream Support retired June 30th, 2003
> >> >> - VFP6 Mainstream Support retired Sept. 30th, 2003
> >> >>
> >> >> >I'm trying to print a report that I saved with the command PRINT
> > REPORT
> >> >> >report1 TO FILE filename.
> >> >>
> >> >> >Then I copy the file to a printer port to print the file: COPY FILE
> >> >> filename
> >> >> >TO \\server1\printer1
> >> >>
> >> >> >When I use this command on my system it works fine but when I use
the
> >> > same
> >> >> >command on a client's system it just copies the file to the
computer
> >> >> >and
> >> >> >calls it printer1.
> >> >>
> >> >> >The printer seems to be set up properly, the port name is
> >> >> \\server2005\x128.
> >> >> >But when I copy the file file to this port it just creates a file
> > called
> >> >> >"x128" on my hard drive.
> >> >>
> >> >> >Any ideas what's wrong?
> >> >>
> >> >> >Thanks for your help.
> >> >>
> >> >>
> >> >> >Doug
>
>
.
- References:
- RE: Printing Saved Files
- From: Lee Mitchell
- Re: Printing Saved Files
- From: Doug
- Re: Printing Saved Files
- From: Fred Taylor
- Re: Printing Saved Files
- From: Doug
- Re: Printing Saved Files
- From: Fred Taylor
- Re: Printing Saved Files
- From: Lee Mitchell
- RE: Printing Saved Files
- Prev by Date: Re: Printing Saved Files
- Next by Date: Re: Printing Saved Files
- Previous by thread: Re: Printing Saved Files
- Next by thread: Re: Printing Saved Files
- Index(es):