Free Support Forum - aspose.com

Create two sided booklet pdf from single sided pdf

HI there ,
I am very new to Aspose , We are currently using pdfsharp Library to manipulate pdf files but we figured out it has certain limitations so we thought of giving a try with Aspose.

we work on a application called Presentation and Research Services where user will create a presentation documents for printing ,my requirement is user will upload a pdf file(sourcefile) and then he will select double sided option and also will select what type of binding is required (here i have selected coil as example), when he does select that option we will create a pdf file which will look like a booklet which will have pages on both side as shown in the finaloutput file .

Can you please help us with a sample code which can be achieved using Aspose ?

I have attached the source file and the final output file after modification , i want to know how we can achieve the same with the Aspose library .

Please let me know if the requirement is not clear enough or if you need more information.

Thanks
Anil

Hi Anil,


Thanks for your inquiry. You can create booklet using Aspose.Pdf, please check following code snippet and attached output PDF. Hopefully it will help you to accomplish the task.

//create PdfFileEditor object<o:p></o:p>

PdfFileEditor pdfEditor = new PdfFileEditor();

//set left and right pages

int[] leftPages = new int[] { 1,3,5,7,9 };

int[] rightPages = new int[] { 2,4,6,8,10};

//make booklet

pdfEditor.MakeBooklet(myDir + "sourcefile (1).pdf", myDir + "booklet_output.pdf", leftPages,rightPages );

Please feel free to contact us for any further assistance.


Best Regards,

Hi Tilal,

that’s is what I was looking for,you are awesome .

but I tried your code as you said but I don’t see any output file in my destination folder .

Can you please go through the code and let me know if I am missing some thing .



I also wanted to know how to insert the binding image in between the two pages as shown in my finaloutput.pdf file in my first post .



I appreciate your help.



I am using the Trial version ,I don’t have the licensed version.

Please let me know if I have to add some additional code for using the trial version ?



Thanks

Anil





Hi Anil,


Thanks for your inquiry. Yes you are correct you are getting issue due to evaluation version. Actually by default exceptions are off for PdfFileEdior Object, if you set AllowConcatenateExceptions to true then you can see the exception. Please note Aspose.Pdf
evaluation version has two limitations, evaluation watermark and at most
four elements of any collection can be viewed. Please make a request for 30
days temporary license to evaluate our product without
any limitation. Hopefully your issue will be resolved.

…<o:p></o:p>

....

//create PdfFileEditor object

PdfFileEditor pdfEditor = new PdfFileEditor();

pdfEditor.AllowConcatenateExceptions = true;

//set left and right pages

....

....

Please feel free to contact us for any further assistance.


Best Regards,

Hi Tilal,
Thank you for that suggestion , Its working fine now .

My next question is how to insert an image in between the booklet , As shown in the finaloutput.pdf file in my first post .

Thanks
Anil

Hi Anil,


As per your requirement, you can add an image as stamp object in the middle of booklet output. Please visit the following link for further details on Adding Image Stamp in PDF File

You can also insert blank page at the beginning and end of booklet file. Please visit