Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: FaSan on May 13, 2005, 05:10:06 PM

Title: See PDF in Posts
Post by: FaSan on May 13, 2005, 05:10:06 PM
Little Tips ;)



<search>
// Match a table... hopefully with everything in the right place.
'~\[table\](?:\s|\xA0|<br />|&nbsp;)*((?:\[tr\](?:\s|\xA0|<br />|&nbsp;)*\[td\]).*?(?:(?:\s|\xA0|<br />|&nbsp;)*\[/td\]\[/tr\])*)(?:\s|\xA0|<br />|&nbsp;)*\[/table\](?:\s|\xA0|<br />|&nbsp;)?~i' => '<table>$1</table>',
</search>


<add after>
// PDF [pdf]example.pdf[/pdf]
'~\[pdf\](?:<br />)*([^<>]+?)(?:<br />)*\[/pdf\]~i' => isset($disabled['pdf']) ? 'PDF: $1' : '<object type="application/pdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" data="$1" width="500" height="400"><param name="src" value="$1"><a href="$1" target="_blank">$1</a></object>',
</add after>



Use with tag [pdf]example.pdf[/pdf]


It's work if you have in your browser the appropriate plugin (adobe acrobat o similar)


FaSan
Title: Re: See PDF in Posts
Post by: xenovanis on May 13, 2005, 05:16:09 PM
Thank you, very usefull!

I 'read' the Italian post, it's supposed to be added in Subs.php?
Title: Re: See PDF in Posts
Post by: FaSan on May 13, 2005, 05:17:58 PM
Yes  ! Excuse Me :)


On file Sub.php  ;)
Title: Re: See PDF in Posts
Post by: Elmacik on September 02, 2005, 11:52:40 AM
anyone to make it work for smf 1.1 beta 3 ?
i couldnt find the given strings in Subs.php
Title: Re: See PDF in Posts
Post by: [Unknown] on September 03, 2005, 03:57:40 AM
Before this:

array(
'tag' => 'pre',
'before' => '<pre>',
'after' => '</pre>',
),


Add:

array(
'tag' => 'pdf',
'type' => 'unparsed_content',
'content' => '<object type="application/pdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" data="$1" width="500" height="400"><param name="src" value="$1" /><a href="$1" target="_blank">$1</a></object>',
'disabled_content' => '<div>PDF: $1</div>',
'block_level' => true,
),


Then, in Subs-Post.php (this may be Beta 4 and after, though...) find:

// [flash]http://...[/flash]
array(
'tag' => 'flash',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
'hasExtra' => true,
),


Add after:

// [pdf]http://...[/pdf]
array(
'tag' => 'pdf',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
),


-[Unknown]
Title: Re: See PDF in Posts
Post by: Elmacik on September 03, 2005, 09:47:38 AM
thanks [unknown] but it give parse error :(

Parse error: parse error, unexpected ',' in /home/elmacik/public_html/forum/Sources/Subs-Post.php on line 303
Title: Re: See PDF in Posts
Post by: [Unknown] on September 03, 2005, 06:40:33 PM
Quote from: elmacik on September 03, 2005, 09:47:38 AM
thanks [unknown] but it give parse error :(

Parse error: parse error, unexpected ',' in /home/elmacik/public_html/forum/Sources/Subs-Post.php on line 303

Can you post 5 lines above and below your change to that file?

-[Unknown]
Title: Re: See PDF in Posts
Post by: Elmacik on September 04, 2005, 05:06:48 PM
here are the lines above, lines themselves, lines below;


// [flash]http://...[/flash]
array('tag' => 'flash', 'protocol' => 'http', 'embeddedUrl' => false, 'hasEqualSign' => false, 'hasExtra' => true)
);
// [pdf]http://...[/pdf]
array(
'tag' => 'pdf',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
),

// Fix each type of tag.
Title: Re: See PDF in Posts
Post by: dtm.exe on September 04, 2005, 05:26:45 PM
Quote from: elmacik on September 04, 2005, 05:06:48 PM
here are the lines above, lines themselves, lines below;


// [flash]http://...[/flash]
array('tag' => 'flash', 'protocol' => 'http', 'embeddedUrl' => false, 'hasEqualSign' => false, 'hasExtra' => true)
);
// [pdf]http://...[/pdf]
array(
'tag' => 'pdf',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
),

// Fix each type of tag.


Should that last comma not be a semicolon?
Title: Re: See PDF in Posts
Post by: Joshua Dickerson on September 04, 2005, 05:45:38 PM
That semicolon should be a comma
Title: Re: See PDF in Posts
Post by: [Unknown] on September 04, 2005, 05:51:15 PM
Don't add the code in Subs-Post.php.  As I described, it doesn't apply to your version.

-[Unknown]
Title: Re: See PDF in Posts
Post by: Elmacik on September 04, 2005, 05:58:57 PM
Quote from: OIDanTheManIO on September 04, 2005, 05:45:38 PM
Should that last comma not be a semicolon?

no, as i tried replacing the semicolong that is placed at the end of [flash] and i put a semicolon instead of the comma in the codes that [unknown] gave. its no use.
Quote from: groundup on September 04, 2005, 05:45:38 PM
That semicolon should be a comma

i tried but not to make [unknown] say "you havent done like i said" i just didnt post it.

Quote from: [Unknown] on September 04, 2005, 05:51:15 PM
Don't add the code in Subs-Post.php.  As I described, it doesn't apply to your version.

-[Unknown]

please look above, i asked for 1.1 beta 3, you gave the codes and now you say "it doesnt apply to your version" not weird in your opinion too? :)
Title: Re: See PDF in Posts
Post by: [Unknown] on September 04, 2005, 06:00:33 PM
Quote from: [Unknown] on September 03, 2005, 03:57:40 AM
Then, in Subs-Post.php (this may be Beta 4 and after, though...) find:

As I said.

It will still work, just don't make that change.

-[Unknown]
Title: Re: See PDF in Posts
Post by: Elmacik on September 04, 2005, 06:02:49 PM
which change?
you mean even if i DONT put the codes (i dont use anywhere..) still pdf will work?

how can it if there isnt a [pdf] description tag in subs-post.php?
i couldnt get the point can you please clarify?
Title: Re: See PDF in Posts
Post by: Joshua Dickerson on September 04, 2005, 06:04:09 PM
Looking at my copy of beta 3 / 4 ...
// [ftp=ftp://...]name[/ftp]
array(
'tag' => 'ftp',
'protocols' => array('ftp', 'ftps'),
'embeddedUrl' => true,
'hasEqualSign' => true,
),
// [flash]http://...[/flash]
array(
'tag' => 'flash',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
'hasExtra' => true,
),
// [pdf]http://...[/pdf]
array(
'tag' => 'pdf',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
),
);


You should probably grab a new copy or maybe it is only for Beta 4.
Title: Re: See PDF in Posts
Post by: Elmacik on September 04, 2005, 06:06:04 PM
you mean [pdf] [/pdf] tags are already included in beta 3? so why are the codes given when i asked for 1.1 beta 3 ???

your codes are beta 4 i think and public dont have it.
Title: Re: See PDF in Posts
Post by: [Unknown] on September 04, 2005, 06:11:33 PM
No.  As I said, you make the change to Subs.php, but not the change to Subs-Post.php.  That's all you need to do.  That is what I said.

-[Unknown]
Title: Re: See PDF in Posts
Post by: Elmacik on September 04, 2005, 06:28:32 PM
i made the change in subs.php and didnt touch subs.post.php
now it shows the exact words i typed. while posting, i write  [pdf]http://something/something.pdf[/pdf]

it shows what i type just like;  [pdf]http://something/something.pdf[/pdf]

if there is no need, why did you sent that codes for subs.post.php .. ? sorry for my dumbness but couldnt still understand.
Title: Re: See PDF in Posts
Post by: ivo2296 on May 12, 2006, 10:24:34 PM
Would be if someone let me know how to make this work for smf 1.0.7 and 1.0.5.


Thanks!
Title: Re: See PDF in Posts
Post by: ivo2296 on August 04, 2007, 12:12:18 PM
Any chance for smf1.1.3 ?


Thanks!
Title: Re: See PDF in Posts
Post by: weightman on August 08, 2007, 06:04:41 PM
This would be a totally awesome feature. The ability to embed and then print pdfs would be huge for my community.
Title: Re: See PDF in Posts
Post by: Mick. on November 21, 2007, 04:33:41 PM
Any chances to make this work for 1.1.4?  Anyone?
Title: Re: See PDF in Posts
Post by: IchBin™ on December 09, 2007, 11:42:25 PM
Perhaps you should post in the request board for someone to make a mod for it.
Title: Re: See PDF in Posts
Post by: Mick. on December 10, 2007, 09:34:24 PM
Quote from: IchBin™ on December 09, 2007, 11:42:25 PM
Perhaps you should post in the request board for someone to make a mod for it.

Thanx Ich.
Title: Re: See PDF in Posts
Post by: ディン1031 on December 11, 2007, 07:47:43 AM
In $sourcedir/Subs.php change follow things
<search>
array(
'tag' => 'pre',
'before' => '<pre>',
'after' => '</pre>',
),
</search>

<add before>
// PDF [pdf]example.pdf[/pdf]
array(
'tag' => 'pdf',
'type' => 'unparsed_content',
'content' => ($context['browser']['is_ie'] && !$context['browser']['is_mac_ie'] ? '<object type="application/pdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" data="$1" width="500" height="400"><param name="src" value="$1"><embed src="$1" width="500" height="400" /><noembed><a href="$1" target="_blank">$1</a></noembed></object>' : '<embed type="application/pdf" src="$1" width="500" height="400" /><noembed><a href="$1" target="_blank">$1</a></noembed>'),
'validate' => create_function('&$tag, &$data, $disabled', '
if (isset($disabled[\'url\']))
$tag[\'content\'] = \'$1\';'),
'disabled_content' => '<a href="$1" target="_blank">$1</a>',
),
</add before>


Normal this should work in SMF 1.1.x but it's untested and i think it will not work in each browser...

Bye
DIN1031
Title: Re: See PDF in Posts
Post by: weightman on December 11, 2007, 11:08:07 AM
I'll test it out and post back later.

Thanks.
Title: Re: See PDF in Posts
Post by: falguni1 on December 21, 2007, 03:19:09 AM
is this mod available.
Title: Re: See PDF in Posts
Post by: Fiery on January 11, 2008, 01:13:10 AM
Quote from: falguni1 on December 21, 2007, 03:19:09 AM
is this mod available.

Have you tried searching or trying the suggestions above? ;)
Title: Re: See PDF in Posts
Post by: Paracelsus on January 16, 2008, 07:08:56 AM
I was searching for something similar but don't know if it's possible with SMF and PHP...

... something that looks like that new Leopard feature for PDF's, the Quick Look, which allows to see a "preview" of the PDF without actually opening it:
(http://macworld.idg.se/polopoly_fs/1.128327!imageManager/399578767.png)

Does anybody know of something similar to this?
Title: Re: See PDF in Posts
Post by: Mick. on January 20, 2008, 12:42:08 PM
I used reply #24 and it works on IE but havent tested it on other browsers. Also changed the viewing size to 800x600.

All we need now is a standard button in the post window for a pdf tag.

Demo: http://www.chevyavalancheclub.com/index.php?topic=2191.0

Ok on FF & IE
Title: Re: See PDF in Posts
Post by: ディン1031 on January 20, 2008, 04:52:19 PM
Quote from: BlueDevil on January 20, 2008, 12:42:08 PM
I used reply #24 and it works on IE but havent tested it on other browsers. Also changed the viewing size to 750x500.

All we need now is a standard button in the post window for a pdf tag.

Demo:

http://www.midwestavalancheclub.com/suggestions-and-feedback/test-t2057/new/

Confirmed....it doesnt work on FireFox.
Firefox deppend on the settings, in my version it work.

Bye
DIN1031
Title: Re: See PDF in Posts
Post by: Mick. on January 20, 2008, 05:03:26 PM
Yeah...i just found that out.

One members claims to see it just fine with Firefox but another member using Firefox cant.

I would think  he uses an older version of Firefox?
Title: Re: See PDF in Posts
Post by: Fiery on January 20, 2008, 06:35:20 PM
Quote from: BlueDevil on January 20, 2008, 05:03:26 PM
Yeah...i just found that out.

One members claims to see it just fine with Firefox but another member using Firefox cant.

I would think  he uses an older version of Firefox?

He very well could be using an older version of FF.  Can you check?
Title: Re: See PDF in Posts
Post by: Mick. on January 20, 2008, 06:55:28 PM
Firefox version 2.0.0.11

Can you confirm if this is old? 


....I think he needs to update his acrobat reader.
Title: Re: See PDF in Posts
Post by: Fiery on January 20, 2008, 07:59:18 PM
That is the most recent stable version of FF, you could have him try to upgrade his reader.

Does anyone else have the same problems?
Title: Re: See PDF in Posts
Post by: ディン1031 on January 21, 2008, 02:46:19 AM
First question is did he install the Acrobat Reader and did he enable the plugin for it in the firefox? :)

Bye
DIN1031
Title: Re: See PDF in Posts
Post by: Sarge on February 04, 2008, 07:16:17 AM
Quote from: ディン1031 on January 21, 2008, 02:46:19 AM
First question is did he install the Acrobat Reader and did he enable the plugin for it in the firefox? :)
Title: Re: See PDF in Posts
Post by: ディン1031 on February 04, 2008, 08:12:42 AM
Quote from: Sarge on February 04, 2008, 07:16:17 AM
Quote from: ディン1031 on January 21, 2008, 02:46:19 AM
First question is did he install the Acrobat Reader and did he enable the plugin for it in the firefox? :)
Do i need to understand this ???
Title: Re: See PDF in Posts
Post by: Sarge on February 04, 2008, 08:25:51 AM
No, I'm simply reasking BlueDevil :)
Title: Re: See PDF in Posts
Post by: dannbass on February 23, 2008, 11:13:08 PM
I've been working with the idea of that groups can have the permission to show or post pdfs, and I'm working on a mod, but I need a little help here, so far I've done everything I can, and I'm doing the mod based on one of the spoilers that have permissions, so far everything in the manage permissions is showing, the checkboxes, the $txt, but not working...

Could someone look and see what I'm missing or should I change? Please...

<file name="$sourcedir/Subs.php">
<operation>
<search>
array(
'tag' => 'pre',
'before' => '<pre>',
'after' => '</pre>',
),
</search>

<add before>
// PDF [pdf]example.pdf[/pdf]
array(
'tag' => 'pdf',
'type' => 'unparsed_content',
'content' => ($context['browser']['is_ie'] && !$context['browser']['is_mac_ie'] ? '<object type="application/pdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" data="$1" width="500" height="400"><param name="src" value="$1"><embed src="$1" width="500" height="400" /><noembed><a href="$1" target="_blank">$1</a></noembed></object>' : '<embed type="application/pdf" src="$1" width="500" height="400" /><noembed><a href="$1" target="_blank">$1</a></noembed>'),
'validate' => create_function('&$tag, &$data, $disabled', '
if (isset($disabled[\'url\']))
$tag[\'content\'] = \'$1\';'),
'disabled_content' => '<a href="$1" target="_blank">$1</a>',
),
</add before>
</operation>
</file>

<file name="$boarddir/Themes/default/languages/ManagePermissions.english.php">
<operation>
<search position="before"><![CDATA[
$txt['permissiongroup_general'] = 'General';
$txt['permissionname_view_stats'] = 'View forum statistics';
]]></search>
<add><![CDATA[
$txt['permissionname_pdf_show'] = 'Show PDFs';
$txt['permissionhelp_pdf_show'] = 'Allow the user to show pdfs included in posts';
$txt['permissionname_pdf_post'] = 'Post PDFs';
$txt['permissionhelp_pdf_post'] = 'Allow the user to post new PDFs';
]]></add>
</operation>
</file>

<file name="$boarddir/Themes/default/languages/Errors.english.php">
<operation>
<search position="before"><![CDATA[
// Version: 1.1.2; Errors
]]></search>
<add><![CDATA[
$txt['cannot_pdf_post'] = 'Sorry - you don\'t have the proper permissions to post pdfs.';
]]></add>
</operation>
</file>

<file name="$sourcedir/ManagePermissions.php">
<operation>
<search position="before"><![CDATA[
'modify_replies' => false,
'delete_replies' => false,
'announce_topic' => false,]]></search>
<add><![CDATA[
'pdf_show' => false,
'pdf_post' => false,]]></add>
</operation>
</file>



<file name="$sourcedir/Post.php">
<operation>
<search position="before"><![CDATA[
// Remove any nested quotes, if necessary.
if (!empty($modSettings['removeNestedQuotes']))
$form_message = preg_replace(array('~\n?\[quote.*?\].+?\[/quote\]\n?~is', '~^\n~', '~\[/quote\]~'), '', $form_message);
]]></search>
<add><![CDATA[
// remove pdfs if not allowed to see them or post them
if(!allowedTo('pdf_show') || !allowedTo('pdf_post'))
$form_message = preg_replace(array('~\n?\[pdf.*?\].+?\[/pdf\]\n?~is', '~^\n~', '~\[/pdf\]~'), '', $form_message);
]]></add>
</operation>
</file>

<file name="$sourcedir/Subs-Post.php">
<operation>
<search position="after"><![CDATA[
// Limit the size of images posted?
if (!empty($modSettings['max_image_width']) || !empty($modSettings['max_image_height']))
{
]]></search>
<add><![CDATA[
// Are we allowed to post pdfs?
if(preg_match('~\[pdf\](.+?)\[/pdf\]~ise',$message))
isAllowedTo('pdf_post');
]]></add>
</operation>
</file>


Thanks :D
Title: Re: See PDF in Posts
Post by: BHashman on March 19, 2008, 12:33:00 PM
this works in 1.1.4 just fine

in the subs.php file you need to place what [unknown] has listed above
and here is mine:
// PDF [pdf]example.pdf[/pdf]
array(
'tag' => 'pdf',
'type' => 'unparsed_content',
'content' => '<object type="application/pdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" data="$1" width="640" height="480"><param name="src" value="$1" /><a href="$1" target="_blank">$1</a></object>',
'disabled_content' => '<div>PDF: $1</div>',
'block_level' => true,
),
// DWF [dwf]example.dwf[/dwf]
array(
'tag' => 'dwf',
'type' => 'unparsed_content',
'content' => '<object type="application/dwf" classid="clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF" data="$1" width="640" height="480"><param name="src" value="$1" /><a href="$1" target="_blank">$1</a></object>',
'disabled_content' => '<div>PDF: $1</div>',
'block_level' => true,
),



I did declare the bbcode type [pdf] in the Subs-Post.php file but I did not declare the [dwf] tag.  Thus the declaration in the Subs-Post.php file is not necessary, as [unknown] had already mentioned above.

Please note that also included is the class id to embed a autodesk autocad DWF file.  This is a great tool if you are using drawings and need to zoom around them right in your page.
Also you can edit and create DWF files for free and it's embedded in ms Vista.
download stuff here:
http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=8824283

next - I would like to see a pop up window - like the web page previewers out there - to show the thumbnail of a DWF or PDF file that is an attachment.

more later...
Title: Re: See PDF in Posts
Post by: Nibogo on April 03, 2008, 09:45:54 PM
someone have images of this trick???
Title: Re: See PDF in Posts
Post by: samvirtual on April 24, 2008, 06:49:12 PM
awesome! works like a charm. tried on smf 1.14
Title: Re: See PDF in Posts
Post by: chinaren on December 02, 2008, 08:53:45 PM
Wow, this really works well!   Good one!  Thank-you.

(Works on my heavily modded 1.1.7 forum btw).
Title: Re: See PDF in Posts
Post by: Mick. on December 02, 2008, 08:58:12 PM
Quote from: chinaren on December 02, 2008, 08:53:45 PM
Wow, this really works well!   Good one!  Thank-you.

(Works on my heavily modded 1.1.7 forum btw).

Yes indeed...

http://www.chevyavalancheclub.com/index.php?topic=2191.0
Title: Re: See PDF in Posts
Post by: kizer on December 03, 2008, 02:46:28 PM
Wow that is sick to see that embeded like that. Man thats something I can tinker with myself.
Title: Re: See PDF in Posts
Post by: kizer on December 03, 2008, 02:59:54 PM
Wow, I just sent myself a PDF embeded in a PM and it worked perfectly. Man I can't tell you how many times I had to Link a PDF to somebody now I can just embed and call it done. If I could only figure out how to mask the URL in the source when somebody views it I would be in hog heaven.
Title: Re: See PDF in Posts
Post by: kizer on December 03, 2008, 07:07:09 PM
Seems to work perfectly in Internet Explorer is there a way to get Firefox to work?
Title: Re: See PDF in Posts
Post by: IchBin™ on December 03, 2008, 07:26:25 PM
Works in firefox for me.
Title: Re: See PDF in Posts
Post by: Mick. on December 03, 2008, 08:02:36 PM
Quote from: kizer on December 03, 2008, 07:07:09 PM
Seems to work perfectly in Internet Explorer is there a way to get Firefox to work?

I use firefox and it works just as good on IE.

Upgrade your FF.
Title: Re: See PDF in Posts
Post by: kizer on December 04, 2008, 02:15:47 AM
Ok, when I use post #40 it works in Internet Explorer only

When I use post #24 I get an operation not allowed and it crashes Firefox on my forum and on BlueDevils

I'm using Firefox 3.04

I made sure the plugin was enabled and when it is it crashes
Options > Applications I have Adobe set to Adobe reader
Title: Re: See PDF in Posts
Post by: kizer on December 04, 2008, 02:42:34 AM
Ok, bizarre enough I had to update from Adobe 7.0 to 9.0 and it works just fine. Who would of thought.

Works with 9.0 installed, but crashes my browser with 7.0
Title: Re: See PDF in Posts
Post by: Smoky "Rider" Blue on December 26, 2008, 09:34:05 PM
anyway of hiding the url to the pdf ?? that would help out a lot of people..

/me crosses her fingers..  ;)
Title: Re: See PDF in Posts
Post by: leoist on January 03, 2009, 04:14:32 AM
Hello everybody,
I am really new user so sorry to ask some silly questions:(
Where should I write or paste those codes given above?
I don't know the logic of the forum how does it work etc? somebody built the forum for me but now i have to handle everything.
thank you so much for your patience.
Title: Re: See PDF in Posts
Post by: Smoky "Rider" Blue on January 03, 2009, 05:27:59 AM
best thing to do is to start at the doc's and read:

http://docs.simplemachines.org/

good luck leoist!!

and bump with my question.. anyway to hide the url??  ;)
Title: Re: See PDF in Posts
Post by: Kermit on January 03, 2009, 05:30:05 AM
Quote from: leoist on January 03, 2009, 04:14:32 AM
Hello everybody,
I am really new user so sorry to ask some silly questions:(
Where should I write or paste those codes given above?
I don't know the logic of the forum how does it work etc? somebody built the forum for me but now i have to handle everything.
thank you so much for your patience.


You can install that here

http://custom.simplemachines.org/mods/index.php?mod=1468

Code changes will be automatically done  ;)
Title: Re: See PDF in Posts
Post by: Smoky "Rider" Blue on January 03, 2009, 05:38:26 AM
but if you have a custom theme you must apply the edits to it as well..

where you download the mod, there is a drop down box that tells you what to edit and where..  ;)

now Duncan, how can i hide the url for this mod?? i really dont want it to be easily seen..
Title: Re: See PDF in Posts
Post by: Kermit on January 03, 2009, 05:51:31 AM
Sources/Subs.php

Code (find) Select

// PDF [pdf]example.pdf[/pdf]
         array(
            'tag' => 'pdf',
            'type' => 'unparsed_content',
            'content' => ($context['browser']['is_ie'] && !$context['browser']['is_mac_ie'] ? '<object type="application/pdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" data="$1" width="800" height="600"><param name="src" value="$1"><embed src="$1" width="500" height="400" /><noembed><a href="$1" target="_blank">$1</a></noembed></object>' : '<embed type="application/pdf" src="$1" width="500" height="400" /><noembed><a href="$1" target="_blank">$1</a></noembed>'),
            'validate' => create_function('&$tag, &$data, $disabled', '
               if (isset($disabled[\'url\']))
                  $tag[\'content\'] = \'$1\';'),
            'disabled_content' => '<a href="$1" target="_blank">$1</a>',
         ),


Code (replace with) Select

// PDF [pdf]example.pdf[/pdf]
         array(
            'tag' => 'pdf',
            'type' => 'unparsed_content',
            'content' => $user_info['is_guest'] ? ' You should <a href="' . $scripturl . '?action=register">register</a> or <a href="' . $scripturl . '?action=login">login</a> to see PDF files' : (($context['browser']['is_ie'] && !$context['browser']['is_mac_ie'] ? '<object type="application/pdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" data="$1" width="800" height="600"><param name="src" value="$1"><embed src="$1" width="500" height="400" /><noembed><a href="$1" target="_blank">$1</a></noembed></object>' : '<embed type="application/pdf" src="$1" width="500" height="400" /><noembed><a href="$1" target="_blank">$1</a></noembed>')),
            'validate' => create_function('&$tag, &$data, $disabled', '
               if (isset($disabled[\'url\']))
                  $tag[\'content\'] = \'$1\';'),
            'disabled_content' => '<a href="$1" target="_blank">$1</a>',
         ),
Title: Re: See PDF in Posts
Post by: Smoky "Rider" Blue on January 03, 2009, 06:16:23 AM
thanks Duncan, i gota feeling im going to love the mod..  ;)
Title: Re: See PDF in Posts
Post by: Kermit on January 03, 2009, 06:27:23 AM
Your welcome,glad to see that you like the mod  :)
Title: Re: See PDF in Posts
Post by: Smoky "Rider" Blue on January 03, 2009, 06:36:45 AM
might just help display my 1gig+ pdf collection..

lol..  :P
Title: Re: See PDF in Posts
Post by: bulutcini on January 09, 2009, 02:10:52 AM
Thank you so much it's very useful especially for me...
Title: Re: See PDF in Posts
Post by: Smoky "Rider" Blue on January 09, 2009, 03:21:26 PM
when i can get some time, will set up a permenant link for anyone to view from my site..

thanks again Duncan85 ;)
Title: Re: See PDF in Posts
Post by: adp on February 12, 2009, 11:27:32 AM
works on rc1?
Title: Re: See PDF in Posts
Post by: IchBin™ on February 12, 2009, 12:10:03 PM
You try it? Tell us if it works. :)
Title: Re: See PDF in Posts
Post by: Kermit on February 12, 2009, 12:17:11 PM
Quote from: adp on February 12, 2009, 11:27:32 AM
works on rc1?

Yep,this mod works with RC1 as well

http://custom.simplemachines.org/mods/index.php?mod=1468
Title: Re: See PDF in Posts
Post by: Joshua Dickerson on September 25, 2009, 02:27:32 PM
http://custom.simplemachines.org/mods/index.php?mod=1468 move to Now Available board please.
Title: Re: See PDF in Posts
Post by: GongShow on March 08, 2010, 07:52:41 PM
Any chance of getting this updated to work on SMF 2.0 RC2?
Title: Re: See PDF in Posts
Post by: Tryskoski on April 12, 2010, 11:26:15 AM
Anybody get this working on RC3 yet?
Title: Re: See PDF in Posts
Post by: gbsothere on April 12, 2010, 02:47:51 PM
Why is it that when I click on the very first page of this thread, I get this:

See Here (http://whereitestmystuff.com/images/auth.jpg)


Authentication required (and by the thread starter)?  Why is that showing up here at SMF?

:-\
Title: Re: See PDF in Posts
Post by: Arantor on April 13, 2010, 05:34:30 AM
Because the avatar of the thread starter is behind a site that requires login. Admins should fix that, I think.

Getting it to work in RC3 probably isn't that hard, but I don't think I'd do it like that if it were me. Then again I don't really like the idea of embedding PDF into the page given the amount of Acrobat vulns doing the rounds at the moment.
Title: Re: See PDF in Posts
Post by: Mig-32 on November 05, 2010, 12:58:29 PM
For the 2.0 RC4

Follow the instrutions here: http://custom.simplemachines.org/mods/index.php?mod=1468
and then select the Manual Install Instructions for SMF 2.0 RC4 on the rigth side and the hit "Parse"

Do all of the instrutions there,

BUT!!! On the "./Sources/Subs-Editor.php" don't do that!!

On the "./Sources/Subs-Editor.php" You must do this exacly:

Find this:
'description' => $txt['image']

And add this after:
             'pdf' => array(
'image' => 'pdf',
'code' => 'pdf', 'before' => '[pdf]', 'after' => '[/pdf]', 'description' => $txt['pdf']),



Cheers!
Title: Re: See PDF in Posts
Post by: dematrix2571 on December 12, 2010, 04:58:36 PM
Is there a way to widen the screen.. See my link at  www.ccdsg.com/index.php?topic=9.0.

I want to expand or widen from left to right... any ideas?  Or is this an ID from adobe?
Title: Re: See PDF in Posts
Post by: Illori on December 13, 2010, 08:45:34 AM
that is a wordpress install, you will not get support here for that.
Title: Re: See PDF in Posts
Post by: outofstate on December 21, 2010, 12:16:00 PM
Quote from: Illori on December 13, 2010, 08:45:34 AM
that is a wordpress install, you will not get support here for that.


any support for the same question on SMF forum?

(http://www.outofstate.us/redemption-theory/points/pdf.jpg)
Title: Re: See PDF in Posts
Post by: IchBin™ on December 21, 2010, 12:51:50 PM
If you look at the code you inserted, do you see the width and height settings in it?
Title: Re: See PDF in Posts
Post by: outofstate on December 21, 2010, 09:44:37 PM
Quote from: IchBin™ on December 21, 2010, 12:51:50 PM
If you look at the code you inserted, do you see the width and height settings in it?

[pdf][/pdf] is all that shows
Title: Re: See PDF in Posts
Post by: cor met snor on February 04, 2011, 05:30:33 AM
Great tool but a little problem

It works in Firefox and IE but NOT in Google-Chroom maybe somebody knows witch extension has to be downloaded so it also works in Chroom

Thanks
Title: Re: See PDF in Posts
Post by: cor met snor on February 04, 2011, 06:12:05 AM
Please help me

I got these errors in my errorlog

8: Undefined index: pdf
Bestand: /home/xxxxxx/public_html/forum2/Themes/default/languages/Post.dutch.php (main sub template - eval?)
Regel: 778

What is the course of this error and how can I correct this
Title: Re: See PDF in Posts
Post by: cor met snor on February 04, 2011, 01:21:51 PM
I found the course of the error
../Themes/default/languages/Modifications.dutch.php

I ad this and the problem was solved
$txt['pdf'] = 'Add PDF';

I found it in  ../Themes/default/languages/Modifications.english.php
Title: Re: See PDF in Posts
Post by: pingpongrob on March 09, 2011, 08:13:23 PM
I did the modifications as in the Parse code for 2.0 RC5 and now am unable to use my forum.
I get this error message

Fatal error: Call to undefined function call_integration_hook() in /home/affordab/public_html/smf/Sources/Load.php on line 307

I have even reversed the edits and I still cant get in - have no idea whats going on. Can anybody help.
Title: Re: See PDF in Posts
Post by: Arantor on March 09, 2011, 08:17:02 PM
call_integration_hook is a 2.0 RC4+ only function.
Title: Re: See PDF in Posts
Post by: pearpandas on March 31, 2011, 01:38:36 PM
I have to use this trick in work so thanks, you saved me a lot of time!
Title: Re: See PDF in Posts
Post by: esmus on July 12, 2011, 06:00:14 PM
Update the mod, please.
Title: Re: See PDF in Posts
Post by: Oldiesmann on July 13, 2011, 08:00:15 PM
Quote from: esmus on July 12, 2011, 06:00:14 PM
Update the mod, please.

If you follow the instructions here (http://www.simplemachines.org/community/index.php?topic=35851.msg2841022#msg2841022), it should work fine with 2.0 final.
Title: Re: See PDF in Posts
Post by: dooodle on July 28, 2011, 08:38:16 AM
Beloved friends,

Is there any setting to change the pdf size in the mod, the size  looks smaller in my forum...
Title: Re: See PDF in Posts
Post by: newage on September 22, 2012, 04:19:26 PM
Hi!
How can I stretch the embedded PDF to 1024 x 768?
Title: Re: See PDF in Posts
Post by: BlackAbbot on September 27, 2012, 06:09:51 AM
After a quick glance at the source for this mod I just went ahead and modified all widths and heights in ./Sources/Subs.php from their current values to 1024 and 768 respectively. This appears to have had the desired effect for me.
Title: Re: See PDF in Posts
Post by: newage on September 27, 2012, 09:41:11 AM
How can I modify it too?
Title: Re: See PDF in Posts
Post by: NanoSector on September 27, 2012, 10:37:12 AM
Quote from: newage on September 27, 2012, 09:41:11 AM
How can I modify it too?
Follow the instructions dude, unless you mean the previous post.
Title: Re: See PDF in Posts
Post by: newage on September 27, 2012, 01:45:33 PM
I did not get it but anyway...
Title: Re: See PDF in Posts
Post by: BlackAbbot on September 27, 2012, 07:31:08 PM
./Sources/Subs.php
Code (find) Select
// PDF [pdf]example.pdf[/pdf]
         array(
            'tag' => 'pdf',
            'type' => 'unparsed_content',
            'content' => ($context['browser']['is_ie'] && !$context['browser']['is_mac_ie'] ? '<object type="application/pdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" data="$1" width="800" height="600"><param name="src" value="$1"><embed src="$1" width="500" height="400" /><noembed><a href="$1" target="_blank">$1</a></noembed></object>' : '<embed type="application/pdf" src="$1" width="500" height="400" /><noembed><a href="$1" target="_blank">$1</a></noembed>'),
            'validate' => create_function('&$tag, &$data, $disabled', '
               if (isset($disabled[\'url\']))
                  $tag[\'content\'] = \'$1\';'),
            'disabled_content' => '<a href="$1" target="_blank">$1</a>',
         ),


Code (replace with) Select
// PDF [pdf]example.pdf[/pdf]
         array(
            'tag' => 'pdf',
            'type' => 'unparsed_content',
            'content' => ($context['browser']['is_ie'] && !$context['browser']['is_mac_ie'] ? '<object type="application/pdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" data="$1" width="1024" height="768"><param name="src" value="$1"><embed src="$1" width="1024" height="768" /><noembed><a href="$1" target="_blank">$1</a></noembed></object>' : '<embed type="application/pdf" src="$1" width="1024" height="768" /><noembed><a href="$1" target="_blank">$1</a></noembed>'),
            'validate' => create_function('&$tag, &$data, $disabled', '
               if (isset($disabled[\'url\']))
                  $tag[\'content\'] = \'$1\';'),
            'disabled_content' => '<a href="$1" target="_blank">$1</a>',
         ),
Title: Re: See PDF in Posts
Post by: JTVaughn on September 28, 2012, 04:44:36 PM
Is there a way to disable it on the iPad (perhaps display an error message that it's not compatible with iPads?). The iPad doesn't like files within frames, you can't scroll down.
Title: Re: See PDF in Posts
Post by: manusaktteva on October 08, 2012, 02:33:16 PM
I applied your code and find this is amazing.
after a long time you provide me exact code.
Title: Re: See PDF in Posts
Post by: punchy on October 14, 2012, 01:45:40 PM
Rather than going by the width and hiegh as shown i made mine like

Width =  100% and Height = 1000

With the width set at 100% you will get the PDF box go the full width of whatever size display your using

http://welderfab.co.uk/index.php/topic,10545.0.html

Enjoy  ;)
Title: Re: See PDF in Posts
Post by: humbleworld on November 13, 2012, 05:42:31 AM
I really want to use this MOD but it seems that this MOD is not compatible with SMF 2.0.2. Can anyone update this MOD, please? Thank you.
Title: Re: See PDF in Posts
Post by: winsoft on November 28, 2012, 04:20:47 PM
that should be ideal for me specially since i am sharing pdf files a lot in my forum :)
Title: Re: See PDF in Posts
Post by: karalahana on December 24, 2012, 03:30:41 PM
Google bot scan pdf or not? I mean article inside the Pdf file
Title: Re: See PDF in Posts
Post by: punchy on December 25, 2012, 04:48:52 AM
Quote from: humbleworld on November 13, 2012, 05:42:31 AM
I really want to use this MOD but it seems that this MOD is not compatible with SMF 2.0.2. Can anyone update this MOD, please? Thank you.

Should be, i'm using it with 2.0.3
Title: Re: See PDF in Posts
Post by: KTN on January 08, 2013, 11:28:01 PM
I don't understand the part , how to get the PDF to put it in the BBC code. From your computer or web site? How can I do that? I installed the mod and seem like working, but I don't know how can I embed a PDF file.
Title: Re: See PDF in Posts
Post by: Arantor on January 08, 2013, 11:33:18 PM
The PDF file must be online somewhere already, you just put the link to it inside the pdf tag.
Title: Re: See PDF in Posts
Post by: KTN on January 09, 2013, 12:14:22 AM
Can I upload my PDF file to a folder ( such as Attachment or Public html or somewhere ) and get a link and embed between PDF code? But when I try a few time and when member click the link,  it ask user name and password. I am missing some knowledge right? Please advise me how can I do it?
Title: Re: See PDF in Posts
Post by: KTN on January 10, 2013, 01:53:14 AM
I got it! Finally from youtube.

http://www.youtube.com/watch?v=NPveEjP00RE
Title: Re: See PDF in Posts
Post by: teos55 on January 16, 2013, 09:27:44 AM
A very nice mod indeed, but the first topic should clearly indicate ;

for sm1....      add this    replace this
for smf2..       add this    replace this

format ?


Other then that, it's puzzling to find the proper code within the topic to your version. 

It's just a tidying (maybe time consuming) process but helpfull to everybody, thanks in advance.

Title: Re: See PDF in Posts
Post by: Arantor on January 16, 2013, 09:33:21 AM
The format it is using is perfectly normal for 2005 back in the days when what was called boardmod format was how SMF modding worked.
Title: Re: See PDF in Posts
Post by: teos55 on January 16, 2013, 09:43:22 AM
It was just a recommendation for novice users with little php knowledge, Arantor.
Title: Re: See PDF in Posts
Post by: Arantor on January 16, 2013, 09:49:07 AM
Except it's *right* there...


<search>
// Match a table... hopefully with everything in the right place.
'~\[table\](?:\s|\xA0|<br />|&nbsp;)*((?:\[tr\](?:\s|\xA0|<br />|&nbsp;)*\[td\]).*?(?:(?:\s|\xA0|<br />|&nbsp;)*\[/td\]\[/tr\])*)(?:\s|\xA0|<br />|&nbsp;)*\[/table\](?:\s|\xA0|<br />|&nbsp;)?~i' => '<table>$1</table>',
</search>


<add after>
// PDF [pdf]example.pdf[/pdf]
'~\[pdf\](?:<br />)*([^<>]+?)(?:<br />)*\[/pdf\]~i' => isset($disabled['pdf']) ? 'PDF: $1' : '<object type="application/pdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" data="$1" width="500" height="400"><param name="src" value="$1"><a href="$1" target="_blank">$1</a></object>',
</add after>


That's what the post says. What more is needed? I see no reason why it shouldn't work without alterations in SMF 2.0, though it was for SMF pre 1.1.x... that part of the code has not significantly changed.

It has 'find this, after it add this'... isn't that what you wanted?
Title: Re: See PDF in Posts
Post by: teos55 on January 16, 2013, 09:58:50 AM
I thought,  V1 and V2 modifications are different after reading the whole topic, maybe it was my mistake/misunderstanding, sorry.
Title: Re: See PDF in Posts
Post by: Arantor on January 16, 2013, 10:00:12 AM
The only differences in the posted code are for putting an editor button in, which IS different across SMF versions.
Title: Re: See PDF in Posts
Post by: teos55 on January 16, 2013, 10:34:33 AM
Didnt check beforehand, (my fault) there is already a mod for this, by Kermit.

http://custom.simplemachines.org/mods/index.php?mod=1468

I used the mod,  and works on the fly.

please forget my recommendation, 2005 to 2013 still works, great ....

Thanks to all, participated.
Title: Re: See PDF in Posts
Post by: Shapewear on February 05, 2013, 05:19:06 AM
You can easily see Pdf in post. Within the Edit Post page, use the Add Media option (near the Add Image button) to upload pdf files.
Title: Re: See PDF in Posts
Post by: NanoSector on February 05, 2013, 01:37:21 PM
Quote from: Shapewear on February 05, 2013, 05:19:06 AM
You can easily see Pdf in post. Within the Edit Post page, use the Add Media option (near the Add Image button) to upload pdf files.
That button is not there by default :)
Title: Re: See PDF in Posts
Post by: miloaikido on May 28, 2013, 10:21:22 AM
how can we does not allow user to save that pdf in post
Title: Re: See PDF in Posts
Post by: dand on October 10, 2014, 05:09:06 AM
I just noticed that this mod doesn't work anymore in my SMF. It worked great for some time, but then I updated from 1.1.17 to 1.1.18 to 1.1.19. Now I am on latest 1.1.20 and it still doesn't work. (Tested in Firefox and IE).

Any help?
Title: Re: See PDF in Posts
Post by: ephman on October 20, 2014, 11:23:13 PM
Does it work? Any updates?
Title: Re: See PDF in Posts
Post by: margarett on October 21, 2014, 06:31:56 AM
Quote from: teos55 on January 16, 2013, 10:34:33 AM
http://custom.simplemachines.org/mods/index.php?mod=1468

Seems to work fine in 2.0.9.
Title: Re: See PDF in Posts
Post by: jarin001 on December 11, 2014, 07:18:41 AM
I must commend this great mod, I found another solution, and this is exactly what I need. I edited my only window size in Subs.php, default (500x400) unnecessarily small. Visitors forum quickly left the link to the PDF file, this mod is the correct solution. Thank you to the author.
Title: Re: See PDF in Posts
Post by: me_raul on June 02, 2016, 02:44:09 PM
Hello,

Is there a way to modify the code below (which put pdf tags) in order to have parse the bbcode only after a click action or a key pressed?
I mean having like:
[pdf]example.pdf[/pdf] and then when I do a click on the pdf link only then the tags to be parsed and the pdf content to be loaded.
I know is an old topic, but for me is a new question.

Quote from: BlackAbbot on September 27, 2012, 07:31:08 PM
./Sources/Subs.php
Code (find) Select
// PDF [pdf]example.pdf[/pdf]
         array(
            'tag' => 'pdf',
            'type' => 'unparsed_content',
            'content' => ($context['browser']['is_ie'] && !$context['browser']['is_mac_ie'] ? '<object type="application/pdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" data="$1" width="800" height="600"><param name="src" value="$1"><embed src="$1" width="500" height="400" /><noembed><a href="$1" target="_blank">$1</a></noembed></object>' : '<embed type="application/pdf" src="$1" width="500" height="400" /><noembed><a href="$1" target="_blank">$1</a></noembed>'),
            'validate' => create_function('&$tag, &$data, $disabled', '
               if (isset($disabled[\'url\']))
                  $tag[\'content\'] = \'$1\';'),
            'disabled_content' => '<a href="$1" target="_blank">$1</a>',
         ),



Title: Re: See PDF in Posts
Post by: ross003 on May 16, 2017, 03:38:17 AM
Why this code does not work for 1.1.3 version?
Title: Re: See PDF in Posts
Post by: Steve on May 16, 2017, 09:16:33 AM
Because it wasn't designed for it?

The better question is, why not upgrade to 2.0.14?
Title: Re: See PDF in Posts
Post by: punchy on May 07, 2020, 12:21:04 PM
Does anyone know the best way to show PDF's on their forum post I'm using 2.0.17 I installed PDF tag but not its working where it show show it is just blank ??