New approach to generating PDF documents in Drupal using Views

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by hunziker on March 8, 2011 at 7:50am

I have create a new project that does using the views module to generating PDF documents directly without of using the HTML layer between. The approach is using the fields of the view to positioning the data on the PDF document. You can specify for each element the position relative to the page, relative to another element or write in to the Header / Footer.

This enable the system to generate more printable versions of the content. In addition you can set a background PDF as a template. With this approach we can overcome the following disadvantages of other approaches:

  • No control over page flow (page break)
  • Little or no control over page header and footer
  • You need HTML skills to change the layout
  • The are slow or need a lot of memory, because they need to render the HTML first
  • Complex tables make troubles
  • Vector graphics can not be implemented, therefore the printing of the document can be problematic
  • You are limited by HTML's capabilities

You can find the project as a sandbox project under: http://drupal.org/project/views_pdf

Are there any interests to this approach?

Categories: , ,

Comments

PDF Catalog

Posted by jonnyj on April 7, 2011 at 8:46pm

I'm currently developing a client site that allows trade users to flag content (product specs for a sporting equiptment provider), thereby adding it to a 'folio' so they can package products together. The idea is that they can put together packs online to aid in their own tender process.

I've literally just started with D7 and am looking into generating a PDF based on the view of flagged products. After looking at your module I'm tempted to go back to D6... interested to see any progress you make on this module. I think it's a nifty bit of functionality with a number of potential use cases.

Views PDF can be found at

Posted by aufumy on April 22, 2011 at 12:51am

Views PDF can be found at this link
http://drupal.org/project/views_pdf

multilingual

Posted by arulraj.mu on May 23, 2011 at 12:11pm

How do i print the pdf in multilingual - Tamil.

Where is the option to invoke pdf in multilingual - Tamil. By default its doing good in english, in Tamil, its giving the output as boxes.

you need the fonts

Posted by candelas on May 29, 2011 at 11:50pm

@arulraj.mu i am using the module and i am impress how well it works even if it is in dev and barely 4 month old.
at the moment i have just done one node pdfs but with lots of fields.
this week i will be trying with a group of nodes.

i think that your problem is that the pdf has not the fonts for your language.
if you go to the page of the library that it is used for the conversion, TCPDF, and search how to convert fonts, your problem will be solved.

:)

need more details

Posted by arulraj.mu on June 10, 2011 at 3:19pm

Could you suggest some good tutorials how to do.

module in dev

Posted by candelas on June 11, 2011 at 5:01am

since the module is in dev, the documentation isnt made.
you can learn how to use it in the issues and ask there.
the developer, hunziker, helps a lot and he is working very hard to make the module much better.

Hi There is a small

Posted by hunziker on June 11, 2011 at 6:46am

Hi

There is a small documentation:
http://drupal.org/node/1086584

As candelas said, your problem is related to the fonts. Some facts:

  • The module uses the TCPDF (http://www.tcpdf.org/) library.
  • I have not tested any not Western Europe charsets with the Views PDF module.
  • The TCPDF library supports UTF-8 charsets.

The reason why it not works could be:

  • You do not use a UTF-8 font.
  • Views PDF does not do the mapping / selecting correct of the UTF-8 fonts.
  • You have set the wrong database encoding.

If you have more questions, about the Views PDF module, i would suggest you to open an issue in the Views PDF issue queue. There your questions get quicker answered.

Views pdf and avery labels templates

Posted by ledom on June 15, 2011 at 8:06pm

Hi,
Just tried Views pdf and it semmes to do the jog. Thanks to the dev.

2 questions about this module:

-Could you explain how to create a 2 column pdf like this:

Name / Adress | Name / Adress

Name / Adress | Name / Adress

...

It would be great if this module support standard templates like avery labels (http://www.avery.com/avery/en_us/Templates-%26-Software/Templates/Brandi...)

Thanks in advence.

Labels not appear at pdf.

Posted by hugoncalves on June 22, 2011 at 5:41pm

Hello!
Thanks for great module.
I ́ve a question. How can I add to pdf fields default labels, created on content type?
I can achieve same effect adding to $content label I want, but gives a little more work than expected.

Thanks Hugo

In the 6.x version the labels

Posted by hunziker on June 23, 2011 at 6:13am

In the 6.x version the labels cannot be used. You need to use customfields or you append them to the $content variable.

To show the labels rewrite

Posted by velpan on August 10, 2011 at 9:17am

To show the labels rewrite the output of the fields.
Put there label (static text) and field value token with some html markup to control the display of label.

print pdf

Posted by patturaja on November 4, 2011 at 11:02am

hai i am new to drupal... currently m using drupal 7 ...i want to convert my reports into pdf in my project..so m used print pdf module... it is working in content and basic page ..but i dont know how to use in my custom module ..would u help me

Great Job

Posted by nandwabee on October 5, 2012 at 8:24am

This is some great module you made there. One question though,I have been going through the documentation trying to find a way of building a catalog to no avail. Heads up anyone?

A lover of God.A servant of men

PDF

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /