pdf embedded in emacs? - pdf

I would like to ask if anybody knows of a possibility to render pdf file inside emacs. I noticed with w3m browsing a web page with a link to pdf it actually open with doc view it in another buffer (as you can see). How can I do it with other packages ?

As long as you have Ghostscript installed, you can view PDF files in Emacs just by opening them as any other file, with C-x C-f. doc-view-mode should start automatically, but if it doesn't, you can do it manually with M-x doc-view-mode. More information is available in the manual.

You may try pdf-tools for emacs.
pdf-tools
Just install it using M-x package-install-file RET pdf-tools

Related

How can I open the ~/.ssh/config file as a text file instead of opening the TextEdit app on Mac?

I have been trying to add my SSH keys to the ssh-agent by following the directions on this GitHub doc: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key
This is what I put into the terminal:
root#Nicoles-MacBook-Air nicoletr # eval "$(ssh-agent -s)"
Agent pid 21417
root#Nicoles-MacBook-Air nicoletr # open ~/.ssh/config
The file /var/root/.ssh/config does not exist.
root#Nicoles-MacBook-Air nicoletr # touch ~/.ssh/config
root#Nicoles-MacBook-Air nicoletr # open ~/.ssh/config
But when I hit enter to open the ~/.ssh/config file, the TextEdit app opens instead of a text file that I can modify. I am supposed to modify the config text file but I don't even see any file at all. I am still very new to coding so I would be extremely grateful for any guidance.
Open command
On MacOS, the open command will open file in parameter with the default configured application for this filetype (such as Preview, TextEdit or Safari for some others)
Even though you can override which application is used to open the file, there are more standard solutions to achieve this.
For the sake of completeness, you can override default app by using -a option, for example, if you want to open an html file with TextEdit instead of Safari by default:
open -a TextEdit page.html
More information about open:
Article on scriptingosx.com
Open man page
Alternative
If you would like to edit any file directly from your terminal, you can use packages such as nano, to easily get started with it you can check this article. As an added bonus, it also go through setting brew to easily install package, also from your terminal
There are alternatives to nano (like vi, vim) and to brew (such as macports). They all have their pros and cons depending on the use, though in you case, I don't think your need would justify the steeper learning curve yet
Happy discovering coding !

Photoshop - simple Open File action on MAC

Could anyone send the ATN file with only one action -> opening PSD file on Mac?
I've made an action with a lot of steps, it's working good but only on Windows. There is no relative paths in PS actions, and i have no friend that has Mac. Could anyone prepare ATN file (so i will be able to copy "open psd file" step)?
Regards,
Luke
Short answer: this won't work. Even though Photoshop has "shortcuts" paths that are similar for both OSX and Windown (like ~/Desktop is a shortcut for desktop folder no matter of OS and username), Actions don't seem to recognize them. Furthermore, if you record an Open Action on Windows or Mac and open it in a different OS, you'll get a File or folder not found message for this step:
Here're two examples. In bot cases the top Action was made in Windows and the bottom one on Mac. This is a Mac screenshot:
and Windows:
Notice how Action1 on the Mac screenshot has File or folder not found message and on Windows there's the same message for Action2 from fromMac set.
Here's what you can do though.
insert Open as a Menu Item. This way user will be asked for a file you need every time a user calls the Action.
give the file you need to open as a pattern file (.pat) and ask a user to install it. This way you can fill a document with it using the Fill command.
most powerful: use a script. You can convert your action to a script file using the xtools: there's a script within it called ActionToJavascript: this will give you a .jsx file that you can use in Photoshop and that will work exactly as your action. And in this script you can specify a path for your action. Like here I'm specifying a file on my Desktop:
And this script will work on Mac.

Understanding PDFBox jar files

I am attempting to install PDFBox on my system in order to create PDF files, but am unsure which jar files I need. If I go to https://pdfbox.apache.org/download.cgi
I see command line tools as follows:
pdfbox-app (9.1MB)
preflight-app (9.2MB)
debugger-app (9.0MB)
I also see "Libraries of each subproject" as follows:
pdfbox (2.6MB)
fontbox (1.6MB)
preflight (248KB)
xmpbox (132KB)
pdfbox-tools (77KB)
pdfbox-debugger (245KB)
What is meant by "each subproject"? Is it talking about the command line tools or something different?
I am planning to use java from the command line rather than in an IDE. Does this mean that I just need the Command line tools or do I need the "Libraries of each Subproject" as well? What does the "-app" indicated in the command line tools vs the related libraries?
Is there a page on apache.org that mentions the differences between all of these?
To create PDF files should I be using the preflight and debugger files as well or are those optional?
Summarizing the comments: you want to create a PDF from scratch and access your development over ssh so you can't use an IDE and have to use javac. For that you could use pdfbox-app jar file, but this would be huge. Instead, use the pdfbox, fontbox and commons-log jar files. See also here for additional dependencies if you want to do more advanced stuff (read / render (= convert to image) / decrypt / sign).

Phantomjs not render hebrew fonts

I am using PhantomJs 1.9.2 on Centos 6.3 to for automated ui tests. When a test fails,
screenshots are saved to the server.
My problem is that even though the screenshots are saved, they do not contain readable fonts.
So if the website reads like this:
חיים טכנולוגיים
the screenshot of the site will look like this:
םםםםםםםםםםםםם
So, instead of the actual letters, it renders and saves little boxes.
The system is centos 6.3. Freetype and Fontconfig are also installed.
How could I go about fixing this?
Thanks!
follow these steps:
in /usr/share/fonts/ I added a folder named arial with the arial.ttf for hebrew
I ran fc-cache -vf.
That's it! I did not edit or change fonts.conf or did anything else as suggested in the link.
You should use python code for taking screenshots of website. there are two module which will do whatever you want pyvirtualdisplay & selenium. Install them and write a class to create screenshot and call it with command line with your code.
Best of luck...
I recently had to fix the same problem myself. I ended up doing what's suggested in the this answer. Well, sort of. I skipped some of the steps:
in /usr/share/fonts/ I added a folder named arial with the arial.ttf for hebrew
I ran fc-cache -vf.
That's it! I did not edit or change fonts.conf or did anything else as suggested in the link.
Granted, I still had a little trouble with parts of the page (I'm guessing it was because they were using fonts other than arial), but I ended up not needing them. Hopefully that'll be good enough for you too!

Change TextMate live webpreview to use Chrome's Webkit

Currently Textmate uses Safari's Webkit to render the hmlt outputs for both commands and the live webpreview window.
Unfortunately for one specific project I am working with specific javascript API supported only be Firefox's gecko or Chrome's Webkit, it seems Safari still not supporting it.
Perhaps there's a way to globally change Safari for Chromium or Webkit Nightly?
A support member of TextMate kindly answered my email asking for it by mentioning this url which definitely points to the right solution. I really didn't think it could be done so seamlessly and now I am very happy that it is possible.
Basically there are few steps to follow:
$ cd /Applications/TextMate.app/Contents/MacOS/
$ mv TextMate _TextMate
$ vim TextMate
new TextMate file contains (note that you might want to change the path for the new webkit framework to fit the one you like)
#!/bin/bash
env DYLD_FRAMEWORK_PATH=/Applications/WebKit.app/Contents/Frameworks/10.6/WEBKIT_UNSET_DYLD_FRAMEWORK_PATH=YES /Applications/TextMate.app/Contents/MacOS/_TextMate
after saving the newly created file:
$ chmod a+x TextMate
Close/Run TextMate :)
Or obvious if you just want to do this for each session you can simply use the bash command right away from terminal like this:
$ env DYLD_FRAMEWORK_PATH=/Applications/WebKit.app/Contents/Frameworks/10.6/ WEBKIT_UNSET_DYLD_FRAMEWORK_PATH=YES /Applications/TextMate.app/Contents/MacOS/TextMate
This is really cool...one thing I've noticed after that is that my themes are no longer being displayed, have no clue about it but I will try to check the cause.
try this - http://wiki.macromates.com/Main/Howtos#SafariPreview