Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 12-19-2011, 05:00 PM Merge PDF files
Novice Talker

Posts: 14
Trades: 0
Hello. I need script for merging PDF files from array. Example:

PHP Code:
$fileArray= array("name1.pdf","name2.pdf","name3.pdf","name4.pdf"); 
I want to merge it in one PDF file. Please help me. I need this as soon as posible. Bye.
Ivan96 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-19-2011, 05:56 PM Re: Merge PDF files
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
http://us3.php.net/manual/en/book.pdf.php

Quote:
Originally Posted by Ivan96 View Post
I need this as soon as posible. Bye.
I've never used the PDF extension in PHP so I'm not exactly sure how difficult it will be to merge PDFs, but if you need it as soon as possible I'm guessing you're better off trying to do it yourself as opposed to waiting for someone to do it for you.

In general the forum is here to help you do something, not do it for you.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 12-20-2011, 04:12 PM Re: Merge PDF files
Novice Talker

Posts: 14
Trades: 0
Hello. I tried something, but i need help now. This is code:

PHP Code:
$category "'".implode("', '",$_POST['category'])."'";
$sql2"SELECT * FROM product WHERE name IN ($category)";
        
$result2 mysql_query($sql2) or die(mysql_error());
        while (
$row2 mysql_fetch_assoc($result2)){
            
$fileArray = array($row2['pdf']);
            include 
'PDFMerger.php';

$pdf = new PDFMerger;

$pdf->addPDF($fileArray'all')
    ->
merge('download''files/TEST.pdf');

And, this is PDFMerger.php addPDF function:

PHP Code:
public function addPDF($filepath$pages 'all')
    {
            foreach (
$filepath as $file)
            {
                
$this->_files[] = array("../admin/".$file.""$pages);
            }
        return 
$this;
    } 
But, i get this error:
FPDF error: Cannot open ../admin/ !

Could you help me, please. Best regards, bye.
Ivan96 is offline
Reply With Quote
View Public Profile
 
Old 12-20-2011, 04:49 PM Re: Merge PDF files
Novice Talker

Posts: 14
Trades: 0
Hello. I made this script:

PHP Code:
$sql2"SELECT pdf FROM product WHERE name IN ($category)";
        
$result2 mysql_query($sql2) or die(mysql_error());
        
$row2 mysql_fetch_array($result2,MYSQL_NUM);
            
$file implode(" "$row2);
            
$output shell_exec('gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=docs_joined.pdf '.$file.''); 
It is smaller than previous, but, it is not working. I can't find docs_joined.pdf file. Please help me. Bye.
Ivan96 is offline
Reply With Quote
View Public Profile
 
Old 12-20-2011, 05:39 PM Re: Merge PDF files
Physicsguy's Avatar
404 - Title not found

Posts: 920
Name: Scott Kaye
Location: Ontario
Trades: 0
Check the tmp/ directory, it could be there.
__________________
Check out my
Please login or register to view this content. Registration is FREE
or my
Please login or register to view this content. Registration is FREE
!
Physicsguy is offline
Reply With Quote
View Public Profile
 
Old 12-21-2011, 03:28 AM Re: Merge PDF files
Novice Talker

Posts: 14
Trades: 0
I don't know where to find tmp/ directory?
Ivan96 is offline
Reply With Quote
View Public Profile
 
Old 12-21-2011, 05:56 AM Re: Merge PDF files
Novice Talker

Posts: 14
Trades: 0
I found it, but there isn't file docs_joined.pdf. Does anybody know how to solve this?
Ivan96 is offline
Reply With Quote
View Public Profile
 
Old 12-23-2011, 10:15 AM Re: Merge PDF files
Super Spam Talker

Posts: 879
Name: Paul W
Trades: 0
Write to an absolute path, ie from / downwards.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


*** New:
Please login or register to view this content. Registration is FREE
PaulW is offline
Reply With Quote
View Public Profile
 
Old 12-23-2011, 01:53 PM Re: Merge PDF files
Physicsguy's Avatar
404 - Title not found

Posts: 920
Name: Scott Kaye
Location: Ontario
Trades: 0
Not entirely sure if this will work or not, but it might be useful.

EDIT: I'm an idiot, nevermind. That won't work. Sorry!!
__________________
Check out my
Please login or register to view this content. Registration is FREE
or my
Please login or register to view this content. Registration is FREE
!
Physicsguy is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Merge PDF files
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28374 seconds with 12 queries