Free Support Forum - aspose.cloud

Merge multiple PDF Documents with Aspose.PDF SDK for PHP

Also, one other subtle point. If I want to create say 2 new pdf documents from a master pdf like:

master.pdf : 4 pages

master1.pdf : pages 1-2

master2.pdf: pages 3-4

Do I need to first ‘split’ master.pdf into 4 individual pages and then merge each set of 2 into another or is there some shortcut method like:

createnewpdf(‘master.pdf’,1,2) ?
createnewpdf(‘master.pdf’,3,4)

Hi Clint,


Thank you for asking about this feature support. Yes, there is a shortcut. You can split a PDF document by a range of pages. The split resource accepts “from” and “to” parameters to define a range of pages.

Please have a look over these helping techniques: Split PDF Files
You need to scroll down the page and see a sub example named as "Split specific pages to new PDFs"

Please feel free to reply us in case of any confusion or questions.

Hi. I believe that is the function I am using but it seems to create two ‘separate’ pdfs when I run my code:



[[

Here is the code (using php sdk)



try{

//initialize Document object

$doc = new Document(‘TestPDFAspose.pdf’);

$result = $doc->splitPages(3, 4);



} catch (Exception $e) {throw new Exception($e->getMessage());}



]]





This created ‘two’ separate pdf files on my server named TestPDFAspose_pdf_1.pdf & TestPDFAspose_pdf_2.pdf



The contents of TestPDFAspose_pdf_1 was page 3 from TestPDFAspose.pdf and the contents of TestPDFAspose_pdf_2 was page 4 from TestPDFAspose.pdf ???



But what I want is a single new pdf document that has the contents of page 3 and page 4…

Hi Clint,


Thank you for these details. I’m sorry about the confusion. For now as a workaround, you can split PDF pages individually and then merge them, as stated in the following help topic: Merge Multiple PDF Files

I’ve logged a feature request to achieve this task in a single API request. This feature has been logged under ticket id SAASPDF-123 in our issue tracking system. We’ll let you know once it is supported. We’re sorry for your inconvenience.

Hi. Thanks. I will use this strategy for creating the new pdf.

I need you to reset my demo account again because I am getting the same error:

Uncaught exception ‘Exception’ with message ‘{“Message”:“Your have processed ‘104’ documents. Your pricing plan allows only ‘100’ documents.”}’ in /home/content/10/9442310/html/test/testAsposePDF.php:123

I realize the demo caps are there for good reason but I don’t understand why I keep running into this limitation. I have only tested my code maybe 15 times and I keep hitting this limit??

Please reset this for me so that I can implement the strategy you mention above.

Email is clint.zeringue@zmoddynamics.com

Thanks,

Hi Clint,


Thank you for your inquiry. In this case, please simply create an account at the Aspose Cloud and get your application information (app key and SID). Then go ahead and use the Aspose for Cloud REST API with new trail limits. Furthermore, your current trail account limit will also be reset automatically at the end of each month.

I hope, this helps.