
What is the easiest way to create PDF files from Haskell? Is gtk2hs's PDF output the preferred way?

On Tue, 1 Jun 2010, Jim Tittsler wrote:
What is the easiest way to create PDF files from Haskell? Is gtk2hs's PDF output the preferred way?
I have successfully used HPDF for http://hackage.haskell.org/package/internetmarke Certainly there could be some improvements to HPDF's API interface, but it works as it is.

Read the PDF manual from adobe, it is not that hard. Fonts are a little harder, but not too much. El 01/06/2010, a las 12:14, Henning Thielemann escribió:
On Tue, 1 Jun 2010, Jim Tittsler wrote:
What is the easiest way to create PDF files from Haskell? Is gtk2hs's PDF output the preferred way?
I have successfully used HPDF for http://hackage.haskell.org/package/internetmarke Certainly there could be some improvements to HPDF's API interface, but it works as it is. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Last year, I was playing around with using the Hieroglyph library for pdf creation via it's Cairo backend (which I guess amounts to the same thing as using gtk2hs' pdf output). http://wrwills.webfactional.com/docs/pandocHieroglyph/ You should be able to use Diagrams as well as it also has a cairo backend. http://hackage.haskell.org/package/diagrams -Rob On Tue, Jun 1, 2010 at 5:15 PM, Pierre-Etienne Meunier < pierreetienne.meunier@gmail.com> wrote:
On Tue, 1 Jun 2010, Jim Tittsler wrote:
What is the easiest way to create PDF files from Haskell? Is gtk2hs's PDF output the preferred way?

Jim Tittsler wrote:
What is the easiest way to create PDF files from Haskell?
Pierre-Etienne Meunier wrote:
Read the PDF manual from adobe, it is not that hard. Fonts are a little harder, but not too much.
I have often generated PostScript from Haskell, which is much easier. PostScript is a nice little concatenative programming language. The basics are easy to learn, and you can copy things like the page setup and fonts from the output of OpenOffice.Org, which is quite readable. Then you convert the PS to PDF using any of the nice utilities around for that, like the ones that come with xpdf, poppler, ghostscript, etc. Regards, Yitz

Isn't there a problem with non-type 1 vectorial fonts being rasterized during this conversion ? El 01/06/2010, a las 14:07, Yitzchak Gale escribió:
Jim Tittsler wrote:
What is the easiest way to create PDF files from Haskell?
Pierre-Etienne Meunier wrote:
Read the PDF manual from adobe, it is not that hard. Fonts are a little harder, but not too much.
I have often generated PostScript from Haskell, which is much easier. PostScript is a nice little concatenative programming language. The basics are easy to learn, and you can copy things like the page setup and fonts from the output of OpenOffice.Org, which is quite readable.
Then you convert the PS to PDF using any of the nice utilities around for that, like the ones that come with xpdf, poppler, ghostscript, etc.
Regards, Yitz

I wrote:
I have often generated PostScript from Haskell... Then you convert the PS to PDF using any of the nice utilities around for that
Pierre-Etienne Meunier wrote:
Isn't there a problem with non-type 1 vectorial fonts being rasterized during this conversion ?
No. PDF is just a simplified, compressed encoding of PostScript. Unless there is some special reason to do so, why would a conversion utility go to the trouble of rasterizing fonts instead of just copying them in? Perhaps something like ImageMagick might do that; its internal format is a raster. Regards, Yitz

Isn't there a problem with non-type 1 vectorial fonts being rasterized during this conversion ?
No.
PDF is just a simplified, compressed encoding of PostScript. Unless there is some special reason to do so, why would a conversion utility go to the trouble of rasterizing fonts instead of just copying them in?
To be clear: PostScript is a Turing-complete programming language. PDF is deliberately *not* a programming language. (This makes it less imperative, more declarative, and easier to manipulate.) One effect of this is that it's possible to write a 2KB PostScript file with algorithmically constructs some horrifically complex image, and when you convert it to PDF it becomes 3MB or something. None of which has anything at all to do with rasterisation. I gather, however, that various outline fonts have different spline capabilities; I don't recall the details any more, but that might plausibly force you to rasterise fonts. But heck, if you only use the (36?) standard PostScript fonts, you won't have to embed them in either the PostScript or PDF files. The standard includes serif, sans serif, monospace, bold, italic, etc., so unless you want something fancy like complex typesetting... PS. I leaned to program in PostScript on day in my lunch break because I was bored. I almost wish I could put that on my CV...

On Tue, 2010-06-01 at 21:45 +0300, Yitzchak Gale wrote:
I wrote:
I have often generated PostScript from Haskell... Then you convert the PS to PDF using any of the nice utilities around for that
Pierre-Etienne Meunier wrote:
Isn't there a problem with non-type 1 vectorial fonts being rasterized during this conversion ?
No.
PDF is just a simplified, compressed encoding of PostScript. Unless there is some special reason to do so, why would a conversion utility go to the trouble of rasterizing fonts instead of just copying them in?
Perhaps something like ImageMagick might do that; its internal format is a raster.
Regards, Yitz
PDF is not just simplified, compressed encoding of PostScript. Or at least - LaTeX have some features PDF-only. For example PDF can have hyper-links (both to local and external content). It can be scripted in JavaScript (don't ask me why) and can have form (OK. So I can fill them and print probably). Regards

On Jun 5, 2010, at 10:37 , Maciej Piechotka wrote:
PDF is not just simplified, compressed encoding of PostScript. Or at least - LaTeX have some features PDF-only.
I think that has more to do with the fact that pdftex/pdflatex is tightly integrated with a dvi converter that understands many PDF- specific \special{}s. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

On 6 June 2010 00:37, Maciej Piechotka
PDF is not just simplified, compressed encoding of PostScript. Or at least - LaTeX have some features PDF-only.
For example PDF can have hyper-links (both to local and external content). It can be scripted in JavaScript (don't ask me why) and can have form (OK. So I can fill them and print probably).
The form stuff is also for online submission, and the javascript allows editing of what is possible. For example (requires Adobe Reader plugin, which I don't have and thus haven't seen it myself) this form (I believe) auto-fills in some details and saves a copy online, etc.: https://forms.australia.gov.au/forms/aec/Electoral%20enrolment/
Regards
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com

should have included this in previous... On Jun 5, 2010, at 10:37 , Maciej Piechotka wrote:
For example PDF can have hyper-links (both to local and external content). It can be scripted in JavaScript (don't ask me why) and can have form (OK. So I can fill them and print probably).
The only thing that stops PostScript from doing this is that it's almost always used with devices where neither feature is useful. Indeed, PostScript is fully network capable in theory; in practice I doubt many printers implement the entire I/O model. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

The fonts aren't rasterized, but PDFs that were converted from PS
tend to look awful in almost any PDF viewer other than Adobe's Acrobat
Reader. Fonts look especially bad.
I don't know exactly what the problem is, but my experience is that
you are best off generating PDF directly, and using Acrobat Reader on
any document that looks bad otherwise. Not to mention that PDF has a
document model and supports things such as hyperlinks, which
Postscript does not, which is another reason to avoid PostScript.
Best,
Leon
On Tue, Jun 1, 2010 at 2:45 PM, Yitzchak Gale
I wrote:
I have often generated PostScript from Haskell... Then you convert the PS to PDF using any of the nice utilities around for that
Pierre-Etienne Meunier wrote:
Isn't there a problem with non-type 1 vectorial fonts being rasterized during this conversion ?
No.
PDF is just a simplified, compressed encoding of PostScript. Unless there is some special reason to do so, why would a conversion utility go to the trouble of rasterizing fonts instead of just copying them in?
Perhaps something like ImageMagick might do that; its internal format is a raster.
Regards, Yitz _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

What is the easiest way to create PDF files from Haskell?
It might depend on what you want to do .. I often create pdf reports from my Haskell programs (simulations) with text and graphs. I cheat a bit and use Haskell to automatically create latex documents, and use gnuplot (there's a helper app on Hackage) for the graphs. I then run .. makeLatexDocumentM :: [Tableau] -> IO ExitCode makeLatexDocumentM ts = do doc <- genLatex ts writeFile "latex.tex" doc system "pdflatex latex.tex > /dev/null" .. which creates the pdf file. Perhaps a bit of a hack but it works for me. Tom On Monday 31 May 2010 22:01, Jim Tittsler wrote:
What is the easiest way to create PDF files from Haskell? Is gtk2hs's PDF output the preferred way? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hi Tom,
I often create pdf reports from my Haskell programs (simulations) with text and graphs. I cheat a bit and use Haskell to automatically create latex documents, and use gnuplot (there's a helper app on Hackage) for the graphs. I'd really like to hear more. Do you have any extended informations?
Cheers, Michael

Don't forget about generating MetaPost and using mpost to generate
graphics. It's really nice to let MetaPost solve linear equations for
you that determine the layout instead of doing it in Haskell.
Linux users should install texlive-pictures and texlive-context to
make it all work. A makefile that assembles the pieces is here:
http://www.ccs.neu.edu/home/ramsdell/tools/ltxmp.mk
On Wed, Jun 2, 2010 at 7:39 AM, Michael Lesniak
Hi Tom,
I often create pdf reports from my Haskell programs (simulations) with text and graphs. I cheat a bit and use Haskell to automatically create latex documents, and use gnuplot (there's a helper app on Hackage) for the graphs. I'd really like to hear more. Do you have any extended informations?
Cheers, Michael _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (13)
-
Andrew Coppin
-
Brandon S. Allbery KF8NH
-
Henning Thielemann
-
Ivan Miljenovic
-
Jim Tittsler
-
John D. Ramsdell
-
Leon Smith
-
Maciej Piechotka
-
Michael Lesniak
-
Pierre-Etienne Meunier
-
Robert Wills
-
Tom Poliquin
-
Yitzchak Gale