Closed (won't fix)
Project:
Views PDF
Version:
6.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
16 Jun 2011 at 07:14 UTC
Updated:
12 Dec 2012 at 13:15 UTC
Jump to comment: Most recent file
Comments
Comment #1
hunziker commentedThe support for such things is not that good, but you could do it as follow:
Place the elements on the PDF relative to last writing position and define a width for the elements. When the elements should be printed out of the page, a new line is started.
But this is rudimentary and not really stable solution. To support such printing you should use some custom code, which ensures a correct line break after two records. This can be done in the render before field. Something like this should do the job:
The
andtags can be omitted, but for better code style it is useful here.Comment #2
ledom commentedThanks to show me the way.
Here is what I do:
Position relative to: Field Self
Position y: 100
PHP Code Before Output:
PHP Code After Output :
It works fine for the first page, but on second page there is only on entry then it overwrite second and next entries on the first page. I do not understand why it go back to first page when I use Field Self
EDIT: tested dev version > same problem. Using Last Writen Position semmes to solve the overwrite first page.
Comment #3
ledom commentedUnable to get it working for more of one page. It would be good if drupal can generate directly pdf labels but finally I found another way to get it.
If someone is interested:
- Use Views bonus CSV to create a CSV from the view
- Use the linux tool Glabel to import CSV and print labels
Comment #4
hunziker commentedFor labels with an external solution the approach mentioned by ledom is well. If you are familiar with OpenOffice, you could also using the serial printing functionality of it. (This works also on different architectures than linux.)
Comment #5
hozt commentedWould it be possible to have a Grid Format for this module? This would allow for us to create multi-column views for printing sheets of labels.
Thanks for this great module!
Comment #6
amirimran commentedI guess that is possible, i needed same thing in one of my project, so i have created some custom code which allows me to draw data in grids, i can have 2 or more columns. i will try to post that as patch and would love to see the comments on that one.
For now i have raw code in multiple files which i need to clean up so it won't become sort of offensive for this module lovers :)
Comment #7
mbria commentedamirimran, do you mind to publish your raw code?
I'm in a 4 columns layout for label printing and your code looks like the best approach.
Cheers,
m.
Comment #8
amirimran commentedHi, i would gladly but at the moment i am trying to make it more clean so it becomes easy to understand and use.
I have used pdf un formatted as base but i think it can be done more efficiently on base of pdf table.
well, if you think you can hold off till this weekend i may have more useful version for you. what do you think?
Comment #9
mbria commentedSorry for my silence amirimran.
Yes amirimran, if you found a clean solution for this and you publish, it would be nice because my approach is far from been elegant or complete. :-)
With the following piece of code and a little bit tunning (to fit your label layout) you can print labels of any number of columns.
Known bugs?
Plenty of them:
I attach a PDF with the results.
Those are my settings:
BASIC settings:
PDF settings:
And this is the tricky part, at "PDF Fields" this is the code:
Position relative to: Last writing position.
Position relative to corner: Top Left
PHP Code Before Output:
PHP Code After Output:
I'm not proud, but will do the job till I find a definitive solution.
I also attach an export of my view, just in case other like to test.
Comment #10
nonzod commentedMy ugly solution
PHP Code Before Output:
PHP Code After Output:
Comment #11
Makku01 commented@nonzod: thank you for your code. It works really good. Except for the last row on a page. When this label comes exceeds a certain y coordinate near the bottom of the page, it only prints the first label of the last row[x] and then skips to the next page. On page two it now prints the missing label of the row[x] on the desired coordinates and then it evalutes ($item == $perPage) as true and creates a new page.
Do you have any idea how to solve this?
Thanks in advance!
Comment #12
vegansupreme commentedMakku01, I've had success setting the page bottom margin to some negative number. It should be okay to use even a large number.