1.copy the whole thing(with images and lines) from first pdf and create second pdf using hiqpdf.
2.In first pdf it has 1 page view but the second pdf should have 2 page view.
3.So consider a example pdf contain 8 pages (it have sections A,B,C,D)
so copy A section from first pdf and hardcode the answer for A section and include it in second pdf like booklet view two page view
first page divided half it conatins section A question
Next Page Section A answers in two way view page

Lokesh VarmanRank #374 · 6.8K reputationPosted Jan 20, 2023, 8:43 AM EST
// Create a new PDF document PdfDocument pdfDoc = new PdfDocument(); // Read the first 2 pages of the existing PDF file PdfDocument existingPdf = new PdfDocument("existing_file.pdf"); PdfPage firstPage = existingPdf.Pages[0]; PdfPage secondPage = existingPdf.Pages[1]; // Add the first page to the new PDF document pdfDoc.Pages.Add(firstPage); // Add the second page to the new PDF document, scaled and rotated to fit the page PdfPage newPage = pdfDoc.AddPage(); PdfPageSize pageSize = newPage.Size; PdfPageRotation pageRotation = newPage.Rotation; PdfPageOrientation pageOrientation = newPage.Orientation; PdfRectangle secondPageRect = new PdfRectangle(0, 0, pageSize.Width / 2, pageSize.Height); PdfGraphics g = newPage.Graphics; g.Save(); g.TranslateTransform(pageSize.Width / 2, 0); g.ScaleTransform(0.5f, 1); g.RotateTransform(90); g.DrawImage(secondPage.CreateFormXObject(secondPageRect), secondPageRect); g.Restore(); // Save the new PDF document pdfDoc.Save("new_file.pdf"); // Close the new and existing PDF documents pdfDoc.Close(); existingPdf.Close();kavya m144 reputationPosted Jan 23, 2023, 1:48 AM EST
Using HIQPDF how to use graphics to create booklet view pdf from existing pdf ?
Below code is not working
PdfGraphics g = newPage.Graphics;
g.Save();
g.TranslateTransform(pageSize.Width / 2, 0);
g.ScaleTransform(0.5f, 1); g.RotateTransform(90);
g.DrawImage(secondPage.CreateFormXObject(secondPageRect), secondPageRect);
g.Restore();
Marvin ReidRank #1,963 · 746 reputationPosted Jan 23, 2023, 4:33 PM EST
You can use the PDFFile class to combine the PDF pages and edit the look of the page. Here is some code you can build on:
PDFFile file = new PDFFile(@"C:\inputfolder\input.pdf"); for (int i = 1; i <= file.GetPageCount(); i++) { string destinationFileName = Path.Combine(@"C:\inputfolder", string.Format("Page{0}.pdf", i)); file.ExtractPages(i, i, destinationFileName); // extract different pages to pdf } file.ExtractPages(1, 2, @"C:\outputfolder\output.pdf"); // Copy over pages 1-2 to make the new pdfhttps://www.leadtools.com/help/sdk/v22/dh/pdf/pdffile-extractpages.html
https://www.leadtools.com/help/sdk/v22/tutorials/dotnet-winforms-merge-pdf-files-to-single-pdf-file.html