I'm searching for a tool that will take a source directory and produce a single PDF containing the source code, preferably with syntax highlighting.
I would like to read the PDF on my phone, in order to get familiar with a code-base, or just to see what I can learn by reading a lot of code. I will most often be reading Ruby.
I would prefer if the tool ran on Linux. I don't mind paying for a tool if it is particularly good.
Any suggestions?
You could wipe something up yourself with Prawn and Ultraviolet.
PDF is no good for reflowing. You might like a html based solution better.
And in reading existing code, a lineair model is no good. You need to jump from one file to the other. A hypertext model with history would probably work best on the limited screen estate of a phone. It should borrow some features of the smalltalk IDEs (jump to senders, implementors).
For the UI, take a look at clamato
GNU source-highlight supports many languages and can output LaTeX in particular that can be converted to pdf.
The SciTE editor can export the currently edited file (with syntax highlighting) to PDF (and HTML, RTF, LaTeX and XML).
Alas, it doesn't have batch conversion capability, but IIRC somebody made a batch tool out of this code base.
I realize this is very late, but I wanted to do the same thing, except I wanted it for my tablet, which is a Galaxy Note 10.1 with a Wacom digitizer that I can use to annotate code. I found that one good solution is to use Doxygen to generate a PDF which will have hyperlinks and everything you would want in a PDF. For my use case, I would pair it with EzPDF on Android to annotate the code. This was also for the purpose of learning a new codebase. In the end I ended up not using the generated PDF but it was pretty usable.
Related
I am in a process of learning things in reverse order for fun, and I have decided to dissect Windows 10, bit-by-bit, and learn what makes a great OS function. And I also suppose that my question will be geared in other ways as well.
My question is, how do I look at something like Windows bootmgr source code properly? I have opened the file - which the file type is redundantly called "File" - and even though it is in Assembly language, it is completely impossible to read. My guess is that whoever wrote the File did something to encrypt the File so that it is unreadable, and thus unchangeable/unable to be edited.
Let me be perfectly clear: my purpose is not to change the bootmgr File to change windows, but rather to get a better understanding of how an OS works via reading, and also through trial and error.
Any help that anyone can give would be greatly appreciated. I love to learn about these things, and I just have been completely unable to find the answer I am looking for on any site thus far, including this one...IDK if I need to refine my searches or what.
Thank in advanced for your help. :)
Ps. I shall include a picture of what I am seeing in Notepad++ so you can get a better understanding of what I need here .
I think you may be confusing assembly language with machine code. Machine code is the language that your computer's processor understands. Assembly language is a series of symbols that are used to represent machine code. Compiled executables are stored in machine code.
That said, the standard way to view the machine code for a compiled binary is through the use of a program called a hex editor. A hex editor will display the binary code in a numerical format, rather than attempting to interpret the binary as text, like your editor is trying to do in the screenshot you supplied. Frhed is a popular hex editor, but there are many good ones to choose from.
I'm trying to flatten annotations I make to PDF files in macOS Preview (El Capitan) to ensure that they cannot be modified. I especially want to ensure that redactions cannot be deleted or unhidden to reveal the text beneath. Ideally, I would also like to preserve the machine-readability and vector quality of the text.
Currently, I achieve this by exporting to .tif, then converting back to .pdf, and then OCR'ing with Abbyy FineReader Express. That's a bit ridiculous, but the final result is almost exactly what I want: permanent annotations and searchable/copyable text. It loses some quality though... and grows in size.
I'm comfortable with the CLI and I've got MacPorts installed and pdftk. I hoped that the pdftk "flatten" option would do the trick, but it does not. It only seems to flatten form fields.
Does anything else out there do this? I swear there was a way to do this on some old built-in imaging program for Windows 2000 or something. (but I'm ok not going back to that) :-)
I would settle for a command that rasterizes the file if and only if it:
did everything in one step
kept the file small
kept the file as a pdf
kept the file as almost as readable and pretty as it was before
The "Best Practice" for Redactions in PDF is to either use Acrobat's Redaction tool, or the (long time industry leader) Redax Acrobat plug-in for Acrobat (although that one is not made for MacOS, as far as I remember).
Of course, the export as picture and then run OCR over it does work, but you have to absolutely make sure that you also clean up the file(s) from any private data and metadata.
Note that with the "real" redaction tools, you have the possibility for smart searches, even involving Regular Expressions.
With Redaction, as with other safety and security-related issues, it is up to you to decide how much it is worth to you.
Use "Export as PDF" (in the File Menu) which seems definitely a proper way to do it (on 10.9.5).
It seemed that the way to make these annotations permanent is printing to PDF with Preview, but that didn't succeed.
Main-Question
What's your fast and reliable (as in "stable") solution to create on-demand, newspaper-like (as in "using advanced layout or typesetting") PDFs out of an application on a Linux server?
Therefore: No, HTML2PDF is not the solution I'm looking for. ;-)
Bonus-Question
And if it's not Ruby-based: Is there a way to steer your solution out of a Rails application? Preferably over a webservice or a something-2-Ruby-bridge-kind-of-thing?
Thanks a lot for your suggestions!
Update
There's a similar question and the rtex gem suggested there looks like what I'm looking for. I'll keep this question unanswered to look if there are other suggestions.
Typesetting well is hard.
If you can't find a ruby typesetting library, you may want to look at running a background pdflatex. LaTeX source is pretty easy to generate programmatically.
How useful this idea is will depend a bit on how complicated your documents are, and how much you care about the quality of output. If you have simple text only, and only want something a bit better than html, you probably have more options.
Prawn is designed for this type of thing, and it's under current development.
With php I've had great luck with FPDF. I generate a few thousand high quality reports everyday with it. Never misses a beat and is pretty quick. With php running on a webserver, I imagein it wouldn't be too hard to setup ruby to feed the php page the data required to generate and then ruby pick up the result.
EDIT: It looks like there is a port for Ruby. http://zeropluszero.com/software/fpdf/
We wish to provide people to be able to add some logic to their accounts(say, given a few arguments, how to compute a particular result). So, essentially, this would be tantamount to writing simple business rules with support for conditionals and expressions. However, the challenge is to provide them a simple online editor where they can create the logic (preferably) by completely visual means (drag/drop Expr-tree nodes maybe -- kinda like Y! pipes).
Does anybody know of a scripting/macro/domain-specific language that lets people do this? The challenge is the visual editor, since we don't wish to invest in developing the UI to do the editing. The basic requirements would be:
1. Embedded into another language, or run securely (no reboot -n or <JUNK-DANGEROUS-COMMAND> >> ~/.bashrc)
2. Easily accessible to users without coding background (no need of any advanced features)
3. Preferably have a simple GUI based editor to create the logic programs accessible to non-developers (kinda like spreadsheets)
4. Some ability to generate compile-time warnings (invalid code) would be good (Type safety?)
5. Ability to embed some data before execution which is available to the interpreter (Eg., name, birthday, amount)
Anybody tried doing something like this and got any ideas? I looked at Lua, Io, Python, Ruby and a host of others, but the challenge essentially is that I don't think non-programmers will be able to understand the code all that much. Something that could be added via "meta-programming" to say a Ruby would be good as well, if an editor could be easily developed!
As a matter fact, Microsoft is developing Oslo, which is right up your alley.
Chris Sells has been writing a lot about it recently.
It is designed to be a way to author DSLs and also to visually author these models with a graphical tool called Quadrant. Sounds very very similar to what you are looking for.
Open source wise, Ruby I think can be close, as you can see if you look at _whytheluckystiff's Try Ruby or Hackety.
I don't think you'll find anything that isn't too generic, especially regarding the GUI editor. There's no generic tools as far as I know that will be able to automatically interface with your program and be able to query data from it and interpret the script into commands in your software -- if there is I'd like to have a copy. Not being flippant, but you will have to do some (probably alot) of work to get this working. It will probably result in you writing a custom DSL.
I would take a look at PowerShell. You could surface all the activities a user would like to script in a very readable way.
There is some talk of using PowerShell to create a DSL on the PowerShell team blog and Bruce Payette, the technical lead, talks about this in his book Windows PowerShell in Action from Manning.
At the other end of the scale is to write something simple as a HyperText Application (HTA) -- assuming Windows of course -- along the lines of my Clive tool. The article on the blog doesn't mention the HTA version, but essentially I could enter VBScript-ish code into one textarea and interpret it on the spot, output going into another text area on the form.
With HTAs giving you all the form control of HTML, plus the DOM, you could come up with something interesting fairly quickly.
I'm using the GoDiagrams suite which seems to recommend .emf files for node images since they scale better on resizing. Bitmaps get all blurry.
Google doesn't show up any good tools that seem to do this... So to reiterate I'm looking for a image converter (preferably free) that converts an image (in one of the common formats like Bitmaps or JPEGs or GIFs) to an .EMF File.
Update: I dont need to do it via code. Simple batch-conversion of images will do.
Inkscape works well, it was recommended to me here.
Irfanview (http://www.irfanview.com) supports many image formats (including .emf). It's also small, fast, and very full-featured. It is free for non-commercial and educational use. I use it for all my image-conversion needs as it will work on batches of files and can rename them as it saves.
Image Magick contains a tool called convert, that will convert from just about anything to EMF files. You can either use this as a separate application, or interface to it using an API that is available in several different languages.
XnView (http://www.xnview.com). Very good viewer and converter.
Try ImageConverter Plus
Try http://autotrace.sourceforge.net/. It is opensource and it has good results. Download from here: http://sourceforge.net/project/showfiles.php?group_id=11789
Really funny one Microsoft. Now this might seem outlandish but it works... (I have Visio2007). Just found this out from a colleague
You can drop a JPEG into Microsoft Visio (no less), Do a 'Save As' to .emf and voila! nice quality of a picture too.