New approach to generating PDF documents in Drupal using Views

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
hunziker's picture

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?

Comments

PDF Catalog

jonnyj's picture

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

aufumy's picture

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

multilingual

arulraj.mu's picture

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

candelas's picture

@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

arulraj.mu's picture

Could you suggest some good tutorials how to do.

module in dev

candelas's picture

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

hunziker's picture

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

ledom's picture

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.

hugoncalves's picture

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

hunziker's picture

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

velpan's picture

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

patturaja's picture

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

nandwabee's picture

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:

Hot content this week