Summary:
In this article, Austin Ziegler introduces the creation of a variety of types of documents with PDF::Writer for Ruby. This introduction covers basic creation, partial document generation and customization, and Rails-generated documents.
The ability to add new comments in this discussion is temporarily disabled.
Most recent reply: December 1, 2008 4:33 AM by
|
In this article, Austin Ziegler introduces the creation of a variety of types of documents with PDF::Writer for Ruby. This introduction covers basic creation, partial document generation and customization, and Rails-generated documents. Read this Artima article by Austin Ziegler, creator of PDF::Writer http://www.artima.com/rubycs/articles/pdf_writer.htmlWhat do you think about using PDF::Writer?
|
|
|
I liked the article. Good introduction. I'm new to ruby and rails and am learning and starting to work on a first project which is going to involve lots of number type data so it would be really nice to allow people to be able to export that data in lots of different formats. You mentioned there was just one type of chart available at the minute. Would it be very difficult to introduce other types of charts and colour them ? And as far as I can see (maybe I'm wrong and need to pay more attention) these are static examples where everything we see in the pdf has been hardcoded. How would I go about creating a generic export PDF type function that would take the XHTML structure and spit it out into a nice pdf?
|
|
|
> You mentioned there was just one type of chart available > at the minute. Would it be very difficult to introduce > other types of charts and colour them?
Strictly speaking, it wouldn't. It's a matter of time. Charts::StdDev is the only type because that's all that I've had time to develop. Any user-submitted chart type would be accepted into the PDF::Write project under the same licence.
> And as far as I can see (maybe I'm wrong and need to pay > more attention) these are static examples where > everything we see in the pdf has been hardcoded.
For the examples in the article, that is correct. I don't have a database application where this would make sense to demonstrate and considered it a little too advanced for this introduction.
> How would I go about creating a generic export PDF type > function that would take the XHTML structure and spit it > out into a nice pdf?
That's the real rub. It's a hard problem that will take a lot of code to solve. There are some bizarre things with XHTML support that need serious thought. (There's a reason that the table support model in PDF::Writer isn't based on the XHTML table model.)
|
|
|
Ok, thanks for replying :) Now, I'm a completely useless coder really for this type of thing bue perhaps I could help a little bit in other ways. I'm going to start development of my first little rails application this week which would include plenty of data that you could play around once I get it onto a live domain. Then I saw this article on sitepoint a few weeks ago about pdfs and php. Maybe it could help you with a few ideas: http://www.sitepoint.com/article/generate-pdfs-php
|
|
|
Thank you for the pointer. The relevant code is on the 4th page of that article, and all it does is have a simple example of a manually generated pie chart. The difficulty with making charts in PDF::Writer is that they have to be a little smarter than that, as they are components to be reused. My main problem isn't with figuring out how to create such charts (as I could easily take Charts::StdDev and create Line and High-Low charts, and it wouldn't take much to go from those to vertical Bar charts), but a severe lack of time.
Future directions for PDF::Writer include SVG import (which may make some of the charting issues moot, as well), presentation support (which is almost done, but probably still a month from release), document reading and modification, and direct TTF support. Some of the work for SVG import will make it much easier to do XHTML conversion at a later date, but I think I will be leaving that for others to tackle using PDF::Writer as a worker capability.
|
|
|
Austin, a great read! This almost seems to simple. I look forward to using PDF::Writer, and I look forward to being able to utilize ruby to generate pdfs rather then using Java!
|
|
|
Hi I fell across this by accident. I had been wondering how I could create a utility that I could call from a ruby test script would log my screen based tests and support inclusion of screen images, tables, colours for highlighting sections of test. I also wanted to use common file format so that the documents could be displayed by most users. I had imagined that I would need to write something to create MS Word RTF documents (I assumed Adobe would be too hard). Then I saw your PDF::Writer for Ruby!... The install was easy (using GEMS) and the demos run first time. The PDFs look great. All very positive (and very professional). I am looking forward to using this in my testing. Thanks for creating this and sharing it Peter Gillogley http://www.gillogley.com/testing.shtml
|
|
|
Hi. I am using PDF:Writer for a month now and I face only one problem, as long as I live in Greece: display of greek characters. As a first approach I extract an .afm file from a greek font file, copy it to /lib/pdf/writer/font, add the differences to the select_font function (cp1253 codes) and get greek characters displayed correctly, but only in viewers different than acrobat reader. In acrobat reader the characters are correct but seems that all the metrics are gone. Do you have any ideas?
|
|
|
How about support for xsl-fo? Since it's a standard formatting technique in f.ex. xml-based publishing systems, it would seem like a natural feature to add.
Best regards,
Kenneth, Denmark
|
|
|
Does anyone know if PDF::Writer supports png images with transparecy?
Cheers, Ray
|
|
|
Hello,
I used pdf writer in rails and i used the example:
send_data _pdf.render, :filename => "hello.pdf", :type => "application/pdf"
When i download and open the pdf file, it can't be read because it is corrupt. Any ideas?
Thanks, /franee
|
|
|
Does anyone know how to make the PDF Writer library fit a table to a page. Or, rather, resize a page to make a table fit. I've got code that dynamically generates tables (for a printable version of a report), but if the table has a lot of data, it doesn't fit on the page, and the table just gets chopped off on the left and right. Is there a way to tell PDF Writer to make the page resize to fit all the objects that are going to be rendered on it?
|
|
|
Where is the 95 page manual? I can't find a link to it anywhere. Is it contained in a downloadable archive?
|
|
|
|
Is there any way to implement subtables with PDF:Writer? I have created a report for a database app that displays each sale on a row. I need to be able to display a subtable inside each row for the lineitems for that sale.
|
|