PDF, Excel, LaTeX, and possibly R and sweave

C

ccc31807

I've been asked about the automation of a series of reports that are now being created by hand and printed as hard copies for distribution. I have twoquestions for the combined experience of this group, both concerning PDF.

First, I produce reports now as csv files, and using Excel::Writer::XLSX asExcel 2010 files. I have no problem with either, as they are both quick, easy, and effective.

Second, I have been using PDF::API2 for years, with good results, but mightneed to look at other options, such as CAM::pDF. If I'm happy with PDF::API2, is there an incentive to look at other libraries for the creation of PDF files? I might be looking for an excuse to use another library, so this is a case where any reason might be good enough.

Third, I am accustomed to using LaTeX as my general purpose tool for creating documents (as opposed, for example, to creating them in Word and printing them as a PDF file). What are the advantages/disadvantages to using a Perl binding to LaTex, generating LaTeX source by hand and printing with pdflatex, or continuing to use PDF::API2? I'm much more familiar with LaTeX and comfortable using it than PDF::API2, and again any reason to start using Perl/LaTeX might be good enough.

Finally, I suspect that this project might involve the creation of graphics.. I have used both gnuplot and R to manually create graphics, and it seems to me that, if I use LaTeX, sweave might be a good solution for producing PDFs with embedded graphics. I'm just wondering of anyone has experience with this, or even just an opinion.

Thanks, CC.
 
J

John Bokma

ccc31807 said:
I've been asked about the automation of a series of reports that are
now being created by hand and printed as hard copies for
distribution. I have two questions for the combined experience of this
group, both concerning PDF.

First, I produce reports now as csv files, and using
Excel::Writer::XLSX as Excel 2010 files. I have no problem with
either, as they are both quick, easy, and effective.

Second, I have been using PDF::API2 for years, with good results, but
might need to look at other options, such as CAM::pDF. If I'm happy
with PDF::API2, is there an incentive to look at other libraries for
the creation of PDF files? I might be looking for an excuse to use
another library, so this is a case where any reason might be good
enough.

Third, I am accustomed to using LaTeX as my general purpose tool for
creating documents (as opposed, for example, to creating them in Word
and printing them as a PDF file). What are the
advantages/disadvantages to using a Perl binding to LaTex, generating
LaTeX source by hand and printing with pdflatex, or continuing to use
PDF::API2? I'm much more familiar with LaTeX and comfortable using it
than PDF::API2, and again any reason to start using Perl/LaTeX might
be good enough.

Finally, I suspect that this project might involve the creation of
graphics. I have used both gnuplot and R to manually create graphics,
and it seems to me that, if I use LaTeX, sweave might be a good
solution for producing PDFs with embedded graphics. I'm just wondering
of anyone has experience with this, or even just an opinion.

I generate my invoices as follows:

text file -> [ Perl program ] -> xml -> [ saxon ] -> fo -> [ FOP ] -> PDF
_
xslt /|

If you want to learn something new, XSLT/XSL-FO is something I enjoy
having in my toolbox.

You might also want to have a peek at pandoc.
 
C

ccc31807

text file -> [ Perl program ] -> xml -> [ saxon ] -> fo -> [ FOP ] -> PDF
_

xslt /|



If you want to learn something new, XSLT/XSL-FO is something I enjoy
having in my toolbox.

Years ago, probably around 2003, I used XSLT, and you are right in that it's a great tool to have. I'm not sure what this project will entail, and I thank you for reminding me about XSLT. It may be useful.

I generate most of my work like this:

data-files -> Perl-script -> (csv|HTML|PDF|Excel|email)

CC.
 
C

ccc31807

Does such a creature exist? (Beyond the likes of LaTeX::Driver, which
just automates running latex on generated source.)

I don't know, which is why I asked the question. Yes, I searched CPAN, but sometimes things are not obvious and we overlook them.
When you say 'by hand', I assume you mean 'with Perl'? If I were
generating PDFs, this is what I'd do. (Actually I'd use ConTeXt, since
it's easier to control, but that's immaterial here.)

'by hand' means typing the commands, like this:
\paragraph{Example}This is a paragraph.

I generate HTML files with Perl like this:
my $var = 'paragraph';
print OUT qq(<html><body><p>This is a $var.</p></body></html>);

I generate csv files the same way:
print CSV qq("$col1","$col2","$col3"\n);

However, I generate Excel files using the OO syntax of the package.

I'm at a point where I will need to do significant new work, and this strikes me as a good time to investigate alternatives. After all, if I'm going to be doing a lot of work, I might as well use it as an opportunity to learn something new and different.

CC.
 
M

Mart van de Wege

ccc31807 said:
Third, I am accustomed to using LaTeX as my general purpose tool for
creating documents (as opposed, for example, to creating them in Word
and printing them as a PDF file). What are the
advantages/disadvantages to using a Perl binding to LaTex, generating
LaTeX source by hand and printing with pdflatex, or continuing to use
PDF::API2? I'm much more familiar with LaTeX and comfortable using it
than PDF::API2, and again any reason to start using Perl/LaTeX might
be good enough.

Finally, I suspect that this project might involve the creation of
graphics. I have used both gnuplot and R to manually create graphics,
and it seems to me that, if I use LaTeX, sweave might be a good
solution for producing PDFs with embedded graphics. I'm just wondering
of anyone has experience with this, or even just an opinion.
At my previous employer I used to autogenerate reports for our customers
using LaTeX::Driver with great success.

I also used to generate the graphs for those reports using
SVG::TT::Graph. Not because SVG was easy to bind into LaTeX (that sucked
actually), but because SVG::TT::Graph had a nice API to generate graphs
IMO. I used the ImageMagick bindings to convert the output into
something that LaTeX would like, and Template Toolkit to fill in the
LaTeX documents and generate the links to the graphs.

So, use your favourite graphing module to create your graphics, use
TT LaTeX templates to build your documents, and run the output of the
processed templates through LaTeX::Driver, that's the way I would do it.
 
C

ccc31807

At my previous employer I used to autogenerate reports for our customers
using LaTeX::Driver with great success.

Mart,

Thanks very much for your input. Part of my problem is that I haven't figured out what I'm supposed to be doing. The largest part of my job is to takeinput (almost always as CSV files) and munge them into some kind of output(mostly these days as Excel, CSV, or PDF). I /think/ that I will be producing a report with a mixture of file formats, including PDF and Excel, with dynamically generated graphical elements -- I'm not sure but it looks like it's headed this way.

I'm very comfortable generating Excel files and PDF files (with PDF::API2).I also like using R and LaTex. I've been casting a covetous eye on Sweave but haven't actually used it. And of course, I use Perl for the heavy lifing.
I also used to generate the graphs for those reports using
SVG::TT::Graph. Not because SVG was easy to bind into LaTeX (that sucked
actually), but because SVG::TT::Graph had a nice API to generate graphs
IMO. I used the ImageMagick bindings to convert the output into
something that LaTeX would like, and Template Toolkit to fill in the
LaTeX documents and generate the links to the graphs.

I like using SVG when I can. Normally, when using LaTeX, I target my outputimages to EPS. EPS works well, but I would really like to try SVG. Unfortunately, R is limited in the kinds of graphical output formats it has, and Iwill definitely NOT be using JPEG, GIF, BMP, or PNG!
So, use your favourite graphing module to create your graphics, use
TT LaTeX templates to build your documents, and run the output of the
processed templates through LaTeX::Driver, that's the way I would do it.

I will give this a great deal of thought. I can auto generate graphics, andI can certainly embed them in a PDF module, but I think that will be a kludge. I like the idea of Sweave because I like the idea of embedding R code in LaTeX, and I really like LaTex. I just don't know how this will work with Perl, and the bottom line is that Perl is essential for the data munging that underlies all the output stuff.

CC.
 
D

Dr Eberhard Lisse

Generating SVG is easy by using the R svg device.

I find that rsvg-convert has a small footprint and produces excellent
results, much better than ImageMagick and as good as Inkscape.


el
 
C

ccc31807

Generating SVG is easy by using the R svg device.
I find that rsvg-convert has a small footprint and produces excellent
results, much better than ImageMagick and as good as Inkscape.

I got started with the project yesterday, and have decided to use Excel::Writer, PDF::API2, and Statistics::R. I have generally used EPS for my graphics, but I'll try SVG. I will need to embed the graphics in a PDF file, and use epstopdf to convert my EPS graphics to PDF. I guess I'll find out how well SVG works.

Thanks, CC.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,818
Messages
2,569,736
Members
45,707
Latest member
onlinereputationrepairser

Latest Threads

Top