Booklet, a small small book with several pages, is very convenient for carrying. We can find many booklets in our daily life, such as operating instruction, leaflet and so on. Also, we can create booklet by ourselves to record some useful words or interesting things. For example, an animation enthusiast can collect instructions and posters about great comics and create a booklet. In this post, I will show a method about how to create a booklet by using an existed PDF document with C#/VB.NET.
In my example, there is a PDF document which talks about Shelley. What I will do is to create it as a booklet. The two pages contents will be put in one page with two columns in this new booklet.
Now, let’s go to create. At the beginning, we need to add references in project. The first one is Spire.PDF dll file because I use it to realize this function. The second one is system.drawing for page size setting, including width and height.
Then, the following shows details in step.
- Create a new PDF document.
- Create booklet. We need to send four parameters in doc.CreateBooklet() method, file name, width, height and a bool value to set if the contents in one page will be separate with two column. For file name, I declare a string type. Its value is the PDF document which I want to create as booklet. For width and height, their values are set based on A4 page size.
- Save and launch this booklet.
static void Main(string args)
PdfDocument doc = new PdfDocument();
String srcPdf = @”D:\work\My Documents\Shelley.pdf”;
float width = PdfPageSize.A4.Width * 2;
float height = PdfPageSize.A4.Height;
doc.CreateBooklet(srcPdf, width, height, true);
//Save and Launch File
Friend Class Booklet
Shared Sub Main(ByVal args() As String)
Dim doc As New PdfDocument()
Dim srcPdf As String = “D:\work\My Documents\Shelley.pdf”
Dim width As Single = PdfPageSize.A4.Width * 2
Dim height As Single = PdfPageSize.A4.Height
doc.CreateBooklet(srcPdf, width, height, True)
‘Save and Launch File
Result Shown by Following:
Click Here to Learn more about Spire.PDF
Click Here to Download Spire.PDF