Page 1 of 2

Problem on saving chart as a pdf by programming.

Posted: Mon Jul 30, 2012 7:11 am
by Liu
Hi all,

I understand that eviews might not let users save a chart in a PDF format as an option of graph.save. However, I installed a software to enable my
computer to do so.

My problem is: how can I do it by programming. Right now, whenever I want to save a chart, I have to open a chart, click" Print" , and select printer (which is the software I use to save as PDF file). Can I use commands to do all these? This is because I have roughly a hundred charts created by a program. To save them by clicking is really painful. It would save much time if I could do them by commands.

Thanks in advance.

Re: Problem on saving chart as a pdf by programming.

Posted: Mon Jul 30, 2012 7:58 am
by EViews Gareth
Since EViews doesn't offer printing to a PDF document, there is no way to print to a PDF document via the command line / in a program.

Re: Problem on saving chart as a pdf by programming.

Posted: Mon Jul 30, 2012 8:33 am
by Liu
Hi Gareth,

I understand what you mean, but what I mean is: is there a way I can convert the manual work into command:
theoratically, all the actions (such as clicking, manual inputting etc.) have commands behind the shell.
If I can do something via clicking, I should be able to also do it via commanding. Just my quick thought though.

The key of the problem is: how to assign a printer as eviews' printing device by command.
I tried the print command options, but didn't find what argument I should change to set my external
software (which I used to save a chart as PDF) as default printer. If I can do the printer setting by command, I think
the problem is solved.

Re: Problem on saving chart as a pdf by programming.

Posted: Mon Jul 30, 2012 8:44 am
by startz
Two things:

Gareth: Would it be possible to use Print Setup and set the printer to a pdf driver? At least only one manual intervention would be required?

Liu: Perhaps surprisingly, EViews isn't a shell on top of commands. A lot of the GUI is hardwired to the code, with the commands being the add-on.

Re: Problem on saving chart as a pdf by programming.

Posted: Mon Jul 30, 2012 9:16 am
by EViews Gareth
I think the issue you're both missing is that EViews isn't offering the GUI that does the PDF printing. That is offered by whatever software you downloaded that offers PDF printing.

Liu when you say that:
If I can do something via clicking, I should be able to also do it via commanding. Just my quick thought though.
This is only true for things that EViews does. EViews does not do PDF printing, therefore there is no command to do it.


All you can do in EViews is select a printer. Anything that happens after EViews has sent a document to print is not controllable by EViews.

Re: Problem on saving chart as a pdf by programming.

Posted: Mon Jul 30, 2012 9:20 am
by startz
Uh, if the default print driver happens to be a pdf driver (nothing to do with EViews) won't printing send out pdfs? Or is the problem that the pdf print driver needs interaction that can't be automated inside EViews?

Alternatively, send files to a spool and then print the spool to pdf manually???

Re: Problem on saving chart as a pdf by programming.

Posted: Mon Jul 30, 2012 9:49 am
by EViews Glenn
In principle, yes to the first question, but as you have speculated, the problem is that most drivers that print to a file prompt you for the output file name.

Re: Problem on saving chart as a pdf by programming.

Posted: Mon Jul 30, 2012 11:42 am
by Liu
I think the issue you're both missing is that EViews isn't offering the GUI that does the PDF printing. That is offered by whatever software you downloaded that offers PDF printing.

Liu when you say that:
If I can do something via clicking, I should be able to also do it via commanding. Just my quick thought though.
This is only true for things that EViews does. EViews does not do PDF printing, therefore there is no command to do it.


All you can do in EViews is select a printer. Anything that happens after EViews has sent a document to print is not controllable by EViews.

Hi Gareth,
That's exactly what I want. It would be great if I could use commands to select a printer, which will bypass the limitation that eviews can't save pdf.
I guess it might be a command like: print (printer=PDFwriter) chart1 . This way I don't have to open each chart and click print then click printer everytime.

Hi Startz and Glenn:
you are right that the external software does require a file name when I intend to "print" to the PDF printer. However, that is not a big problem since the chartname is the default file name (or at least I can solve that problem later.)
It would be great if I can assign a printer as default printer by defaut. Right now the default printing device for eviews is the last device used for printing.

Re: Problem on saving chart as a pdf by programming.

Posted: Mon Jul 30, 2012 11:50 am
by EViews Glenn
Should be the default printer for your system. If you change your system printer EViews should pick that up.

Re: Problem on saving chart as a pdf by programming.

Posted: Tue Jul 31, 2012 1:14 pm
by Liu
The default printer is always the last printing device being used by eviews. The system printer unfortunately is not recognized as default for eviews.
Can I use a command to verbally assign a printer as default printer in the printing command?

Right now, I used print chart1 to save chart1 in a pdf format, and it took me to the PDF-writer interface. The question is:
can I ask eviews to hit enter for me? I know eviews can do it to certain programs but I'm not sure how I can achieve it in this case.

Many thanks.

Re: Problem on saving chart as a pdf by programming.

Posted: Tue Jul 31, 2012 2:09 pm
by EViews Glenn
I never change printers so I wasn't sure about that one. Thanks. Unfortunately, you'll have to change the driver by hand.

Unfortunately, EViews is not going to be able to communicate with the print driver for you. Drivers sometimes have settings that allow you to skip the prompt step, but that's really driver specific.

Re: Problem on saving chart as a pdf by programming.

Posted: Tue Jul 31, 2012 2:13 pm
by startz
Liu,

Gareth is a little distracted at the moment :D

To solve your practical problem, send all your graphs to one spool. Then manually print that one spool to a pdf.

Problem on saving chart as a pdf by programming.

Posted: Tue Jul 31, 2012 3:35 pm
by EViews Gareth
Or, find a PDF printing program that has full command prompt support, then save your graphs to disk within EViews and then use the Shell or Spawn commands to trigger the PDF printer.

Re: Problem on saving chart as a pdf by programming.

Posted: Tue Jul 31, 2012 3:56 pm
by startz
Or, find a PDF printing program that has full command prompt support, then save your graphs to disk within EViews and then use the Shell or Spawn commands to trigger the PDF printer.
Try irfanView http://www.irfanview.com/

Re: Problem on saving chart as a pdf by programming.

Posted: Wed Aug 01, 2012 9:10 am
by Liu
I never change printers so I wasn't sure about that one. Thanks. Unfortunately, you'll have to change the driver by hand.

Unfortunately, EViews is not going to be able to communicate with the print driver for you. Drivers sometimes have settings that allow you to skip the prompt step, but that's really driver specific.
From what I understand, this limitation is basically solved by using spool and shell commands, as long as the software has command-line interfaces? So the idea is: spawn a command to a
cli based pdf writer? (I guess Irfanview meets both requirements since Startz recommended it.)

just a quick question here, can I use spawn/shell to push multiple commands to external software?
such as

Code: Select all

spawn "c:\program\irfanview.exe" save /path/ chart1 exit irfanview.exe