windowspdfprintingvisual-foxpro

How can I send different VFP reports to "Microsoft Print to PDF" printer as a single multipage PDF file?


I have created 5 different Foxpro VFP9 reports, and currently print them to 5 different PDF files. Then I must string them together as 5 pages in one PDF file, which involves a web-based drag & drop, and then download. Foxpro VFP9 could easily send them to a paper printer without intervention. But the "Microsoft Print to PDF" printer requires a filename for each page. Can ShellExecute help me here? Or any other batch utility? Thanks in advance.. SteveB

In the old days, I'd send my reports to text files, and then quickly edit them into a single document. I'm looking for an "additive" way to print-to-PDF, ending up with just one file, with multiple pages, each generated by different Foxpro report form


Solution

  • You chain reports by using the NOPAGEEJECT clause on all REPORT FORM commands except the last one. Here is a sample that prints two very simple reports into the same PDF file. The name of the printer might depend on the version of Windows and your locale:

    Set Safety Off
    
    Create Cursor Pdf_A (Name C(20))
    Insert into PDF_A Values ("Christof")
    Create Report Report_A from PDF_A
    
    Create Cursor Pdf_B (Forecast C(20))
    Insert into PDF_B Values ("Cloudy")
    Create Report Report_B from PDF_B
    
    Set Printer to name "Microsoft Print to PDF"
    
    Select PDF_A
    Report Form Report_A to printer NoPageEject
    
    Select PDF_B
    Report Form Report_B to printer