[ABD] Print Engine (Printable Topics v2)

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
mitsubishi
Registered User
Posts: 527
Joined: Fri Aug 31, 2001 6:25 am
Location: UK
Contact:

[ABD] Print Engine (Printable Topics v2)

Post by mitsubishi » Tue Jan 07, 2003 12:19 am

OK time to revamp this old mod to add in some of the feature requests. I've a lot of ideas, but more are always welcome. I'm considering altering the method to faciliate printing of other pages as well as some configuration options, like what to do with images and BBcode.
It would be helpful if feature requests could be given a name and number, written in bold, with comments/explaination underneath. If you want to 'vote' for a feature, just title it again with the same name and number in bold, so I can count up the most popular ideas easilly. You don't have to vote, just name the feature normally in quotes to add to the discussion on it. Also I'd like views on using JS/CSS2/XSLT as many browsers have weak support for these.

paCkeTrouTer
Registered User
Posts: 93
Joined: Tue Apr 16, 2002 2:12 am
Location: Melbourne, Australia
Contact:

Post by paCkeTrouTer » Tue Jan 07, 2003 1:00 am

My feature request:

Parse HTML tags/01
This would be a good feature to implement to parse out the existing HTML codes in the Posts. For example if you have tables setup to display data then those tables will be previewd as well so that it can be printed out too. At the moment the HTML tags themselves get shown in the preview of the post.

Herbalite
Registered User
Posts: 205
Joined: Wed Apr 10, 2002 8:11 am
Location: South East Asia

Post by Herbalite » Tue Jan 07, 2003 1:32 am

Biggest wish:

Printout of PM's

Cool feature:
Before printing being given the choice to do some formatting.
Here some of my ideas
-HTML or plain text printout
-Pictures (inline printout, placeholder, imagelink, discard)
-BBCODE tags for printing only, pagebreaks, etc.
-Font selection,
-Setting "soft" margins
-Header and footer

Thanks for listening.

DanielT
Former Team Member
Posts: 3324
Joined: Tue Aug 27, 2002 10:55 am
Contact:

Post by DanielT » Tue Jan 07, 2003 7:57 am

have mitsubishi,

what about a button on the print out page which when clicked allows you to download the topic in a .txt file ?

thanks

netclectic
Former Team Member
Posts: 4439
Joined: Wed Mar 13, 2002 3:08 pm
Location: Omnipresent
Contact:

Post by netclectic » Tue Jan 07, 2003 8:45 am

DanielT wrote: what about a button on the print out page which when clicked allows you to download the topic in a .txt file ?

Or maybe being able to select from a list of popular formats (rtf, doc, pdf, txt, etc...)?
Defend the game:
Image

mitsubishi
Registered User
Posts: 527
Joined: Fri Aug 31, 2001 6:25 am
Location: UK
Contact:

Post by mitsubishi » Wed Jan 08, 2003 6:17 am

Interesting... I have considered PDF, well we'll see :D

netclectic
Former Team Member
Posts: 4439
Joined: Wed Mar 13, 2002 3:08 pm
Location: Omnipresent
Contact:

Post by netclectic » Wed Jan 08, 2003 8:37 am

Actually, i've done this sort of thing in asp and i probably wouldn't recommend rtf, it's really ugly and nasty to do!
Defend the game:
Image

Percu.org
Registered User
Posts: 88
Joined: Sun Apr 28, 2002 2:54 pm
Location: Valence (France)
Contact:

Post by Percu.org » Wed Jan 08, 2003 10:10 am

regarding PDf generator i've done it allready using :

- Wayne Munro, R&OS Ltd, http://www.ros.co.nz/pdf PDF's class
- Attach Mod
- and some functions looks like the one used for FetchPost Mod

here is how it works...

first you have the topic with t to locate it in database :
http://www.percussions.org/forum/viewtopic.php?t=843
second you have the article which is the same but displayed without using any feature of PHPBB :
http://www.percussions.org/article.php?t=843

last the PDF generated :

http://www.percussions.org/pdf.php?t=843

here is the code for pdf.php but you will need to know how works FetchMod and attach mod to retrieve both texte and attachment...

Code: Select all

<?PHP
define('IN_PHPBB', true);
$phpbb_root_path = "forum/";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

$CFG['phpbb_templates'] = 0;
if (!$userdata) {
    if ($CFG['phpbb_templates']) {
        $userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
    }
    init_userprefs($userdata);
}

$root_path 	= './';

$path = array(	'ROOT' 		=> $root_path,
		'TEMPLATE' 	=> $root_path.'template/',
		'INCLUDE' 	=> $root_path.'include/', 
		'BOARD'		=> $root_path.'forum/',
		'IMAGE'		=> $root_path.'forum/files/'); 

$pdf_bbcode = 1 ;	// Autorise l'utilisation de pdf_bbcode dans phpBB ou forum/includes/bbcode.php

include($path['ROOT'] 		. 'extension.inc');
include($path['INCLUDE']  	. 'common.'.$phpEx);
include($path['INCLUDE']  	. 'fetch_board.'.$phpEx);
include($path['INCLUDE']  	. 'fetch_news.'.$phpEx);
include($path['INCLUDE']  	. 'class.ezpdf.'.$phpEx);

$article_board		= phpbb_fetch_article($t);
//========================================================================
//		       PDF URL Encoder 0.9b :
// Permet de remplacer les urls par des liens valides dans le document PDF
//========================================================================
$article_text		= str_replace('<br />','',$article_board[0]['post_text']);
$article_text 	        = preg_replace("#([\n ])([a-z]+?)://([^,\t \n\r]+)#i", "\\1<c:alink:\\2://\\3>\\2://\\3</c:alink>", $article_text);
$article_text		= preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^,\t \n\r]*)?)#i", "\\1<c:alink:http://www.\\2.\\3\\4>www.\\2.\\3\\4</c:alink>", $article_text);
$article_text		= preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", "\\1<c:alink:mailto:\\2@\\3>\\2@\\3</c:alink>", $article_text);

$article_copyright	= "©2003 Percussions.org - Tous droits réservés.";

	$pdf =& new Cezpdf('a4','portrait');
	$pdf->selectFont('./fonts/Helvetica.afm');			// sélection de la police de caractère
		
	$img = $pdf->openObject(); 
	$pdf->setColor(0.6,0,0);
	$pdf->AddText(50,800, 14, $article_board[0]['topic_title']);	
	$pdf->setColor(0,0,0);
	$article_info = 'Cet article provient de la <c:alink:http://www.percussions.org/forum>base de donnée</c:alink> de Percussions.org';
	if (($article_board[0]['attach_number']>0 || $article_board[0]['img_number']>1) && ($t>0)) 
		{
		$article_info.= ' et comporte des illustrations ou des extraits audios';
		}
		
	$pdf->AddText(50,780, 8, $article_info);
	$copyright_size	= $pdf->getTextWidth(8,$article_copyright);
	$pdf->AddText((600-$copyright_size)/2,10,8,$article_copyright);	
	$pdf->addJpegFromFile('images/LogoPercu.jpg',450,750,120,90);		
	$pdf->closeObject(); 	
	$pdf->addObject($img,'all'); 
		
	$pdf->ezSetMargins(110,70,50,50);

	$pdf->ezStartPageNumbers(315,25,8,'','',1);
	$pdf->openHere('XYZ',0,10000,1); 

	
	if (($article_board[0]['img'] <> '') && ($t>0)) {
	
							}	
	$pdf->ezSetDy(-10,'makeSpace');
	$pdf->ezText($article_text,10,array('justification'=>'full'));
	
	$pdf->ezStopPageNumbers(1,1);
	
	if (($article_board[0]['img'] <> '') && ($t>0)) {

$image_size 	= GetImageSize($path['IMAGE'].$article_board[0]['img']);

				$image_width 	= $image_size[0];
				$image_height	= $image_size[1];
				$image_x	= (600-$image_width)/2;
				$image_y	= (850-$image_height)/2;
				$text_size	= $pdf->getTextWidth(10,$article_board[0]['img_comment']);

				$pdf->ezNewPage();
				$pdf->filledRectangle(($image_x-2),($image_y-2),$image_width+4,$image_height+4);
				$pdf->addJpegFromFile($path['IMAGE'].$article_board[0]['img'],$image_x,$image_y,$image_width,$image_height);
				$pdf->AddText((600-$text_size)/2,$image_y-20,10,$article_board[0]['img_comment']);
				$pdf->AddText((600-$copyright_size)/2,10,8,$article_copyright);
	}

$pdf->ezStream(); 

?>
Last edited by Percu.org on Wed Jan 08, 2003 10:39 am, edited 1 time in total.

mitsubishi
Registered User
Posts: 527
Joined: Fri Aug 31, 2001 6:25 am
Location: UK
Contact:

Post by mitsubishi » Wed Jan 08, 2003 10:36 am

Interesting, um I was going to definately say no to PDF after I realised it's licence. But this class is interesting, if bulky. After considering the needed options, I think PDF isn't a good idea for this anyway, but once the rest is done, then it would only take a small mod to add it after.

BTW what's with all the HTML entities all over you're post?

Percu.org
Registered User
Posts: 88
Joined: Sun Apr 28, 2002 2:54 pm
Location: Valence (France)
Contact:

Post by Percu.org » Wed Jan 08, 2003 10:41 am

mitsubishi wrote: Interesting, um I was going to definately say no to PDF after I realised it's licence. But this class is interesting, if bulky. After considering the needed options, I think PDF isn't a good idea for this anyway, but once the rest is done, then it would only take a small mod to add it after.

BTW what's with all the HTML entities all over you're post?


i don't knwo why the parser transform " < " in & and " > " in &

User avatar
morpheus2matrix
Former Team Member
Posts: 9171
Joined: Wed Apr 10, 2002 7:31 pm
Location: France
Contact:

Post by morpheus2matrix » Wed Jan 08, 2003 10:49 am

Percu.org wrote: i don't knwo why the parser transform " < " in & and " > " in &



it appear to be du to phpBB 2.0.4 :?
Former phpBB MOD-Team Member -

Forgive my bad English :(

No support by PM/Email - Thanks - You can thanks me here :) - Pay me for installing MOD's :lol:

water
Registered User
Posts: 170
Joined: Sun Oct 21, 2001 11:15 am

Post by water » Thu Jan 09, 2003 3:42 pm

printable forumview, with an option to print the page your on or the whole forum, would be great

:water
Image

User avatar
LaZeR
Registered User
Posts: 671
Joined: Sat Jun 29, 2002 8:38 pm
Contact:

Post by LaZeR » Thu Jan 09, 2003 3:46 pm

Percu.org wrote: ...

here is the code for pdf.php but you will need to know how works FetchMod and attach mod to retrieve both texte and attachment...

Code: Select all

&?PHP
EDIT (snip.....)


As mentioned in this thread, there appears to be a bug in this forum currently which is wrongly parsing html within the function. Just replace the tag with the
to show your code.

Percu.org
Registered User
Posts: 88
Joined: Sun Apr 28, 2002 2:54 pm
Location: Valence (France)
Contact:

Post by Percu.org » Fri Jan 10, 2003 8:49 pm

LaZeR wrote: As mentioned in this thread, there appears to be a bug in this forum currently which is wrongly parsing html within the function. Just replace the tag with the
to show your code.


hum... could you explain me again your tip, as i ve'nt been able to understand yr previous post

my english is not as good as i wish it to be

User avatar
LaZeR
Registered User
Posts: 671
Joined: Sat Jun 29, 2002 8:38 pm
Contact:

Post by LaZeR » Fri Jan 10, 2003 9:22 pm

Percu.org wrote: hum... could you explain me again your tip, as i ve'nt been able to understand yr previous post

my english is not as good as i wish it to be


The Tag in this forum is producing in-accurate replication of code so be extremely careful when trying to copy any mods from here (Phpbb) until someone fixes this! I have tried feverishly to bring this to the attention of several people here so something can be done ASAP or atleast an announcement made to warn everyone.

Example:

Code: Select all

<a></a> bla bla bla
<a></a> bla bla bla


And many other html and php characters being incorrectly parsed and displayed wrongly! So if you copy your modifications as you normally would here from the representations, then you are in for big time problems as you won't be getting the correct characters, however, if the mod author posts his/her code with the
button, it appears to correctly parse and display the given code.

Hope this makes sense :wink:

Locked

Return to “[2.0.x] MODs in Development”