Create Offline (LAN) Ipaper Like Scribd

Tuesday, March 08, 2011

Oke beberapa hari yang lalu saya mencoba membuat script yang dapat menampilkan file pdf seperti scribd tapi offline, hmm sudah basi mungkin, yah buat coba2 sekalian belajar bolehkan :p.

Pertama2 perkakas yang dibutuhkan:

1. Flexpaper
2. pdf2swf tool
3. XAMPP

Oke lets the war begin,
- Untuk pertama extract file flexpaper yang telah anda download.
- Install swftools yng telah didownload, copy file pdf2swf.exe (berhubung saya menggunakan Win XP) ke dalam folder aplikasi. .:cool_sinchan@yahoo.com:.
- Buat direktori untuk menyimpan file hasil extract swf tadi
- Setelah itu buatlah file php dengan script sbb:




#code for pdf to swf using pdf2swf software
#this codeworks in windows environment.
## Important Parameters
$file=$_GET['file'];
$swf="file/".$file.".swf";
if(file_exists($swf)){
$pdf_path ="file/".$file;
$swf_output =$swf;
}else{
$software_path ="pdf2swf" ;
$pdf_path ="file/".$file;
$argument = "-o";
$swf_output =$swf ;
$cmd ="$software_path $pdf_path $argument $swf_output -qq";
//exit;
$result = system($cmd);
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("cmd /C $cmd ", 0, true);
}
//echo var_dump($result)." ".mktime();
//echo $result;
# 0 for command prompt invisible mode
# 3 for visible

?>
 - copy paste isi script di file FlexPaperViewer.html dari flexpaper dan taruh. dibawah script php tersebut diatas.
 - Ubah variabel file (preview.swf) menjadi :
    .
    ..
    ...
    var flashvars = {
    SwfFile : escape("<?php echo $swf;?>"),
    Scale : 0.6,
    ZoomTransition : "easeOut",

    ...
    ..
    .
 - Setelah itu simpan file tersebut dengan nama pdf2swf.php file.
 - Untuk mengeksekusi buat perintah sbb:
    http://localhost/myapppath/pdf2swf.php?file=my-pdf-file.pdf

Tadaaa
    

3 comments:

Agus Wijiyanto said...

muncul pesan
ERROR Couldn't open file/a.php
kesalahan saya dimana ya...??

Agus Wijiyanto said...

suksus bang....makasih atas infonya.
kalo di run di linux (ubuntu) gimana ya..??

Anonymous said...

@icuslab kesalahan di nama filenya mungkin?

Post a Comment