Page 1 of 2
Different PDF layouts for different pages
Posted: 31 Mar 2010, 09:47
by Gruz
As far as I see, there one can customize the global PDF layout for all PDFs at the web-site. Is it possible to alter the code to use different layout for different pages?
Maybe It's possible to clone the plugin and to make it work for some page suffixes entered in Joomla menu items. Please, give your advice so I can decide if it worth to start such altering for my purposes.
Thanks a lot!
Re: Different PDF layout for different pages
Posted: 01 Apr 2010, 20:11
by Jan
Hi, you can customize it, maybe some if clause and set different layouts for different menu items, etc. but no experiences there
Jan
Re: Different PDF layout for different pages
Posted: 15 Apr 2010, 12:47
by Gruz
Hi,
Jan!
I need your advice again.
As I said before, I need to have different PDF layouyts for different pages. I have much experience with phocaPDF code, as I added a background image to the code and had to learn how it works.
The layouts can be assigned to pages by sections', categories' of articles' ids. But now the layout is one and it's stored in the phocapdfcontent plugin's parameters like
Code: Select all
margin_top=35
margin_left=12
margin_right=12
margin_bottom=25
page_format=A4
page_orientation=P
font_type=helvetica
site_font_color=#000000
site_cell_height=1.5
header_display=1
header_display_line=0
header_data=<div style="padding: 0;"><img src="templates/rt_moxy_j15/images/header/style1/logo.png" style="float: left;" align="left" height="72" width="157" />\n<h1 style="text-align: center;"></h1>\n</div>
header_data_align=L
header_font_type=helvetica
header_font_size=10
header_font_style=B
header_font_color=#000000
header_line_color=#000000
header_bg_color=
header_cell_height=1
header_margin=5
footer_display=1
footer_display_line=0
footer_data=<div style="text-align: center; padding-top: 20px;">ISPW BenchMark Technologies</div>\n<div style="text-align: center; padding-top: 20px;">{phocapdfpagination}</div>
footer_data_align=C
footer_display_pagination=1
footer_font_type=freemono
footer_font_size=8
footer_font_style=
footer_font_color=#000000
footer_line_color=#000000
footer_bg_color=
footer_cell_height=2
footer_margin=15
pdf_name=ISPW
pdf_destination=S
use_cache=0
image_scale=1
display_plugin=0
display_image=1
sef_enabled=0
So there are 2 ways to store 2 or more layouts here.
1. To use a separator between layout's values like
2. Or to make the paramaters for each layout like a line like this (the code is wrapped, but it has 2 lines):
Code: Select all
layout[1]=margin_top=35 | margin_left=12 | margin_right=12 | margin_bottom=25 | page_format=A4 | page_orientation=P | font_type=helvetica | site_font_color=#000000 | site_cell_height=1.5 | header_display=1 | header_display_line=0 | header_data=<div style="padding: 0;"><img src="templates/rt_moxy_j15/images/header/style1/logo.png" style="float: left;" align="left" height="72" width="157" /> | <h1 style="text-align: center;"></h1> | </div> | header_data_align=L | header_font_type=helvetica | header_font_size=10 | header_font_style=B | header_font_color=#000000 | header_line_color=#000000 | header_bg_color= | header_cell_height=1 | header_margin=5 | footer_display=1 | footer_display_line=0 | footer_data=<div style="text-align: center; padding-top: 20px;">ISPW BenchMark Technologies</div> | <div style="text-align: center; padding-top: 20px;">{phocapdfpagination}</div> | footer_data_align=C | footer_display_pagination=1 | footer_font_type=freemono | footer_font_size=8 | footer_font_style= | footer_font_color=#000000 | footer_line_color=#000000 | footer_bg_color= | footer_cell_height=2 | footer_margin=15 | pdf_name=ISPW | pdf_destination=S | use_cache=0 | image_scale=1 | display_plugin=0 | display_image=1 | sef_enabled=0
layout[2]=margin_top=35 | margin_left=12 | margin_right=12 | margin_bottom=25 | page_format=A4 | page_orientation=P | font_type=helvetica | site_font_color=#000000 | site_cell_height=1.5 | header_display=1 | header_display_line=0 | header_data=<div style="padding: 0;"><img src="templates/rt_moxy_j15/images/header/style1/logo.png" style="float: left;" align="left" height="72" width="157" /> | <h1 style="text-align: center;"></h1> | </div> | header_data_align=L | header_font_type=helvetica | header_font_size=10 | header_font_style=B | header_font_color=#000000 | header_line_color=#000000 | header_bg_color= | header_cell_height=1 | header_margin=5 | footer_display=1 | footer_display_line=0 | footer_data=<div style="text-align: center; padding-top: 20px;">ISPW BenchMark Technologies</div> | <div style="text-align: center; padding-top: 20px;">{phocapdfpagination}</div> | footer_data_align=C | footer_display_pagination=1 | footer_font_type=freemono | footer_font_size=8 | footer_font_style= | footer_font_color=#000000 | footer_line_color=#000000 | footer_bg_color= | footer_cell_height=2 | footer_margin=15 | pdf_name=ISPW | pdf_destination=S | use_cache=0 | image_scale=1 | display_plugin=0 | display_image=1 | sef_enabled=0
Surely I need to modify your code to make this work.
Tell me your thoughts please. If I speak not clear, please, tell me, I'll try to explaine more widely.
Re: Different PDF layout for different pages
Posted: 15 Apr 2010, 18:24
by Jan
Hi, I think there I cannot help you, because parameters are saved with help of Joomla! not Phoca PDF, so in such way you need to make some customization to Joomla! but no experiences there
Jan
Re: Different PDF layout for different pages
Posted: 01 May 2010, 23:25
by Gruz
Hi,
Jan!
I modified PhocaPDF to allow differnt pdf layout for differnt pages, allow background image and some other features:
1. Different layouts for different articles - by article id, section id, category id or menu id
2. Different PDF layouts for the 1st and other pages of a document.
3. You can set a background image
4. A fix to start text after an image from the new line
5. An option to include the article title into the content of the article.
All my changes are marked with ##my, so you can easily find them in the code.
You can install component and press Upgrade and just install plugin (it will overwrite the old one). Don't forget to publish the plugin.
It's downloadabel here:
http://www.ex.ua/view/1162176
or
Here I gave incorrect links at http://gruz.org.ua/ , now, 2010-05-06, fixed.
_http://gruz.org.ua/images/stories/2010/04/com_phocapdf_v1.0.5_by_gruz_02.zip
_http://gruz.org.ua/images/stories/2010/04/plg_phocapdf_content_v1.0.5_by_gruz_02.zip
or
_http://
www.filefactory.com/file/b16997b/n/com_ ... ruz_02.zip
_http://
www.filefactory.com/file/b16997d/n/plg_ ... ruz_02.zip
or
_http://uploading.com/files/d3f95d95/com_phocapdf_v1.0.5_by_gruz_02.zip/
_http://uploading.com/files/ma1e41a2/plg_phocapdf_content_v1.0.5_by_gruz_02.zip/
Jan!
Please, have a look! I want to share it with all the users. I beg you to explore my changes and to include it to next phocaPDF release. I'm sure, it will be useful for many people.
I use joomla plugins for different pdf layouts. The plugins are installed and uninstalled from phocapdf backend.
Background images work better with jpg files. I didn't managed to add a vector image as background. I have problems with png.
All the options I added are well-documented (at least I think so)
Re: [Solved] Different PDF layouts for different pages
Posted: 03 May 2010, 19:16
by Jan
Hi, thank you for the improvement. I will take a look at it.
Jan
Re: [Solved] Different PDF layouts for different pages
Posted: 06 May 2010, 02:07
by pepperstreet
Interesting Component! Very cool idea.
Your multiple page layouts reminds me on a possibly use. I came across a site, where CB members can print a proof of membership (bill/acknowledgement), and a little membership card with avatar image. Both are generated as an HTML page, and they are filled with some CB userdata.
I wonder if your solution can be used or modified instead of the current one?! Is it possible to get the userdata into the PDF diectly? Do i still need the previous HTML content... Or am i totally wrong here?
(If this should be a new topic, please feel free to move it arround
)
Thanks for listening.
Re: [Solved] Different PDF layouts for different pages
Posted: 06 May 2010, 10:26
by Gruz
Now it works only with core joomla component com_content. To make it work with other extensions corresponding plugins need to be written.
Re: [Solved] Different PDF layouts for different pages
Posted: 06 May 2010, 13:50
by pepperstreet
Gruz wrote:Now it works only with core joomla component com_content. To make it work with other extensions corresponding plugins need to be written.
Thanks for your info. I am aware of the pdf plugin, which is fired on com_content events. Actually the plugin does not have been ported to react and work on CB content directly. My thought was something like the current solution. That is actually a little PHP(HTML) program, which connects to the DB and fetches the needed fields. Maybe this program could be turned into a Joomla content with JUMI PHP or DirectPHP, or RD addPHP, right?! Than we already have a "normal" joomla content.
(Please correct me if all these thoughts are rubbish
)
EDIT
I think i will choose something like CB Personalizer or CB Profile Pro. It seems to be easier to begin with the CB data collection part... if anyone has additional thoughts or ideas: DonĀ“t hesitate and post something.
Re: [Solved] Different PDF layouts for different pages
Posted: 06 May 2010, 16:26
by Gruz
I think it's possible to write a plugin to handle CB data. Mainly the extension works with HTML, not fetching info from DB fields, but I think both ways can be implemented. The one with fetching from DB will allow more flexible PDF creation, but it may be too complicated to write it.
The content plugin for phocaPDF is called when a joomla event happens. I think altering current plugin to handle CB data is possible. I don't think it's very hard, but one can meet some unexpected difficulties when developing. I think it will demand to alter both - component and plugin in real life.
If you know PHP at a medium level and understand basically Joomla MVC, it will not be a great problem for you to write a plugin. I can help you by advices.
If you need paid customization, better write to Jan, as it's his extension and he has to earn money from his work.