The Artima Developer Community
Sponsored Link

Articles Forum
Creating Printable Documents with Ruby

23 replies on 2 pages. Most recent reply: Dec 1, 2008 4:33 AM by Gustavo Delfino

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 23 replies on 2 pages [ 1 2 | » ]
James Britt

Posts: 21
Nickname: jbritt
Registered: Mar, 2003

Creating Printable Documents with Ruby Posted: Oct 9, 2005 9:00 PM
Reply to this message Reply
Advertisement
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.html

What do you think about using PDF::Writer?


Matthew Bennett

Posts: 2
Nickname: matthewmur
Registered: Oct, 2005

Re: Creating Printable Documents with Ruby Posted: Oct 10, 2005 3:05 AM
Reply to this message Reply
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?

Austin Ziegler

Posts: 207
Nickname: aziegler
Registered: Oct, 2005

Re: Creating Printable Documents with Ruby Posted: Oct 10, 2005 5:35 PM
Reply to this message Reply
> 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.)

Matthew Bennett

Posts: 2
Nickname: matthewmur
Registered: Oct, 2005

Re: Creating Printable Documents with Ruby Posted: Oct 11, 2005 1:23 AM
Reply to this message Reply
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

Austin Ziegler

Posts: 207
Nickname: aziegler
Registered: Oct, 2005

Re: Creating Printable Documents with Ruby Posted: Oct 11, 2005 4:19 AM
Reply to this message Reply
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.

Zach Dennis

Posts: 3
Nickname: zdennis
Registered: Sep, 2004

Re: Creating Printable Documents with Ruby Posted: Nov 6, 2005 4:03 PM
Reply to this message Reply
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!

Peter Gillogley

Posts: 1
Nickname: pgillogley
Registered: Nov, 2005

Re: Creating Printable Documents with Ruby Posted: Nov 29, 2005 12:05 AM
Reply to this message Reply
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

George Tsiftsis

Posts: 1
Nickname: thelonious
Registered: Dec, 2005

Re: Creating Printable Documents with Ruby Posted: Dec 2, 2005 5:22 AM
Reply to this message Reply
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?

Kenneth Priisholm

Posts: 1
Nickname: pryce
Registered: Aug, 2005

Re: Creating Printable Documents with Ruby Posted: Jan 6, 2006 2:25 AM
Reply to this message Reply
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

Ray Carrasco

Posts: 1
Nickname: raycarr
Registered: Feb, 2006

Re: Creating Printable Documents with Ruby Posted: Feb 23, 2006 5:17 AM
Reply to this message Reply
Does anyone know if PDF::Writer supports png images with transparecy?

Cheers, Ray

sinson francis

Posts: 1
Nickname: franee
Registered: Jul, 2006

Re: Creating Printable Documents with Ruby Posted: Jul 12, 2006 12:31 AM
Reply to this message Reply
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

Kareem Badr

Posts: 1
Nickname: kbadr
Registered: Aug, 2006

Re: Creating Printable Documents with Ruby Posted: Aug 25, 2006 2:02 PM
Reply to this message Reply
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?

sf designer

Posts: 1
Nickname: sfdesigner
Registered: Jan, 2007

Re: Creating Printable Documents with Ruby Posted: Jan 5, 2007 10:38 AM
Reply to this message Reply
Where is the 95 page manual? I can't find a link to it anywhere. Is it contained in a downloadable archive?

wiktor macura

Posts: 1
Nickname: wmacura
Registered: Feb, 2007

Re: Creating Printable Documents with Ruby Posted: Feb 3, 2007 8:11 AM
Reply to this message Reply
http://files.rubyforge.mmmultiworks.com/ruby-pdf/pdf-writer-demo-1.1.3.tar.gz

The manual is in there :-)

Chris Barnes

Posts: 1
Nickname: arch79
Registered: Feb, 2007

Re: Creating Printable Documents with Ruby Posted: Feb 5, 2007 10:28 AM
Reply to this message Reply
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.

Flat View: This topic has 23 replies on 2 pages [ 1  2 | » ]
Topic: Scala: A Scalable Language Previous Topic   Next Topic Topic: The Most Important C++ Software...Ever

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use