A small suggestion for improving printing
- Dominant language
- Java
- Stars
- 14.6k
- Forks
- 7k
- PR merge metrics
- No merged PRs in 30d
Description
I've found a primitive but working little method to make my code paper-print friendly using a Mac (OS X 10.11.5 / Safari 9.1.1) and an A4 colour ink-jet printer. It was suggested to me to post the proposal here, maybe it is very easy to implement and could be helpful.
Just a short 'technical' description:
Make the CopyAsHtml command produce the same code as it currently does, with the following extras:
1. Addition at the beginning of content (before `
`):`):```
pre {
font-size:large
}```
2. Addition after end of current output (after `
```
```
3. Make the CopyAsHtml command search the content for this comment string: `// pbreak` and insert before each occurence the following:
`
Such little modification makes the ArduinoIDE html output very printer-friendly IMHO. It could be though that I'm proposing something horrible without being aware of that as I'm not a professional, so apologies in advance if it is so.
#### The longer prose description of the method as I currently employ it 'manually', running things on OS X 10.11.5., and using TextEdit and Safari in addition to ArduinoIDE:
- I wanted to print my code preserving Arduino's colour tags (printing on a color ink-jet printer), as I've found it on paper too to be very helpful having comments more easilly distinguished from the actual code
- I wanted to be able to enforce page breaks in certain places
- I wanted to print in layout of 'two pages per sheet' to waste less paper, but needed to increase the font size just a little bit because 2pagesPerSheet-reduction made the default-size text too small for my eyes.
So, what I do is this:
While writing code in ArduinoIDE:
- Keep the code lines 107 characters wide max,
I use this occasionally to divide sections of code and also help me eye-ball the allowable width:
`// ########################################################################################################`
- In places where page-break will be required, I type-insert a comment/tag: `// pbreak`
When going to print:
1. Select code in ArduinoIDE and choose Edit->CopyAsHtml
2. Open TextEdit paste the code into a new file, choose Format->MakePlainText and save as something.html
(If somtime later you want to edit this file and TextEdit displays it as a rendered web page instead of the raw html code,
open TextEdit->Preferences->OpenAndSave and check the box "Display HTML files as HTML code instead...", and open the file again.)
3a. At the beginning of the file, before the `
` tag, I insert the code that will make the font display/print slightly larger:` tag, I add the following:```
pre {
font-size:large
}```
3b. At the end of the document, after the `
```
```
4. In TextEdit I do a quick Find/ReplaceAll:
find: `// pbreak`
replace: `
5. Save the html file once again, open it in Safari and print...
(I'm using A4, Layout->PagesPerSheet->2)
(Choice of different paper size and printing layout would probably lead to choosing different font-size, and maybe larger allowable code line width.)
// --------------------
Regards,
m
Contributor guide
Research direction
Start by locating the Java implementation of the CopyAsHtml command and inspect how it builds the current HTML output. Verify the requested document wrapper, larger preformatted text, and page-break insertion before each // pbreak marker; done means the generated HTML prints with the requested formatting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- desktop
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100