Hi,

I have a problem with commerce pdf invoice and views pdf module.
The line item (include view) is in the top of the pdf document and i can't move it.
I try all the positions (page, header / footer, field...) but don't work.
Anyone have an idea for solve this problem ?
Thanks a lot
best regards

Comments

itamair’s picture

Priority: Normal » Critical
StatusFileSize
new138.16 KB

subscribe! I have got the exact same problem ... tried everything.
Any help would really be appreciated.

I attach a screenshot ...

loparr’s picture

Same here. Anybody found solution?

danharper’s picture

Subscribe

silkogelman’s picture

I don't even get that far:
#1511592: PDF doesn't contain the invoice information

How did you?

maico de jong’s picture

I think the problem is views_pdf can't calculate the height of an embedded view so positioning an included view is not possible at this moment.

Instead of using an included view we could use the commerce 'commerce_line_items' field where you can specify a view(or just the default line item view) that renders the line items. This way, we don't even need to use the views_field module and the extra Commerce Pdf Invoice Line Items view generated by this module.

This method also solves the positioning problem.

lsolesen’s picture

Title: include view » Line items include view not positioned correctly
Priority: Critical » Major

How did all you guys get the line items to show at all? Are you still able to get those to display?

@MDJ Webdiensten Could you show how that would look, and maybe create a patch for the module for others to review?

maico de jong’s picture

StatusFileSize
new14.92 KB

I won't create a patch beceause i've build my own views commerce invoice view without using this module. I created an export of my view(it's only one view) that only needs commerce module + views_pdf module. So i think it will work once you've import the view.

Please take a look at the view and maybe create a patch for this module to accomplish something that works too.

A view like this combined with rules&mimemail(Save pdf with rules, send mimemail with saved pdf as attachment) seems to me like a very nice way to send a pdf invoice by mail.

lsolesen’s picture

This issue will probably be solved, when #1423440: Include View doesn't seem to be taking up space is solved in views pdf.

vladsh’s picture

I'm trying to implement scenario mentioned in #7, i.e. "Save pdf with rules, send mimemail with saved pdf as attachment" with the provided custom view. But saved PDF have no line items. When I view invoice in the browser via [sitename]/user/[userID]/orders/[orderID]/invoice URL - all OK.

vladsh’s picture

Answering my own question.
Saved PDF has no line items due to the access restrictions.
Further discussion about line items is here:
http://drupal.org/node/1673252#comment-6542450

bendev’s picture

Thanks MDJ Webdiensten I have reused your view and it is working well.

I only have a small issue: I have added the shipping and billing adress into the fields and they are displayed with too much inter line space. (E.g there is one empty line between the street and the zip code and another between the zip code and the country)

How can you control the style of the billing and shipping adresses ? thanks

vladsh’s picture

You may Edit your's address field like this:

1. Select "Customer profile" in the "Relationship" dropdown.
2. In the "Format handlers" section check "Address form (country-specific)" checkbox.
3. In the "REWRITE RESULTS" section check "Rewrite the output of this field" checkbox.
4. Fill in the "Text" textarea with the desired tokens. In my case it looks like this:
[commerce_customer_address-first_name] [commerce_customer_address-last_name]
[commerce_customer_address-premise]
[commerce_customer_address-thoroughfare]
[commerce_customer_address-postal_code] [commerce_customer_address-locality]

5. Check "Convert newlines to HTML
tags" checkbox.

bendev’s picture

thanks for your answer.
it works as you explained by creating two relationships (billing and shipping adress)

bendev’s picture

I still have a small issue linked with permissions ...

With the admin role I can see the pdf generated correctly.
If I use a different role, I see a blank pdf.

This role can view the following page without issue
admin/commerce/orders/X/view

on the pdf view, the same fields are used:

commerce order created date
commerce order order number
order line item
order total
shipping address
billing address

is there any additional permission required ? I didn't see any specific to PDF's...

thanks

bendev’s picture

further testing shows that superadmin can see pdf of any order
user with administrator role (all permissions set) can only view pdf of its own orders.

Does this help to narrow down the issue ?

maico de jong’s picture

In the export i attached at #7 there was some custom php validation in the contextual filter ' Commerce Order: Uid '. There i checked if the current user is one of a given role and returnd true if so.

There should be a better way(checking for permissions) but that worked for me. So you could just change the role or maybe work with permissions.

bendev’s picture

thanks I didn't see that one....
you can just use the view access parameter to limit to some roles...(in PDF settings=> access)

as a validation, checking that the arg is a numerical value or a username is enough in my opinion.

theorichel’s picture

Issue summary: View changes

@MDJ Webdiensten

I have installed your exported View and it works allright, except for the fact that each PDF has a line 'Edit View' in the middle of the page which is supposed to link to 'resource://pdf.js/web' .
When I search the web how to get rid of this is get suggestions that it has to do with Firefox, but I see the line in Chrome and IE as well.

Any idea how I can get rid of this?

Thanks