help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Print to PDF with MikTeX under microweak if your gnuplot can not handle


From: Stefan Pofahl
Subject: Print to PDF with MikTeX under microweak if your gnuplot can not handle pdf output
Date: Fri, 13 Mar 2009 21:34:01 +0100

Hello,
here is my workaround for people that want to plot to PDF
with the recent Octave for windows.
Regards,

Stefan

======================================================================================
function my_ps2pdf()
  ## Shows how to print to pdf file with the miktex tools "pdfopen",
"pdfclose", "ps2pdf"
  ## So you need a working "miktex" installation on your machine.
  ## Maybe you have to edit the file so that it runs on your machine,
for example this
  ## version is made for WIN-XP users and you need a disc "e:"
  clf()
  X=(0:1:40)';
  Y0=0.98717.**(X);
  Y1=0.97600.**(X);
  Y2=0.96500.**(X);
  Y3=0.95240.**(X);
  plot(X,Y0,X,Y1,X,Y2,X,Y3)
  grid("on");
  ## ---
  printfile = "foo";
  print(["e:/",printfile,".ps"], "-landscape", "-dpsc");
  ## Build command string
--------------------------------------------------------------------------
  ## Precautions for non-admin Acrobat Reader Users under WIN-XP:
  ## If the file already exist, it could be that it is already blocked
by "Acrobat Reader".
  ## To be sure that we have a proper grip on the pdf file we open it
with "pdfopen".
  ## Now we can be sure that we can close the file even if we are
non-admins and the
  ## file was looked at with the aggressive "Acrobat Reader".
  command = ["cmd /d /c ""ECHO IF EXIST ""e:\\", printfile, ".pdf""
call pdfopen --file=""e:\\", ...
              printfile, ".pdf""> e:\\kw.bat&&ECHO IF EXIST ""e:\\", ...
              printfile, ".pdf"" call pdfclose --file=""e:\\", ...
              printfile, ".pdf"">> e:\\kw.bat"""]
  ## Notice:
  ## The following is wrong, when you work in async-mode, there can be
no feed back to your command:
  ## This is wrong: [status1, message] = system(command, 1, "async");
  ## You would receive the error message:
  ## "error: element number 2 undefined in return list"
  status = system(command, 1, "async");

  ## Now we can be sure that the output file is not blocked by "Acrobat Reader".
  command = ["ps2pdf e:/", printfile, ".ps e:/", printfile, ".pdf"]
  status = system(command, 1, "async");
endfunction

======================================================================================

-- 
Tel.: 0731-3805149
Ochsensteige 48
89075 Ulm


reply via email to

[Prev in Thread] Current Thread [Next in Thread]