[erlang-questions] Looking for Erlang code that handles PDF file attachments

Joe Armstrong <>
Thu Feb 2 11:13:07 CET 2017


So you have discovered the secret of the code :-)

This was done as a joke but I think you're the only person who got it.

Feel free to use the code.

I suspect that most people (programmers included) think that PDF is a document
format - well It's not - it's a *container format* (like a ZIP file) -
it Just so happens
that 99.99999999999% of all PDF files contain documents encoded in a subset of
postscript.

It's all rather easy all you have to do is read the 1310 [1] page PDF spec [2].

I can highly recommend reading this - I think  PDF and Postscript are
outstanding examples of good design [3].

/Joe

[1] I'm not joking
[2] http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf
[3] The designers of Postscript actually asked traditional
typographers about page layout before designing a language.




On Thu, Feb 2, 2017 at 8:10 AM, bengt <> wrote:
> Greetings,
>
> I forgot to thank Joe for this very helpful code/document. I apologise.
>
> The main benefit is that it explains how the PDF magic works, but I would
> like to ask if it is allowed to copy some of the code?
> Keeping the original
> %% Module:  pdf.erl
> %% Author:  Joe Armstrong ()
> %% Date:    2001-12-14
> %% Purpose: Manipulate PDF files
> %%          Pack and unpack files into PDF files
> of course.
>
>
> bengt
>
> On 26 Jan 2017, at 12:43, Joe Armstrong <> wrote:
>
> I did exactly this a while back.
>
> The enclosed PDF has an erlang program packed inside it.
> The erlang program can be used to pack and unpack things inside PDF.
>
> PDF is after all, just a container format (like a zip file)
>
> Hint take a look at the end of erlpdf.pdf in a text editor.
>
> Actually since I always want to read the documentation first - I thought the
> code should be *inside* the documentation and NOT the other way around.
>
> Cheers
>
> /Joe
>
>
> On Wed, Jan 25, 2017 at 10:06 PM, bengt <> wrote:
>
> Greetings,
>
> I would like to attach files (or some sort of binary content, anyway) to PDF
> files, without destroying the PDF'ness of the file. I would also like to be
> able to read the created PDF file and be able to tell what is the attachment
> (and what is the original content). I have found Itext (Java, see
> http://itextpdf.com/). It seems to be able to do that and everything else
> too, but is there any other alternative? Preferably in Erlang.
>
>
> bengt
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
> <erlpdf.pdf>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>


More information about the erlang-questions mailing list