- Posts: 19
COMMUNITY FORUM
pdf extension for k2 items
- Nilesh Toshniwal
- Topic Author
- Offline
- New Member
Less
More
14 years 8 months ago #81171
by Nilesh Toshniwal
pdf extension for k2 items was created by Nilesh Toshniwal
I have seen that its requested so many times and by so many users, so I am planning to build my own k2 plugin to have pdf button after item title and then link it to create pdf file not sure how and where to start as this would be my first k2 plugin, but any suggestion or recommendations will defintely add to it.
Please Log in or Create an account to join the conversation.
- Marcos Peebles
- Offline
- New Member
Less
More
- Posts: 5
14 years 6 months ago #81172
by Marcos Peebles
Replied by Marcos Peebles on topic pdf extension for k2 items
Hi Nilesh,
Any news on this? have you been able to make it? Thx
Marcos
Any news on this? have you been able to make it? Thx
Marcos
Please Log in or Create an account to join the conversation.
- Nilesh Toshniwal
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
14 years 5 months ago #81173
by Nilesh Toshniwal
Replied by Nilesh Toshniwal on topic pdf extension for k2 items
Hi Macros,
I tried but couldn't give much time to it, though I got basic pdf ready, but need to embed enhanced features like showing author, category, creation date or modified date of item etc etc basically if I say it technically the parameters you set for item view options, as I got busy with some other stuff on my projects so cant manage to give it a try, but posting my development here and brief instructions, so if others developers can contribute to it.
1. place the attached view.pdf.php file to components/com_k2/views/item folder
2. add a piece of code as in attached txt file to your item template (the template you are using for k2) like I used default template which comes with k2 (for mine the path was components/com_k2/templates/default/item.php )
Please note: this is very basic code and I don't suggest it to use it on any live environment, and i edited core template file while you can use template override for the same. (just done to save my time :) item-template-code.txt)
I tried but couldn't give much time to it, though I got basic pdf ready, but need to embed enhanced features like showing author, category, creation date or modified date of item etc etc basically if I say it technically the parameters you set for item view options, as I got busy with some other stuff on my projects so cant manage to give it a try, but posting my development here and brief instructions, so if others developers can contribute to it.
1. place the attached view.pdf.php file to components/com_k2/views/item folder
2. add a piece of code as in attached txt file to your item template (the template you are using for k2) like I used default template which comes with k2 (for mine the path was components/com_k2/templates/default/item.php )
Please note: this is very basic code and I don't suggest it to use it on any live environment, and i edited core template file while you can use template override for the same. (just done to save my time :) item-template-code.txt)
Please Log in or Create an account to join the conversation.
- Nilesh Toshniwal
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
14 years 4 months ago #81174
by Nilesh Toshniwal
Replied by Nilesh Toshniwal on topic pdf extension for k2 items
find second version of file, added code for following:
1. To show Author name in pdf
2. To show created date and time and last modified date and time in pdf file.
1. To show Author name in pdf
2. To show created date and time and last modified date and time in pdf file.
Please Log in or Create an account to join the conversation.
- Nilesh Toshniwal
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
14 years 4 months ago #81175
by Nilesh Toshniwal
Replied by Nilesh Toshniwal on topic pdf extension for k2 items
Please find modified version, found few bugs in last file.
Please Log in or Create an account to join the conversation.
- Marcos Peebles
- Offline
- New Member
Less
More
- Posts: 5
14 years 4 months ago #81176
by Marcos Peebles
Replied by Marcos Peebles on topic pdf extension for k2 items
Awesome Nilesh, gonna test this, thx for your efforts and work!
Marcos
Marcos
Please Log in or Create an account to join the conversation.
- Nilesh Toshniwal
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
14 years 4 months ago #81177
by Nilesh Toshniwal
Replied by Nilesh Toshniwal on topic pdf extension for k2 items
I am Still working on it to get comments integrated along with Item Contents, as its just currently integrate contents only, but I found joomla is using very old TCPDF library, while new TCPDF has got of features, so I am scared pdf generated can be in broken format if using lot of advanced html tags. :( trying to check if we can include new tcpdf library somehow without hacking core joomla and k2
Marcos Peebles said:Awesome Nilesh, gonna test this, thx for your efforts and work! Marcos
Marcos Peebles said:Awesome Nilesh, gonna test this, thx for your efforts and work! Marcos
Please Log in or Create an account to join the conversation.
- Ruth Cheesley
- Offline
- Senior Member
14 years 4 months ago #81178
by Ruth Cheesley
Ruth Cheesley
Virya Technologies
Replied by Ruth Cheesley on topic pdf extension for k2 items
This looks great, I've got it working but it's not showing tables properly so may have to have a twiddle, also not showing the image.
Good start, I can't believe it's not a core part of K2 to be honest!
Ruth
Good start, I can't believe it's not a core part of K2 to be honest!
Ruth
Ruth Cheesley
Virya Technologies
Please Log in or Create an account to join the conversation.
- Nilesh Toshniwal
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
14 years 4 months ago #81179
by Nilesh Toshniwal
Replied by Nilesh Toshniwal on topic pdf extension for k2 items
Hi Ruth
Thx for all your feedback, but this is not a problem with this code, this is actually all because joomla still uses very old tcpdf library, if you dont have your site live, you can give a try like, download the latest tcpdf library from www.tcpdf.org and extract it and then go to /libraries and replace the tcpdf folder there with your downloaded one and try generating pdf then
Another thing I found with joomla is it has hard coded image scaling to 25% in file libraries/joomla/document/pdf/pdf.php line no. 41, set scale as 4 if you change that to 1 you will get original image size else your image size will be 25% of its displaying on browser.
I am still trying if can do something without replacing or making core hacks and will surely give more tries soon. :)
Ruth Cheesley said:This looks great, I've got it working but it's not showing tables properly so may have to have a twiddle, also not showing the image. Good start, I can't believe it's not a core part of K2 to be honest!
Ruth
Thx for all your feedback, but this is not a problem with this code, this is actually all because joomla still uses very old tcpdf library, if you dont have your site live, you can give a try like, download the latest tcpdf library from www.tcpdf.org and extract it and then go to /libraries and replace the tcpdf folder there with your downloaded one and try generating pdf then
Another thing I found with joomla is it has hard coded image scaling to 25% in file libraries/joomla/document/pdf/pdf.php line no. 41, set scale as 4 if you change that to 1 you will get original image size else your image size will be 25% of its displaying on browser.
I am still trying if can do something without replacing or making core hacks and will surely give more tries soon. :)
Ruth Cheesley said:This looks great, I've got it working but it's not showing tables properly so may have to have a twiddle, also not showing the image. Good start, I can't believe it's not a core part of K2 to be honest!
Ruth
Please Log in or Create an account to join the conversation.
- dani_imanima
- Offline
- New Member
Less
More
- Posts: 10
14 years 1 week ago #81180
by dani_imanima
Replied by dani_imanima on topic pdf extension for k2 items
I want show the extrafield in pdf,
it's possible?
it's possible?
Please Log in or Create an account to join the conversation.