Not able to print to pdf

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Not able to print to pdf

mbruce
I'm sorry, this has probably been covered, but I'm having no luck finding a solution after an hour of searching.  I'm using Octave Ver 3.6.0 with Windows XP, and not able to create a pdf from a plot.  If I use the following code:

figure(1)
semilogx(freq,normatt)
title('SPL vs. Frequency, 16kHz')
xlabel('Frequency')
ylabel('dB')
axis([100,16000,-12,3])
legend('On Axis','5 Deg','10 Deg','15 Deg','20 Deg','25 Deg','30 Deg','35 Deg','40 Deg','45 Deg','50 Deg','55 Deg','60 Deg','65 Deg','70 Deg','75 Deg','80 Deg','85 Deg','90 Deg','Location','SouthEastOutside')
print figure1.pdf

My figure plots, but no file is created.  If I change the file extension as follows: figure1.gif, then I have a gif file created.  I really need to make a pdf out of this data...  Please help.

Thank you,

Mike
Reply | Threaded
Open this post in threaded view
|

Re: Not able to print to pdf

pathematica
This post was updated on .
I think you need to specify the appropriate device using -dpdf as follows:

>print  -dpdf  figure1.pdf

Best wishes



PS the relevant section in the manual is here:

http://www.gnu.org/software/octave/doc/interpreter/Printing-Plots.html
However good you think Octave is, it's much, much better.
Reply | Threaded
Open this post in threaded view
|

Re: Not able to print to pdf

mbruce
I have added the -dpdf command, but it doesn't seem to make a difference.

Thanks,

Mike
Reply | Threaded
Open this post in threaded view
|

Re: Not able to print to pdf

Matt Nicholas
I would have suggested the -dpdf option as well, and someone more
experienced with octave may be able to help you get it working. One idea
as a temporary workaround: try -deps or -dps to create a postscript
file, and convert to PDF using adobe distiller or the ps2pdf utility.

Matt

On 3/16/12 7:07 PM, mbruce wrote:

> I have added the -dpdf command, but it doesn't seem to make a difference.
>
> Thanks,
>
> Mike
>
> --
> View this message in context: http://octave.1599824.n4.nabble.com/Not-able-to-print-to-pdf-tp4479550p4479615.html
> Sent from the Octave - General mailing list archive at Nabble.com.
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://mailman.cae.wisc.edu/listinfo/help-octave
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Not able to print to pdf

bpabbott
Administrator
In reply to this post by mbruce

On Mar 16, 2012, at 6:42 PM, mbruce wrote:

> I'm sorry, this has probably been covered, but I'm having no luck finding a
> solution after an hour of searching.  I'm using Octave Ver 3.6.0 with
> Windows XP, and not able to create a pdf from a plot.  If I use the
> following code:
>
> figure(1)
> semilogx(freq,normatt)
> title('SPL vs. Frequency, 16kHz')
> xlabel('Frequency')
> ylabel('dB')
> axis([100,16000,-12,3])
> legend('On Axis','5 Deg','10 Deg','15 Deg','20 Deg','25 Deg','30 Deg','35
> Deg','40 Deg','45 Deg','50 Deg','55 Deg','60 Deg','65 Deg','70 Deg','75
> Deg','80 Deg','85 Deg','90 Deg','Location','SouthEastOutside')
> print figure1.pdf
>
> My figure plots, but no file is created.  If I change the file extension as
> follows: figure1.gif, then I have a gif file created.  I really need to make
> a pdf out of this data...  Please help.
>
> Thank you,
>
> Mike

Please add "-debug" to the print statement and tell us what the result is.

        print -debug figure1.pdf

Ben


_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Not able to print to pdf

mbruce
I get the following:

---- begin C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-35.ps ----
%!PS-Adobe-3.0
<< /Margins [0 0] /.HWMargins [0 0 0 0] /PageOffset [18 180] >> setpagedevice
%%EOF
----- end C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-35.ps -----
Ghostscript command: 'C:\Octave\OCTAVE~1.2\OCTAVE~1.2\gs\gs9.04\bin/gswin32c.exe -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dEmbedAllFonts=true -dOptimize=true -dEPSCrop -sPAPERSIZE=letter -dFIXEDMEDIA -sOutputFile=figure1.pdf C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-35.ps C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-34.eps'
gnuplot-pipeline: 'C:\Octave\OCTAVE~1.2\OCTAVE~1.2\gs\gs9.04\bin/gswin32c.exe -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dEmbedAllFonts=true -dOptimize=true -dEPSCrop -sPAPERSIZE=letter -dFIXEDMEDIA -sOutputFile=figure1.pdf C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-35.ps C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-34.eps & del C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-34.eps & rm C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-35.ps'
'\\homeusa1\home\MICHAE~2\Temp\SPEAKE~1\Octave'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.

Thanks,

Mike
Reply | Threaded
Open this post in threaded view
|

Re: Not able to print to pdf

pathematica
This post was updated on .
Perhaps the file has been printed in an unexpected directory.

You might try using "Windows Search" to see if you can find it (I note that you called it "figure1.pdf").

Alternatively, you might try including the explicit directory path (I'm afraid I gave up on Windows some time ago and I don't know how to specify the path to eg your Desktop in the recent versions eg Windows 7).

In Linux, to print in my home folder, the command would be

> print -dpdf /home/david/filename.pdf

From fading memory, I think it will go to the root directory (C:\) in Windows with

> print -dpdf C:\filename.pdf

I guess that would not be convenient but you could change the path to one of your choice.

(Caution: if you're not familiar with Linux, note that filepaths use forward slashes in Linux and backward slashes in Windows)
However good you think Octave is, it's much, much better.
Reply | Threaded
Open this post in threaded view
|

Re: Not able to print to pdf

bpabbott
Administrator
In reply to this post by mbruce

On Mar 16, 2012, at 7:28 PM, mbruce wrote:

> I get the following:
>
> ---- begin C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-35.ps ----
> %!PS-Adobe-3.0
> << /Margins [0 0] /.HWMargins [0 0 0 0] /PageOffset [18 180] >>
> setpagedevice
> %%EOF
> ----- end C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-35.ps -----
> Ghostscript command:
> 'C:\Octave\OCTAVE~1.2\OCTAVE~1.2\gs\gs9.04\bin/gswin32c.exe -dQUIET
> -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dEmbedAllFonts=true
> -dOptimize=true -dEPSCrop -sPAPERSIZE=letter -dFIXEDMEDIA
> -sOutputFile=figure1.pdf C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-35.ps
> C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-34.eps'
> gnuplot-pipeline:
> 'C:\Octave\OCTAVE~1.2\OCTAVE~1.2\gs\gs9.04\bin/gswin32c.exe -dQUIET
> -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dEmbedAllFonts=true
> -dOptimize=true -dEPSCrop -sPAPERSIZE=letter -dFIXEDMEDIA
> -sOutputFile=figure1.pdf C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-35.ps
> C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-34.eps & del
> C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-34.eps & rm
> C:\DOCUME~1\mbruce\LOCALS~1\Temp\oct-35.ps'
> '\\homeusa1\home\MICHAE~2\Temp\SPEAKE~1\Octave'
> CMD.EXE was started with the above path as the current directory.
> UNC paths are not supported.  Defaulting to Windows directory.
>
> Thanks,
>
> Mike


We applied a recent patch that should fix the problem you're seeing.

        http://hg.savannah.gnu.org/hgweb/octave/rev/61cc4c715962

You can try to manually apply it. If so, please make a backup copy of __print_parse_opts__.m in case something goes wrong.

Ben


_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Not able to print to pdf

mbruce
In reply to this post by pathematica
THAT'S IT!  It was printing to my Windows folder...  Strange that the .gif files print to the expected directory, but not the .pdf.

Thanks!

Mike
Reply | Threaded
Open this post in threaded view
|

Re: Not able to print to pdf

pathematica
This post was updated on .
I think the file is converted to pdf by the open source program Ghostscript (gs) (possibly used as a backend by Octave under Windows for this particular print function).

I don't really understand your debug output but I suspect that it was Ghostscript that printed it to the root directory rather than Octave.

When printing the gif file, it was probably created by Octave directly, which could access the correct directory.
However good you think Octave is, it's much, much better.