wkhtmltopdf command fails in Meteor app - meteor

I'm working on a Meteor app. And, in a section of the app, there is requirement to render a html page into pdf file.
wkhtmltopdf is install properly in my local machine with linux distribution (i.e. Ubuntu 16.04), and pdf are also generated if I execute following command:
wkhtmltopdf https://google.com google.pdf
In Meteor app, certain html template file is to be converted into pdf, and the logic is written as follows:
wkhtmltopdf --dpi 300 --margin-top ...
But when the action is carried out for conversion in the back-end logic, following error occurs:
Error: Command failed: wkhtmltopdf --dpi 300 --margin-top 0 --margin-right 0 --margin-bottom 0 --margin-left 0 /tmp/118330-6025-bh2dza.0pcwa.html /tmp/118330-6025-ou28zs.pz78.pdf
In my local envrionment path for wkhtmltopdf is set properly, and works fine. But, for the Meteor app the command fails.
Any help/suggestion?

Related

Quarto render with .cmd file

Wrote a previous question related to rendering a quarto document with a .cmd file (quarto_render broken from .bat / .cmd file), but with the recent updates to RStudio, the pathing has changed as well as the commands needed for rendering a quarto doc as html, and I am once again stuck.
Much like before, this is a multi-step process, though I think I have a better understanding, thanks to the previous responses. For one thing, learned that the quarto render executable is from RStudio, not from R, which means updates to the RStudio IDE have a greater impact on the rendering process than R language updates.
RStudio version
(RStudio 2022.12.0+353 "Elsbeth Geranium" Release (..., 2022-12-03) for Windows Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2022.12.0+353 Chrome/102.0.5005.167 Electron/19.1.3 Safari/537.36)
R Version (4.2.2)
File 1 - test_doc.qmd
Create a new .qmd document (I called mine test_doc.qmd).
Set to an output of html, and kept default YAML and other text. No modifications.
File 2 - test.cmd
After running the first two lines in the command prompt, and PAUSE the Error output is written below. This is a vexing error, since I've tried various iterations of the code below to account for this error, but then keep getting other error messages
{Command Prompt}
D:
D:\>"D:\Program Files\RStudio\resources\app\bin\quarto\bin\quarto.exe" render "C:\Users\%usernmae%\OneDrive - ...\Projects\Test\test_doc.qmd" PAUSE
ERROR: Error executing 'Rscript': program not found
Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/
Results of Quarto Check in RStudio Terminal
[>] Checking Quarto installation......OK
Version: 1.2.269
Path: d:\Program Files\RStudio\resources\app\bin\quarto\bin
CodePage: 1252
[>] Checking basic markdown render....OK
[>] Checking Python 3 installation....(None)
Unable to locate an installed version of Python 3.
Install Python 3 from https://www.python.org/downloads/
[>] Checking R installation...........OK
Version: 4.2.2
Path: D:/Program Files/R/R-4.2.2
LibPaths:
- D:/Program Files/R/R-4.2.2/library
rmarkdown: 2.20
[>] Checking Knitr engine render......OK
Results of Quarto Check in Command Prompt
{Command Prompt}
D:\>"D:\Program Files\RStudio\resources\app\bin\quarto\bin\quarto.exe" check
[>] Checking Quarto installation......OK
Version: 1.2.269
Path: D:\Program Files\RStudio\resources\app\bin\quarto\bin
CodePage: 1252
[>] Checking basic markdown render....OK
[>] Checking Python 3 installation....(None)
Unable to locate an installed version of Python 3.
Install Python 3 from https://www.python.org/downloads/
[>] Checking R installation...........(None)
Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/
Although, there is an install of 4.2.2 located in the D drive as well...
and quarto.exe --help in RStudio Terminal
quarto.exe --help
Usage: quarto
Version: 1.2.269
Description:
Quarto CLI
Options:
-h, --help - Show this help.
-V, --version - Show the version number for this program.
Commands:
render [input] [args...] - Render files or projects to various document types.
preview [file] [args...] - Render and preview a document or website project.
serve [input] - Serve a Shiny interactive document.
create [type] [commands...] - Create a Quarto project or extension
create-project [dir] - Create a project for rendering multiple documents
convert <input> - Convert documents to alternate representations.
pandoc [args...] - Run the version of Pandoc embedded within Quarto.
run [script] [args...] - Run a TypeScript, R, Python, or Lua script.
add <extension> - Add an extension to this folder or project
install [target...] - Installs an extension or global dependency.
publish [provider] [path] - Publish a document or project. Available providers include:
check [target] - Verify correct functioning of Quarto installation.
help [command] - Show this help or the help of a sub-command.
Results in Command Prompt
{Command Prompt}
D:\>"D:\Program Files\RStudio\resources\app\bin\quarto\bin\quarto.exe" --help
Usage: quarto
Version: 1.2.269
Description:
Quarto CLI
Options:
-h, --help - Show this help.
-V, --version - Show the version number for this program.
Commands:
render [input] [args...] - Render files or projects to various document types.
preview [file] [args...] - Render and preview a document or website project.
serve [input] - Serve a Shiny interactive document.
create [type] [commands...] - Create a Quarto project or extension
create-project [dir] - Create a project for rendering multiple documents
convert <input> - Convert documents to alternate representations.
pandoc [args...] - Run the version of Pandoc embedded within Quarto.
run [script] [args...] - Run a TypeScript, R, Python, or Lua script.
add <extension> - Add an extension to this folder or project
install [target...] - Installs an extension or global dependency.
publish [provider] [path] - Publish a document or project. Available providers include:
check [target] - Verify correct functioning of Quarto installation.
help [command] - Show this help or the help of a sub-command.
Needless to say, any help with this would be greatly appreciated. Have tried variations on the theme above, but am really struggling with figuring this process out. Thank you for the assist!

Clion external tools output not showing anymore?

I configured two external tools commands
catkin build my_project
roslaunch my_project my_launch.launch
Now when I invoke command 1 I see the output and everything works. When I launch the second command also everything gets started and works, but I don't see any output. At the beginning I had only command 2 and it did show me my output, then after adding command 1, I didn't get any output anymore. Now I tried to remove command 1 to only have command 2 but I still see no output. What gives?
This is how the command is configured

Cannot load plugin `ipynb.markup` | ImportError: No module named 'IPython' when i input"pelican content"

i want to use "pelican content" to create a html file with a '.ipynb' file, however,it goes wrong. (C:\Users\Administrator\Anaconda3) D:\jupyter-blog>pelican content
WARNING: PLUGIN_PATH setting has been replaced by PLUGIN_PATHS, moving it to the new setting name.
WARNING: Defining PLUGIN_PATHS setting as string has been deprecated (should be a list)
ERROR: Cannot load pluginipynb.markup
| ImportError: No module named 'IPython'
WARNING: No valid files found in content.
Done: Processed 0 articles, 0 drafts, 0 pages and 0 hidden pages in 0.08 seconds.
i have checked that there's no problem with ipython,but why it still has this error.
As mentioned in your error, you should install IPython or bash could not detect IPython. You should check your python version to see if there is problem with the 2 different python version on your terminal. I would share my solving experience on meeting this problem.
python --version
activate python2(3)
And make sure the exact version of python has been attached to the PATH and put in the first place compared to the other version of Python.
Then use
python -m pip install IPython

ipython notebook doesn't use custom css file

I am trying to use custom themes with my ipython notebooks. For this purpose I have first created a new profile:
C:\>ipython profile create teststyle
[ProfileCreate] Generating default config file: u'C:\\Users\\mayankpj\\.ipython\\profile_teststyle\\ipython_config.py'
[ProfileCreate] Generating default config file: u'C:\\Users\\mayankpj\\.ipython\\profile_teststyle\\ipython_qtconsole_config.py'
[ProfileCreate] Generating default config file: u'C:\\Users\\mayankpj\\.ipython\\profile_teststyle\\ipython_notebook_config.py'
[ProfileCreate] Generating default config file: u'C:\\Users\\mayankpj\\.ipython\\profile_teststyle\\ipython_nbconvert_config.py'
Then I have replaced the "C:\Users\mayankpj.ipython\profile_teststyle\static\custom\custom.css" file with the one from here: https://github.com/nsonnad/base16-ipython-notebook
I grabbed one of the css files and renamed it to custom.css and replaced the above file with it.
Now, I launched the ipython notebook session with the above profile:
C:\>ipython notebook --profile=teststyle
2014-12-16 04:11:44.407 [NotebookApp] Using existing profile dir: u'C:\\Users\\mayankpj\\.ipython\\profile_teststyle'
2014-12-16 04:11:44.500 [NotebookApp] Serving local MathJax from C:\Users\mayankpj\.ipython\nbextensions\mathjax\MathJax.js at /nbextensions/mathjax/M
athJax.js
2014-12-16 04:11:44.828 [NotebookApp] Serving notebooks from local directory: C:\
2014-12-16 04:11:44.828 [NotebookApp] 0 active kernels
2014-12-16 04:11:44.828 [NotebookApp] The IPython Notebook is running at: http://localhost:8888/
2014-12-16 04:11:44.828 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
However, when i create a new notebook, it is same as earlier. I have updated my ipython to 2.3.0 and am using pythonxy distribution on windows 8. I have installed local copy of mathjax and pandoc on my machine and can export notebooks as html and rst files.
Any help would be greatly appreciated!
EDIT: I also tried incognito mode of browser but to no avail. Also, i looked at the js console, it had the following info:
Default extension for cell metadata editing loaded.
rawcell.js:87 Raw Cell Format toolbar preset loaded.
slideshow.js:48 Slideshow extension for metadata editing loaded.
main.js:29 patching CM for undefined indent
kernel.js:124 Kernel started: 182e1a5b-8e4b-4993-a1ac-be2c97508e79
kernel.js:151 Starting WebSockets: ws://localhost:8888/api/kernels/182e1a5b-8e4b-4993-a1ac-be2c97508e79
:8888/static/components/backbone/backbone-min.map:1 GET http://localhost:8888/static/components/backbone/backbone-min.map 404 (Not Found)
:8888/static/components/underscore/underscore-min.map:1 GET http://localhost:8888/static/components/underscore/underscore-min.map 404 (Not Found)

How to use XULRunner to run SQLite Manager outside of Firefox in Mac OS X Lion?

I have installed XULRunner 11.0 (xr) from here:
Downloads - sqlite-manager - Extension for Firefox and other apps to manage any sqlite database - Google Project Hosting
I have followed the steps listed here:
kiveo - Mac SQLite Manager Standalone App
I have read and tried the suggestions here (though they're for version 6.0):
stackoverflow: How to Install and run a XulRunner Application on Mac OS X?
I am able to get the help listing with this command:
/Library/Frameworks/XUL.framework/xulrunner-bin -h
I am able to run the app from Firefox using this command (after changing the max version in sqlitemanager-xr-0/application.ini to 11.0 from 11.0a1):
/Applications/Firefox.app/Contents/MacOS/firefox --app ~/Downloads/sqlitemanager-xr-0/application.ini
Here are the contents of the application.ini file:
[App]
Name=sqlite-manager
ID=SQLiteManager#mrinalkant.blogspot.com
Version=0.7.7
BuildID=201111132204
Vendor=lazierthanthou
Copyright=Copyright (c) 2008 - 2011 lazierthanthou
[Gecko]
MinVersion=2.0
MaxVersion=11.0
[XRE]
EnableExtensionManager=1
When I run the following command in Terminal, with or without sudo, it just immediately returns to the command prompt. There are no error messages. No application appears under Applications. Nothing seems to happen at all. (And, despite the stackoverflow page above noting that --install-app may not really be supported, it is in the XULRunner help listing - which I guess doesn't necessarily mean it'll work ;)
/Library/Frameworks/XUL.framework/xulrunner-bin --install-app Downloads/sqlitemanager-xr-0/ /Applications
Following a suggestion below, I checked for an exit code. The line above is returning 2.
Help?
Just like you did with Firefox, this command should run your app:
/Library/Frameworks/XUL.framework/xulrunner-bin --app ~/Downloads/sqlitemanager-xr-0/application.ini
Also, the --app switch is optional within XULRunner.
Here's how you can make a self-contained application you can run from the Dock.
Use the xulrunner --install-app command to create the application and then copy all contents of XUL.framework/Versions/Current into the generated application at /Applications/sqlite-manager.app/Contents/MacOS.
You can then create a wrapper script that runs the xulrunner within the generated app with the application.ini file as described here.
For example, put the following into sqlite-manager.app/Contents/MacOS/sqlite-manager and make it executable.
#!/usr/bin/env bash
APP_PATH="/Applications/sqlite-manager.app"
"$APP_PATH/Contents/MacOS/xulrunner" --app "$APP_PATH/Contents/Resources/application.ini"
Now you have to tell OS X to run sqlite-manager instead of xulrunner. You can do that by editing sqlite-manager.app/Contents/info.plist and setting CFBundleExecutable to sqlite-manager like this:
<key>CFBundleExecutable</key>
<string>sqlite-manager</string>
The only limitation of this approach is that it breaks when you move the application or rename it. I'd love suggestions on how to get rid of the absolute path within the sqlite-manager script.
try this:
firefox -chrome chrome://sqlitemanager/content/sqlitemanager.xul
or on OS X
/Applications/Firefox.app/Contents/MacOS/firefox -chrome chrome://sqlitemanager/content/sqlitemanager.xul
(found on http://www.egeek.me/2013/09/07/how-to-run-sqlite-manager-with-a-single-command/)
works fine for me on UBUNTU 12.04 to start sqlite manager without starting firefox first
If the install was successful, I think the app should be available in some usual place for your system (which wasn't mentioned, but I'm guessing OSX :). Have you looked under /Applications?
To see whether the command failed quietly, you could check its return value. Is there a verbose switch?
$ cd narnia
bash: cd: narnia: No such file or directory
$ echo $?
1
$ cd .
$ echo $?
0
$ cd narnia && echo "success"
bash: cd: narnia: No such file or directory
$ cd . && echo "success"
success

Resources