Inkscape export from PDF to EMF with the command line (output is blank) - inkscape

I'm trying to convert a PDF file (of only one page) to EMF. If I do it from the Inkscape GUI with the default options the outcome is perfect.
But if I do it with command line the outcome is a blank page.
I'm using this command:
inkscape -f=test.pdf --export-emf=test.emf
Can anybody help?

Inkscape is working. I was trying to open the file with paint.exe

Related

Sublime Text 3 files not opening in command line/powershell

I’ve just finished Codecademy and am setting up Python (2.7) and Sublime Text 3 on my own computer using the Codecademy guide page. I can successfully perform simple operations (eg. Print “Hello world”) a) in Python and b) by using ctrl+b on text in my Sublime Text 3 editor page, which gives the output in the box at the bottom of the page.
I’m stuck/confused when it comes to running the Sublime Text 3 file through the command line and confused on the powershell vs. command line issue (I’m running Windows 10).
My command line does not display the $ sign in the codecademy page example (https://www.codecademy.com/articles/setup-python), so should I be entering the commands below through Powershell rather than the command line? If so, I don’t get the $ in Powershell either.
If I carry on regardless and try to change directories etc through Command Prompt or Powershell, I only get error messages and can't seem to run the Sublime Text 3 file.
I’m also not clear on whether this is an issue about which directory I’m in. Running dir in both the Command prompt and Powershell returns the result: after I’ve opened Python, but lists all subfolders of C:\Users\my_name if I run it before opening Python. Does this mean that I need to save my Sublime Text files in some sort of subfolder of Python in order to be able to run them as above?
Or does it not matter that I’m not able to run the Sublime Text 3 files through Python directly and I should just stick to doing so through Sublime Text 3 itself? Will this limit me later on?
Thanks for your help
BC89

rmarkdown error: "myfile.tex"' had status 1

I am trying to compile an RMarkdown document from an R script. This is the code I am running:
setwd("C:/Users/me/me_VN02_5676/myfolder")
rmarkdown::render("myrmd.Rmd",
output_file = "mypdf.pdf")
This results in the error:
Error: Failed to compile mypdf.tex.
In addition: Warning message:
running command '"pdflatex" -halt-on-error -interaction=batchmode "mypdf.tex"' had status 1
Does anyone know what is happening?
Additional Notes
The PDF file is created when I use the Knit button in RStudio
This code does produce the .Tex file and when I run that it produces the pdf but render() does not produce the pdf
When I run the .R file via the command line it works! The PDF is created but why doesn't it work in R studio?
It would help to provide a Minimal Working Example so that we can attempt to replicate the problem. However, there may be two potential causes:
File Paths Look Incorrect
In R, they should be specified with a single forward slash: https://stat.ethz.ch/R-manual/R-devel/library/base/html/file.path.html
setwd("C:/Users/me/me_VN02_5676/myfolder")
rmarkdown::render("myrmd.Rmd",
output_file = paste0("mypdf.pdf")
)
PDF Output File May be Open
Another potential cause of this is that the PDF file is open, and therefore pandoc cannot save the output PDF. Try closing the PDF and render the document again.
Link to previous issue in Knitr which relates to this: https://github.com/yihui/knitr/issues/1209

python error can't open pdf in application from python

I am using windows 10 and python 2.7.13 .
My target is to open a pdf in acrobat reader at a specific page number.
I am using the code I received from one of the questions in the forum here.
import subprocess
import os
path_to_pdf = os.path.abspath('C:\test_file.pdf')
# I am testing this on my Windows Install machine
path_to_acrobat = os.path.abspath('C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe')
# this will open your document on page 12
process = subprocess.Popen([path_to_acrobat, '/A', 'page=12', path_to_pdf], shell=False, stdout=subprocess.PIPE)
process.wait()
It opens up the acrobat reader application but the file doesnt open and i get the error :"There was an error opening this document. The filename, directory name, or volume label syntax is incorrect
but when I use these commands in cmd without python I am successfully able to open the pdf without any error. Please help.
Try to open the file with r:
path_to_pdf = os.path.abspath(r'C:\test_file.pdf')
path_to_acrobat = os.path.abspath(r'C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe')
Check this out too, it will show to you an example of an error with the white spaces on the path
Please check the path of your acrobat reader.
In my case:
path_to_acrobat = os.path.abspath('C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\AcroRd32.exe')

How can I select a drop down menu when I save a file using Applescript?

I've been trying to program an AppleScript that writes and exports an AppleScript . And so far, I've gotten as far as automating the writing of the script and getting to the "Export..." menu. I've pasted link to a screen shot of the menu that I've gotten to below.
Link to image
can someone please let me know (in the simplest way possible) a way to automate the clicking of the Application option under the drop down menu (is it called that?) named File Format using apple script. Can someone also please inform me of (if there is) a way to automate the clicking of the Run Only check box? If you are unsure what is where, the two spots (the list and the check box) is squared in red in the image.
#Darrick Herwehe's answer has the crucial pointer: use oascompile to compile AppleScript source code - no need for (cumbersome and error-prone) GUI scripting.
If you wanted to compile your AppleScript (plain-text) source file - e.g., some.applescript to:
application (bundle) some.app
with the execute-only (run-only) option (i.e., the plain-text source code is NOT included in the bundle)
you'd run
osacompile -x -o some.app some.applescript
Alternatively, you can even provide the source code as a _string:
osacompile -x -o some.app -e 'display alert "hello, world"'
If you wanted to achieve the same thing from AppleScript itself:
set src to "display alert \"hello, world\""
do shell script "osacompile -x -o ~/some.app -e " & quoted form of src
Note that the output format - an application bundle in this case - is inferred from the filename extension of the output filename passed to -o.
To invoke some.app directly from its output folder for a quick test, use:
open ./some.app
Caveat: There's at least 1 bug (around since at least 2012 and still there in OS X 10.9.2) that causes osacompile to compile incorrectly; see osacompile changing the AppleScript output so it won't run

How to open text file in notepad with cmd window in background?

I want to open a text file without opening cmd window in the background. I have tried:
webbrowser.open('file.txt')
but it crashes ArcGIS so I tried following:
os.system('file.txt')
it opens text file without crashing ArcGIS but cmd window remains in the background and goes away when I close text file.
It is more of a display choice question and just checking if there is any suggestion to avoid cmd window in the background.
I don't know if this is what you want, but maybe you should create .bat file (something like here) and run this with Python subprocess.
Save your script with a .pyw extension and the console window won't appear.
From the Python documentation :
On Windows systems, there is no notion of an “executable mode”. The Python installer automatically associates .py files with python.exe so that a double-click on a Python file will run it as a script. The extension can also be .pyw, in that case, the console window that normally appears is suppressed.
You need to modify the program that calls the "add-in script" to run it with pythonw.exe (and not python.exe which is the default).