How to attach a file to a PDF

Sort of “off-topic” for this site, you may think. But bear with me, that in a few days this article will be very important…

The PDF standard accept being used as a “container,” accepting attachments. This feature allows us to work with forms that can be completed by the PDF reader, but the files that can be attached are not limited to that: for example, we may want to distribute a programming manual in PDF format, attaching to certain pages some scripts, or maybe… well, in a few days we’ll see another example. Maybe.

Of course, such advanced option can be used from the proprietary Adove software, but what happens if we want to attach something to a PDF in Linux?

For this, we have PDFtk.

Note: PDFtk as a command-line utility is free/libre software, but there is also a free, but non-libre, user interface for it that only works on Windows. Check the project website for more information.

PDFtk allows us to do everything we can imagine in PDF files and even more: merge files, divide them, add or remove pages… and of course, it allows us to attach files to a PDF.

By opening a virtual terminal in the folder that contains both, the PDF and the “to be attached” file, we can write

pdftk my-pdf.pdf attach_files to_page <number> output output-file.pdf

where <number> is the page number where we want the attachment to appear. For example, if we want to attach the file to page 27 of the manual.pdf file, creating the file manual_plus.pdf we need to write

pdftk manual.pdf attach_files to_page 27 output manual_plus.pdf

I do not recommend using the original file as the destination: in a test, the program gave me an error and deleted the destination file…

Now, opening the new PDF in, for example, Okular, we will find that the attachment is marked with a “pin” on the chosen page and that by selecting “Revisions” we can see it and, with a right click, download it.

There is a really old GUI for PDFtk called PDFtk-qgui, but it seems unmaintained and, last time I tried it, it was “problematic.”


LyX 2.3.1 Released

A quick Sunday entry: although all openSUSE users have already been enjoying it for a few days (it’s in the publishing repository), today the LYX project has announced the availability of the first maintenance release in the 2.3.x series

[ANNOUNCE] LyX 2.3.1 Released

In addition to numerous bug fixes, this version adds improvements in the graphical interface that make it more agile. It also uses native system dialogs to open or save documents.

Among many other things, that is Sunday and I do not want to go into so much detail.

After all, that’s what the release announcement is for 😉

Erewhon: a Font derived from Utopia and Heuristica

Today I present another project signed by Michael Sharpe

erewhon – Font pack­age de­rived from Heuris­tica and Utopia

This font has a complex history. By the end of the ’80s an Adobe employee called Robert Slimbach designed a font called Utopia. That font became part of the “Adobe initials” package. On 1989 Utopia became “free software”, but with a not-so-clear license that was source of confusion: for instance, at that time Debian people did not include the font in their repos.

After a lengthy debate, in 2006 Adobe finally donated a Type 1 version of the font to the TEX user group, clarifying in the process the problem of the license.

From that moment, the font began to receive several enhancements and a fork called Heuristica was created. From that fork comes the fork presented in this article.

Erewhon took some distance from its origins, but maintains the general “style” (not the metric) of Utopia.

It’s important to keep in mind that, in addition to the four usual shapes, Erewhon offers a slanted version… but LibreOffice gets confused by it, so it is either slanted or italic: you cannot use both in the same document. Since I do not like slanted fonts, I simply avoid installing that shape, but consider this issue in Writer. There is no problem with XƎTEX, of course.

Greetings! And a “Progress report”

Greetings! I managed to survive teaching up to eight hours a day during these summer courses, so I’m back!

Although I did not have much free time, I somehow managed to advance in those crazy projects that I announced some time ago.

The Spanish edition of the book about Writer is almost ready, and I think it will be published next month: soon after that milestone I’ll start to translate it into my “bucatini English” (it’s not even Spaghetti).

But I was able to take some “breaks” from the task of writing about “the Writer,” and started to translate the book about LYX

The main text is in place, so after some rounds of editing and review, it will be ready: I’m confident that “LYX, the other way of writing” will be published within this year.

I’ll keep you updated

(Pseudo) Summer Stop

On this time of the year:

  • My readers go on holidays
  • My usual students go on holidays
  • My unusual students gather for the summer courses

So I’ll take a break on publishing articles. If I survive to the hot weather, to my (unusual) students and to that crazy idea of moving on with two crazy projects, I’ll come back on September.

So take care of yourself and buy new sun screen (it’s almost certainty that that one from last year is not valid any more). Have a nice holiday!

Playing with “span” | Drop Caps in a WordPress article

Clearly if we completely own a site and have access as administrator to it we’ll be able do define our own CSS styles and in that way we’ll be able to build every format we want on our pages… But only if we “have the power” (and the will) to do so.  But that does not mean that we are hopeless on a “free site” (or when we do not want to dig on CSS files). In fact, on previous articles we’ve seen a couple of tricks like how to use Text On Small Caps and «floating definitions» or how to write the TEX, LATEX, XƎTEX and LYX logos, and here we can see Drop Caps at work.

Well, today’s trick, like the others, needs the use of the HTML editor on WordPress to write some code. I’ve found this trick on the following page: How do I add a Drop cap text (html or image) to my website. Basically, to create the first Drop Cap I’ve wrote

<span style="float: left; color: #d4d4c7; font-size: 85px; 
line-height: 39px; padding-top: 3px; padding-right: 3px; 
font-family: serif;">C</span>
<span style="font-variant: small-caps;">learly</span> if we...

IMPORTANT NOTE: For presentation needs I’ve broke the code on several lines, but it’s better to keep everything on the same line.

The only remaining thing is to play a bit with HTML colours, the sizes of the drop cap and the line spacing. The code in not “comfortable”, that’s true, so use it only for special situations.

That or buy a full plan to work on the CSS code.

Announcing Two Projects (Maybe)

Everything started more than a decade ago: a series of articles I wrote in Spanish for a now defunct digital magazine started to grow beyond any expectation.

The articles touched two topics. The first topic was the proper use of Writer (remember: it was a long time ago). The second topic was a quick presentation of a program with the ambitious aim of making LATEX easy: LYX.

On 2010 those articles about Writer became a book (in Spanish) named after the first article I’ve wrote about the topic: “Domando al escritor” (Taming the writer). I lost count of how many times I updated the book and expanded its contents (now it also talks about Draw, Math and Chart). On 2016 a new edition devoted to LibreOffice Writer was released. Now, on 2018, I decided to rewrite it (almost) from scratch and that maybe, just maybe, I’ll try to annoy my dear English readers with a home made translation.

The articles about LYX became even more articles in my personal blog (in Spanish) and on 2017 everything became a new book about this program, about XƎTEX and about how to properly use OpenType there called “LYX, la otra forma de escribir” (LYX, the other way of writing: the name also comes from the first article I wrote about the topic). That book is ready (in Spanish, I mean) so it only needs to be translated into English. Somehow.

So yeah, these are the two new projects: once the new Spanish edition of the book about Writer is ready I’ll translate it into English (maybe), and once I get enough strength I’ll also translate the book about LYX (maybe).

At least I have a first version for both covers:




Before someone protest: As you can see by the fact that Glamdring is glowing blue, I’m quoting the Books, never the movies, so do not insist: it’s cannot.

The Spanish name of the book about Writer is a sort of (bad) pun and would be best translated as “Taming the Writer”, but it happens that there is an English book called “Taming Writer” so to avoid confusions I decided to translate it as “To Tame a Writer.” Let me know in the comments if it makes sense.

And here we are: two concrete, difficult and real projects that I have no idea when, or even if, will be achieved. Let’s see what comes out of all this.