Flipbook from a PDF

This is where you share YOUR scripts with others

Moderators: macek, egami, gesf

liderbug
New php-forum User
New php-forum User
Posts: 20
Joined: Mon Feb 14, 2011 7:14 pm

Flipbook from a PDF

Postby liderbug » Mon Feb 14, 2011 7:38 pm

All on my Linux box: [ note: my pdf was ~80 pages ]
1) # pdftoppm book.pdf book
2) for every ppm file # ppmtojpeg <$n.ppm >$n.jpg

Eedit the following to match your "book[name]"
--------------------------------------------------------------------------------------------
<form action=index.php method=POST>
<style type="text/css">
.image { position:relative; float:left; }
.image .text { position:absolute; top:10px; left:10px; width:300px; }
table td { padding-right:0px; padding-left:0px; }
td { margin: 0; padding: 0; border-width: 0; }
.container { position: relative; height: 50px; }
.left-element { position: absolute; left: 0; width: 50%; }
.right-element { position: absolute; right: 0; width: 50%; text-align: right; }
.center-element { position: absolute; right: 0; width: 50%; text-align: center; }
</style>
// I need to css things more ...
<body bgcolor=#BBDDBB>
<table border=0 align=center bgcolor=#BBDDBB>
<tr><td>
<div class=container>
<div class="left-element"> <input type=submit name=submit value='< Prev'> </div>
<div class="right-element"> <input type=submit name=submit value='Next >'> </div>
</div>
<table border=0 align=center> <tr> <td>
<?php
$idx = array ("Additional Resources,69", "Analysis of a Section,67", <snip> "White Pine Weevil,22"); #book index
foreach ($idx as $i) {
$j = explode (",", $i);
echo "<a href=index.php?idxpg=$j[1]>*$j[0]</a><br>";
}
echo "</td>";
$page = $_POST["page"];
$submit = $_POST["submit"];
$idxpg = $_GET["idxpg"];
$page = ( $page < 0 ) ? 0 : $page;
if ( $idxpg != '' ) { $page = $idxpg+1; $submit = 'Next >'; }
if ( $page == '' ) { $page = 0; $submit = ''; }
if ( $page == 78 ) { $page = 0; $submit = ''; }
if ( $submit != '' ) {
$page = ( $submit == "Next >" ) ? $page + 1 : $page - 3;
echo "<embed src=pflip.wav hidden=true autostart=true></embed>";
}
if ( $page > 0 ) {
$img = sprintf("book-%02d.jpg", $page);
echo "<td><img src=$img width=500 border=1></td>\n";
}
echo "<td><img src=coil.jpg></td>\n";
if ( $page <78 ) {
$page++;
$img = sprintf("book-%02d.jpg", $page);
echo "<td><img src=$img width=500 border=1></td>\n";
}
echo "<input type=hidden name=page value=$page>";
?>
</td></tr></table>
<div class=container>
<div class="left-element"> <input type=submit name=submit value='< Prev'> </div>
<div class="right-element"> <input type=submit name=submit value='Next >'> </div>
</div>
</tr> </table> </form>
-------------------------------------------------------------
Gives 3 columns: narrow index on left, left page (in center, 500 wide) right page (500 wide)
Adjust other numbers to taste.

Chuck

merryflip
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Apr 16, 2013 10:59 pm
Contact:

Re: Flipbook from a PDF

Postby merryflip » Tue Apr 16, 2013 11:07 pm

well, the code is really very useful for creating flipbook from pdf files. thanks!

ailsa00123
New php-forum User
New php-forum User
Posts: 1
Joined: Wed Nov 13, 2013 12:22 am

Re: Flipbook from a PDF

Postby ailsa00123 » Wed Nov 13, 2013 12:26 am

Why not use some 3rd party software such as Kvisoft Flipbook Maker, it can help you create flipbook from PDF, as a no skill programmer, i think this is a useful way.

merryflip
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Apr 16, 2013 10:59 pm
Contact:

Re: Flipbook from a PDF

Postby merryflip » Mon Feb 24, 2014 10:32 pm

well, dear, as to your problem, I just try to use some tools that I‘ve found online, yet I finally choose to use such one simple yet great XFlip flipbook maker to convert pdf to flip book with rich multimedia contents with its user-friendly interface.


Return to “Your Scripts”

Who is online

Users browsing this forum: No registered users and 0 guests