Midrange News for the IBM i Community


Posted by: Alex Fishbein
Running PC Commands
has no ratings.
Published: 04 Oct 2012
Revised: 23 Jan 2013 - 1519 days ago
Last viewed on: 22 Mar 2017 (2924 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Running PC Commands Published by: Alex Fishbein on 04 Oct 2012 view comments(5)

I am trying to run a Visual Basic program from RPG using runrmtcmd.

The VB program prints image files (JPEG).

When I run this program from PC it runs fine, but when i run it from RPG i get an error msg.

Also if anyone knows a way to print images from RPG, that would also work.

 

This is an error i am getting.

 

Unhandled Exception: System.ComponentModel.Win32Exception: An attempt was made to reference a token that does not exist at System.Drawing.Printing.StandardPrintController.OnStartPrint(PrintDocument document, PrintEventArgs e)  at System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPrint(PrintDocument document, PrintEventArgs e) at System.Drawing.Printing.PrintController.Print(PrintDocument document)  at System.Drawing.Printing.PrintDocument.Print() at DirectPrint.Module1.Main()                                                   

 

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: clbirk
Premium member *
Comment on: Running PC Commands
Posted: 4 years 5 months 17 days 7 hours 38 minutes ago

what are you running on the pc side, that is what is the rmtcmd calling?

 

Typically, I call a "bat" that has the exe in it. I use aaron bartell's mowyourlawn.com rpg2dt stuff that uses a job queue (and I do all sorts of things). So you can call that from within rpg. If at the cl/ocl level you can do it with of course strpccmd. As I recall, I had a few issues when the strpccmd called the program directly but no problem when I call a bat. I have maybe a dozen different dot net's that I call hundreds of times every day.

Posted by: Ringer
Premium member *
Comment on: Running PC Commands
Posted: 4 years 5 months 17 days 6 hours 9 minutes ago

Not sure if this is an option for you, but if you put instead store the JPEG in a PDF on the IFS, then you could just open( ) the PDF with RPG, read( ) it, and WRITE to most printers (DEVD) as straight ASCII. Most printers now can sniff the byte stream as PDF and print it correctly.

Chris Ringer

Posted by: alexfishbein
Premium member *
Comment on: Running PC Commands
Posted: 4 years 5 months 5 days 8 hours 10 minutes ago

Actually I've been going back and forth with IBM on this for weeks now. All I am trying to do is to print a style report with the image of the style. I moved all the picture into an IFS folder and created an rpg that reads the style file and creates an external printer file that I am listing bellow. When the spool file is created the image is there, but when I print it nothing comes out. 

 

     A          R HDR01                                                            

     A  20        XXJPEG       100A     2  5                                       

     A                               O  2100'CAD901PF'                             

     A                                      FONT(34123 (*POINTSIZE 4))             

     A  20        XXPATH       100A     3  5                                       

     A                               O  4  5'STYLE .:'                             

     A            XXSTY         20A     4 15                                       

     A            SMNAME        30A     4 65                                       

     A  90                           O  5  5'DOZENS :'                             

     A  90        XXDOZ          7  2   5 16EDTCDE(Q)                              

     A  90                           O  6  5'PRICE .:'                             

     A  90        XXPRIC         7  2   6 15EDTCDE(Q $)                            

     A  90                           O  7  5'CANCEL :'                             

     A  90        XXCXL          8  0   7 15EDTWRD('  /  /    ')                   

     A          R #MYLOGO                   TEXT('THUMBNAIL')                      

     A                                      AFPRSC(&MYJPEG *JFIF +                 

     A                                      1.5 8.5 (*PATH &MYPATH) +              

     A                                      (*SIZE 8.00 8.80) +                    

     A                                      (*ROTATION 90) +                       

     A                                      (*MAPOPT *ST))                         

     A            MYJPEG       100A  P                                             

     A            MYPATH       300A  P                                              

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Running PC Commands
Posted: 4 years 5 months 5 days 3 hours 12 minutes ago

Check your PC printer configuration. Is it ASCII? Do you have HOST Transform set on? Is the printer an AFP or IPDS printer device? etc.

 

Posted by: alexfishbein
Premium member *
Comment on: Running PC Commands
Posted: 4 years 5 months 5 days 2 hours 31 minutes ago

We're using an HP Color LazerJet printer. Host transform is set to yes. I think the printer is AFP