Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a pretty general question.

I have a report that is automatically created from HTML and Javascript and is output as a PDF. I'm using JavaScript because it's the best and easiest way I've found to generate the graphs I want.

So I render all the graphs in HTML documents and then use a tool called wkhtmltopdf to render the a PDF out of all the pages.

Now the problem is that the type produced by that tool absolutely sucks.

What I want to do is render the JavaScript graphs, which renders as a <svg ..></svg> tag, inside a PDF document that has it's layout and text produced by some variation of TeX.

Is this at all possible by any means?

share|improve this question
    
This is probably not what you want to hear, but thought I'd suggest it anyway: You really should consider using pgfplots and/or tikz for drawing especially if you want tight integration with LaTeX. There should be numerous example here that will get you started, but without seeing an example of what your graph looks like I don't know which question on this site to refer you to. –  Peter Grill Apr 12 '12 at 17:59
    
I'm using Protovis to create the graphs, and it's about 25 custom-coded graphs with quite specific layouts, but in general they look like this –  Fredrik Apr 12 '12 at 19:15
    
Thanks for Protovis link, I did not know about that. But bar charts are no problem in pgfplots. Here are a few useful links in case you are interested (not saying that these are the best ones here): How to put the values of each bar in a pgfplots bar chart inside the bar itself?, and Stacked bar-plot: display total value. Search for [pgfplots] bar if you want more examples. –  Peter Grill Apr 12 '12 at 19:24

1 Answer 1

PGFplots has the \addplot graphics (or \addplot3 graphics) feature.

This would allow you to export only the projected graphics plus some meta data about your coordinate space. Then, you import the resulting graphics using \addplot graphics - and communicate the mentioned "meta data" such that pgfplots can properly overlay a suitable axis, including all TeX axis descriptions that the package supports. It would even allow you to change axis limits (somewhat restricted by your input graphics of course).

Here, SVG would be an intermediate step; you would need to convert it to (say) pdf first. But this would not hurt anymore since your graphics would only contain graphical elements, the text would be task of pgfplots and its overlay.

You can find detailed instructions in the pgfplots manual pgfplots manual, section "Using External Graphics as Plot Sources".

In case this is what you want and you run into unparticipated problems, you can ask a more detailed question here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.