[scribus] designing instructional posters on code/programming -- lots of syntax highlighting

Gregory Pittman gpittman at iglou.com
Wed Jan 4 19:48:22 UTC 2017


On 01/04/2017 12:33 PM, Alec Hill wrote:
> On Wed, Jan 4, 2017 at 10:42 AM, Gregory Pittman <gpittman at iglou.com> wrote:
> 
>> On 01/04/2017 10:00 AM, Alec Hill wrote:
>>> Hello folks :)
>>>
>>> I would greatly appreciate some advice about what direction to go...
>>> realizing this may be a bit of a rabbit hole that might require I spend
>>> several hours learning various things, if it's a rabbit hole indeed I'd
>>> like to avoid travelling the wrong tunnels if possible...
>>>
>>> I need to design informational/instructional posters that have lots of
>> code
>>> samples in which the code is properly syntax-highlighted like you'd see
>> in
>>> Kate/Gedit/Vim/any IDE etc.
>>>
>>> What approach should I take for this?
>>>
>>
>> Thanks for checking this out Greg!!
> 
>> Here is something I tried just now, that worked surprisingly well.
>> I used Kwrite, and imported a python file. In Kwrite, I have an option
>> to Export as HTML, which I did. I then loaded into firefox, and
>> "printed" as a PS file.
>> I could then in Scribus import the PS file, and all the syntax
>> highlighting was intact. Checking at high zoom, the resolution of
>> characters was excellent. I noted that I could have sent from firefox as
>> a PDF file, which should also work.
>>
> This method is humorously different than what I had imagined :)
> It does work.  Though there seems to be a "gotcha" that would be
> problematic if I can't find a way to work around it....
> 
> - When I import the .ps file through the "Import > Get vector file" option,
> the code is placed on a large white canvas, the code takes up a small
> portion of the canvas, and there doesn't seem to be any way to crop it.

This is easier to deal with than you think.
PostScript and PDF files are groups of objects, usually groups of groups
of groups, finally down to individual characters.
Usually there is some sort of "container", which I guess is the large
canvas you're talking about. In my case it had no color.
So ungroup until you're down to the level you need, delete the parts you
don't want. You probably want to then group the parts (lines of code)
that you do want, so you can move them around together and position as
needed.

The other thing to consider is trimming down the original source before
converting to html, then PS.

Greg



More information about the scribus mailing list