D3 and mvBase

 View Only
Expand all | Collapse all

Printing and emailing reports via PDF files

  • 1.  Printing and emailing reports via PDF files

    Posted 03-04-2021 09:24
    I just discovered (joyfully) that we could print and email (by way of Cups-PDF post processing options) any D3 report to a PDF file by defining a shared printer that outputs its contents through Cups-PDF (we use D3/Linux).  The printer also respects the CUPS options passed to it (I have only tested -o landscape and -o cpi=17 so far).

    Coming out of this discovery, here is an initial list of wish I hads:
    1. The ability to directly mail the reports to the consumers rather than having to forward them from a single central mailbox.
    2. The ability to inject the title of the report into the PDF document and also name the resultant file for ease of identification.
    3. The ability to colorize elements of the report.  I guess this would have to come from some DEVICE file definition.
    4. The ability to archive the reports based on title and date/time generated.
    Any help in respect of the above would be appreciated.

    Finally, is ROCKET planning to develop anything in this regard.

    Best regards and keep safe,

    Vincent "Kim" Elliott
    ITC, Bearings & Accessories Ltd.
    83 Harbour Street,
    Kingston, Jamaica

    Tel: 876-922-1950
    Fax: 876-922-8129
    Cell: 876-315-2739


  • 2.  RE: Printing and emailing reports via PDF files

    ROCKETEER
    Posted 03-04-2021 14:41
    Hi, Vincent. Brian Cram here. It's been a while since we talked. Hope you are doing well.

    To your question about CUPS PDF printing, I don't know if any of this is currently on the radar, and if I had to bet, I would bet that it is not. Would you like me to enter some enhancement requests on your behalf?

    ------------------------------
    Brian Cram
    Senior Technical Support Engineer
    Rocket Software
    ------------------------------



  • 3.  RE: Printing and emailing reports via PDF files

    Posted 03-04-2021 15:34
    Hi Brian,
    Yes...it has been a long time and hope that you are also keeping well.

    I think it would be a good idea to enter the enhancement requests given the current climate of remote work.  Soft copies of reports delivered electronically I think is definitely something that should be brainstormed and implemented.

    Another good to have is an Excel spreadsheet generated from the SS 
    connective.

    Best regards and keep safe,

    Vincent "Kim" Elliott
    ITC, Bearings & Accessories Ltd.
    83 Harbour Street,
    Kingston, Jamaica

    Tel: 876-922-1950
    Fax: 876-922-8129
    Cell: 876-315-2739





  • 4.  RE: Printing and emailing reports via PDF files

    Posted 03-04-2021 17:24
    Hi Vincent,

    When our staff were sent home during COVID I had to come up with a way to print D3 reports and to print network documents remotely in people's homes. They also needed to generate PDF documents from network documents and Office documents generated by D3.

    I had no idea how to do this but managed to wing my way through it by writing a few subroutines and utility programs to help along the way.

    My solution centred on CSV files and plain text files. We use HostAccess as our terminal emulator and I used some of their ideas for file transfers to make my own.
    For plain text files, i.e. D3 reports, I set everyone's default printer using SP-ASSING HSF99. This only ever creates a Hold File with a form queue of 99, easy to spot in the LQ listing. I then wrote an EXPORT utility program that sends the hold file to a common network location everyone has access to, in our case Z:\Temp. The users can then pick up the report and do with it as they please.

    For Excel spreadsheets, I noted there is a way to produced TSV output from a SORT or LIST command. See the D3 Reference Manual gem below:

    Tabbed Output

    AQL allows another form of output referred to as tab delimited output for use when transferring data from D3 to PC applications. Optionally, this can be selected by modifying the AQL command that is used in the AQL sentence. This is done by adding an additional mode ID (53) to the third value of attribute 2 of the master dictionary definition of the AQL command that is being used. AQL produces output delimited by tabs and each line of data is terminated with a CR for transfers to applications running on PCs.

    I created 2 new verbs SORTT and LISTT which are copies of the SORT & LIST verbs with the change to attrib 2 as noted above. It works just fine and produces a TSV file. There is a caveat though, it does not produce a header row. I have asked Rocket for a solution but none was forthcoming. I began writing a utility program to insert a header row but alas, sadly, I never managed to get it going sufficiently to make it a proper working utility. It only works for VERY simple AQL statements.

    For D3 reports generated programmatically by the application, I have a subroutine that generates CSV records from a dynamic array. It is a generic CSV utility sub that generates CSV records by default, but you can specify what field delimiter and value delimiter to use if the standard comma and quote characters are not suitable. I append the generated CSV records into a dynamic array and send it to the network using a utility program/sub that creates a Q-Pointer to the network Share be used for the file transfers (Z:\Temp in our case). Excel can then automatically import the CSV file and create a worksheet from it.

    I must admit, I rarely use the SORTT or LISTT verbs, preferring to write report programs (which give me more freedom in selection, formatting and presentation), then generating CSV records from the report lines and finally exporting the generated item to the network.

    I'm happy to share my code with you if you like to get an idea of the process or to use it in your business if needed. It's not glorious code, just gets the job done in the short space of time available to me.


    ------------------------------
    Walter Kiess
    SA Police Super
    ------------------------------



  • 5.  RE: Printing and emailing reports via PDF files

    ROCKETEER
    Posted 03-04-2021 17:30
    Edited by Brian Cram 03-04-2021 18:28
    Thanks, Walter. I've done the same thing with PDFs, CSVs and the like from D3. I have sample code.

    Vincent, before I enter those enhancement requests, I'd like your take a whether you'd be interested in the techniques that Walter has mentioned.

    ------------------------------
    Brian Cram
    Senior Technical Support Engineer
    Rocket Software
    ------------------------------



  • 6.  RE: Printing and emailing reports via PDF files

    Posted 03-04-2021 18:26
    Edited by Alberto Leal 03-04-2021 18:34
    Good night, I did it a little differently, within my system I have a 2 includes to start and end printer commands
    I did the following when starting the printer, I record the report in hold, and balance the ID of it, when I enter the part of closing the printer I take this ID from the hold, and I pass the small Java program I wrote, which reads the txt and the pdf output (using the itext lib). and then I send the file to the user's machine via kermit (I use accuterm).that way I kept the structure of all my reports, without needing to change any program. i have 2 projects in progress (actually paused) for creating pdfs and xlxs files directly in basic (without using third party tools), giving the option to generate more graphical reports directly in d3

    ------------------------------
    Alberto Leal
    Systems Analyst
    Millano distribuidora
    Campo Grande Brazil
    ------------------------------



  • 7.  RE: Printing and emailing reports via PDF files

    Posted 03-05-2021 09:47
    Brian,
    I like both Walter's and Albert's approaches and would like to see more of what each does.

    However, I think that a more seamless approach would be to have an "Excel" printer (much like what Cups-PDF does, but instead generate Excel files) and an associated DEVICE record.  That way PRINT @(-xxx) from basic would be consistent irrespective of which printer any particular report is sent to.

    Depending on the amount of information present in the generated files, with some effort, the delivery could then be scripted.

    Thanks again to both Walter and Albert.

    Best regards and keep safe,

    Vincent "Kim" Elliott
    ITC, Bearings & Accessories Ltd.
    83 Harbour Street,
    Kingston, Jamaica

    Tel: 876-922-1950
    Fax: 876-922-8129
    Cell: 876-315-2739





  • 8.  RE: Printing and emailing reports via PDF files

    Posted 03-08-2021 17:22
    Hi Vincent,

    I'm happy to share my approach(es). Let me know which one (or all) and I'll provide more info and source code for you (privately or via the forum).

    I personally don't know anything about CUPS and since I'm retiring, don't see the need to change our system to a new method. I'll leave that up to my replacement.

    ------------------------------
    Walter Kiess
    SA Police Super
    ------------------------------



  • 9.  RE: Printing and emailing reports via PDF files

    ROCKETEER
    Posted 03-12-2021 12:27
    Hey, Vincent, when would you be available for a phone call to discuss this Excel printer / DEVICE item thing? And what phone# should I call?

    ------------------------------
    Brian Cram
    Senior Technical Support Engineer
    Rocket Software
    ------------------------------



  • 10.  RE: Printing and emailing reports via PDF files

    Posted 03-12-2021 13:00

    Brian,

    It is now 1pm here.  I can be available about 3pm my time.

     

    To add to the conversation, I sent a mail to Volker Behr (the author of Cups-PDF) asking if it was possible to develop such a thing.  In his final reply he suggested that what would probably be easier was to add a post-processing script to the Cups-PDF printer that would do a PDFtoText transform the result of which Excel could then pickup as a .csv file and import.

     

    Best regards and keep safe,

     

    Vincent "Kim" Elliott

    ITC Coordinator

    Bearings & Accessories Ltd.

    83 Harbour Street

    Kingston

    Jamaica, W.I.

     

    Tel: 876-922-1950

    Cell: 876-315-2739

    Email: vincent.e@bearingsandaccessories.com

     

     






  • 11.  RE: Printing and emailing reports via PDF files

    ROCKETEER
    Posted 03-12-2021 13:06
    I'll ping you around then ( noon my time ). Ask me about Python and Excel.

    ------------------------------
    Brian Cram
    Senior Technical Support Engineer
    Rocket Software
    ------------------------------



  • 12.  RE: Printing and emailing reports via PDF files

    Posted 03-12-2021 13:05

    Brian,

    I forgot the phone number...it is 876-315-2739.

     

    Best regards and keep safe,

     

    Vincent "Kim" Elliott

    ITC Coordinator

    Bearings & Accessories Ltd.

    83 Harbour Street

    Kingston

    Jamaica, W.I.

     

    Tel: 876-922-1950

    Cell: 876-315-2739

    Email: vincent.e@bearingsandaccessories.com

     

     






  • 13.  RE: Printing and emailing reports via PDF files

    ROCKETEER
    Posted 03-12-2021 15:00
    Here's the links to D3 documents, including D3 with Python:

    https://www3.rocketsoftware.com/rocketd3/support/documentation/d3server.jsp

    As far as that Python course we discussed, Google "automate the boring stuff with python" and the book, the PDF, the Udemy course links will all come up.

    I'll take another look at LPPICK and see about passing down a file name to CUPS and get back to you.

    ------------------------------
    Brian Cram
    Senior Technical Support Engineer
    Rocket Software
    ------------------------------