Formatting all PDF document to same size of A4

Hello Team,

We are trying to merge multiple PDF of different size to the one single size of A4. We have used below code to resize all PDF and then merging.

static Document ResizePDF(string ReportTemplatePath, string FileName, string ReportSavePath)
{
string PDFFile = ReportTemplatePath + FileName;
Document pdfDocument = new Document(PDFFile);

Aspose.Pdf.Facades.PdfFileEditor fileEditor = new Aspose.Pdf.Facades.PdfFileEditor();

for (int i = 0; i < pdfDocument.Pages.Count; i++)
{
    fileEditor.ResizeContents(pdfDocument, new int[] { i + 1 },
                        Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeParameters.PageResize(PageSize.A4.Width,
                            PageSize.A4.Height));
}


return pdfDocument;

}

pdfEditor = new PdfFileEditor();
// Concatenate files
pdfEditor.Concatenate(ReportSavePath + "output1.pdf", ReportSavePath + Dest, ReportSavePath + "output2.pdf");

However for one particular document, it is not getting resized properly. There is a table in it with width more than what is standard for A4 size page, we are not sure whether it is creating issue or not.

Please help us on how can we get all pages in A4 size.

Thanks
Hardik

@hardikshah_cfirst

Have you tried with 23.8 version of the API? If issue still persists, can you please share sample PDF for our reference? We will test the scenario in our environment and address it accordingly.

We are using latest one means 23.8 version of .NET file only. Please find attached document having issues.

Please find attached files. ABC is already file in A4 size of document, however 2.PDF is not and hence when I am appending 2.pdf to ABC.pdf, I want to convert 2.PDF to also A4 so the final output document can have same A4 size for all pages and not some pages with different width or alignment.

  1. ABC.pdf (469.7 KB)
  2. 2.pdf (847.3 KB)
  3. output_20230908-140241.pdf (1.3 MB)

Thanks
Hardik

@hardikshah_cfirst

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-55461

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hi @asad.ali,

We are planning to purchase ASPOSE.PDF on the basis of solution to this issue, so please let us know once we have solution available.

Thanks
Hardik

@hardikshah_cfirst

We have recorded your concerns and updated the ticket description accordingly. We will surely consider your concerns during the investigation and let you know as soon as the ticket is resolved. Please spare us some time.

Hi @asad.ali,

Do we have any update here? We need to find answers to purchase this tool.

Also can you please confirm if we can generate password protected PDF using ASPOSE.PDF or not?

Please help me with answers on above two questions.

Thanks
Hardik

Nice post and please provide more information. Thanks for sharing..
.

@hardikshah_cfirst

We are afraid that the earlier logged ticket could not get resolved due to other issues in the queue. However, we have recorded your concerns already and will surely inform you as soon as we make some progress towards ticket resolution. Please spare us some time. We apologize for your inconvenience.

Yes, you can create password protected PDFs using Aspose.PDF. Please check the sample code snippet in the below article:

Hi @asad.ali ,

Let us know if you have released any patch for solution to the issue I have raised.

Thanks
Hardik

@hardikshah_cfirst

We are afraid that the earlier logged ticket has not been yet resolved. We will surely inform you once we make some progress towards ticket resolution. Please spare us some time.

We are sorry for the inconvenience.