Can I combine this to show inside the pdf a view? (using insert view for example?)
Thanks!
Rosamunda

Comments

lefnire’s picture

You can either user Custom Tokens and write some php to pull a view, or you use Viewfield to include a view in your node and use that field as a token

Rosamunda’s picture

Thanks for your answer :)

I meant something like showing a view´s content (attaching it to a node with viewfield, for example) and theming that view´s output inside the pdf.

For example, to create some sort of invoice (without using the invoice module). That view would show:
User A must pay $100 before 01/04/2009
User B must pay $90 before 01/04/2009
User C must pay $115 before 01/04/2009

... and the pdf will show each field´s within the proper context, allowing the user to print all invoices at once...

Thanks again for your kind response.

Rosamunda

lefnire’s picture

hm, not sure I still understand (sorry, I'm bad at this....)

So you want a content type like:
invoice{
field view1
field date //etc
}

and you want the view (which is a field of the node) to be pulled into the pdf? if that's the case, again you'd just use Viewfield as the field, and then that field will expose a token (like [field-view_field-formatted]) that you'd insert as the Value for the fillpdf form's field. You'd handle formatting from within the view, or you can specify formatting in the original PDF's form-field (you can designate it as rich-text and bolded, or whatever from within Acrobat Pro).

If that still doesn't help, lay it on me detailed -- I tend to be a bit slower at understanding req's sometimes.

Rosamunda’s picture

Thank you again for your kind answer and interest in my question!!
I´m certainly the one that cannot make herself clear enough, probably because my sloppy english :) Is my own fault, I´m very sorry.

Let´s see if I can get it explained more accurately with an example:

The school administrator creates a node that has a certain view embedded, like this:
===
Title: Student´s debts for this month
Due Date: 01/04/2009 (cck field)

ViewField that embed a certain view, that shows it like this:
username: Sam
Aumont: $30 (cck field)
Items bought: 1 Drupal Book (cck field)

username: Anne
Aumont: $25 (cck field)
Items bought: 1 Cook Book (cck field)

username: Joseph
Aumont: $100 (cck field)
Items bought: 5 Math Books (cck field)
===

Could it be possible that the administrator could get a pdf for each item inside the view? Something like:

=================
Hi Sam, you owe us $30 for this stuff: 1 Drupal Book
=================

=================
Hi Anne, you owe us $25 for this stuff: 1 Cook Book
=================

=================
Hi Joseph, you owe us $100 for this stuff: 5 Math Books
=================

So people could print it and give one to the corresponding student.

Again, many thanks for your time... and patience!!

Rosamunda

GreyHawk’s picture

Rosamunda -

Sounds like you're looking for a "mail merge" kind of function, where when you call up the view or activate a trigger, it would generate a FillPDF output for each user where the filter value of amount owed is >0, so if you have the following users and accounts:

User | Amount Owed | Itm Qty /Description
Anne | $25 | 1 /Cook Book
Abe | $0 | 3 /Drupal Book
Joseph | $100 | 5 /Math Books
Sam | $25 | 1 /Drupal Book
Sven | $0 | 2 /Blank books

...you'd get the output you described above, with a separate PDF printing for Anne, Joseph and Sam and nothing for Abe or Sven.

Not sure how to pull that off, but it would be quite useful. Might have to be a secondary module tho, unless it's just a matter of writing some php code to query the DB and outputing data to the fill-pdf node, generating an output node for each record returned...but I don't know how to pull that off. I'm still a n00b in terms of the internals and some of the coding.

Rosamunda’s picture

Thanks for your concern in this issue, though. I hope that someone could get that done. It would be quite useful.
I´m not a programmer at all, so I would need the help from someone more qualified :)
Thanks anyway!!

Rosamunda

wizonesolutions’s picture

Category: task » support
Status: Active » Fixed

This would be easier now that PDFs can be saved to file paths instead of being sent as downloads. But it would be a custom solution, and so I'm marking this fixed.

Pretty sure time has moved on since then anyway :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

frankfarm’s picture

I am trying to follow the Viewfield solution described in this thread. I successfully installed Viewfield and successfully created a test content type with field name field_prereqsview of type Views configured to "Always use default value" and in the "Allowed values" section I selected the view name I wanted to display. I then successfully created a new node of this test content type and successfully saw the view generated. However, at, for example, /admin/content/fillpdf/31/edit/prereqs I am unable to add the Viewfield field because the token does not appear in the list. Should it? I'm expecting to see a new section called something like "Views tokens" but nothing like that appears. i.e., if the token I want is not appearing, what do I need to do to make it appear?

wizonesolutions’s picture

Hmm. I have encountered inconsistencies in individual CCK field modules and tokens - Zipcode and Phone number, for example. They should appear under Node tokens unless something is preventing them from doing so. I'm not exactly sure how CCK tokens work. You'd have to look into this more, and a patch would be welcome (in a new issue - I believe there is a more relevant one for this). I don't plan to implement this at this time myself.