We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Concatenation of PDFs

We gather info on a web site from users and use Aspose Words to create merged document and convert it to PDF. We than take a 1 page signature PDF uploaded from the user and concatenate it to the PDF we created. Sometimes the top of the signature page is cut off. I have attached the word file we use as a template for the merge and a copy of the signature PDF uploaded and the final PDF of the 2 concatenated PDFs.


Thanks for you assistance.

Hi Russ,

Thanks for using our API's.

I have tested the scenario using Aspose.Pdf for .NET 11.8.0 and Aspose.Words for .NET 16.3.0 and I am unable to notice any issue. For testing purposes, in first scenario, I have tried appending signature PDF file as first document in merged file, and in second scenarios, I have have tried placing it as second document in Merged PDF and in both cases, the resultant PDF is appearing properly. For your reference, I have attached the output generated with both scenarios.

[C#]

// load MS Word file

Aspose.Words.Document pdfDocument = new Aspose.Words.Document("c:/pdftest/ePFB.doc");

// save output in PDF format

pdfDocument.Save("c:/pdftest/ePFB.pdf", Aspose.Words.SaveFormat.Pdf);

// load signature PDF document

Document doc1 = new Document("c:/pdftest/PFB+Signature+Page+-+2.pdf");

// load PDF file created from DOC file

Document doc2 = new Document("c:/pdftest/ePFB.pdf");

// add pages from Signature file to pages collection of PDF created from DOC

doc2.Pages.Add(doc1.Pages);

// save merged file

doc2.Save("c:/pdftest/MergedFile_Certificate_Second.pdf");

Hi, I know it has been a while since I originally posted this issue. It does not happen frequently but does still occur on occasion. I have included to 3 PDFs. The master PDF is created using Aspose word and converted to PDF. The other 2 are PDFs that get appended to the PDF (PDF1). One of the PDFs appends correctly (PDF2) on the other one (PDF3) the page orientation is changed. The appended PDF is created by scanning a signed hard copy to PDF. The code is as follows:


Private Sub AppendSig(ByVal sInFile As String, ByVal sSigFile As String, ByVal sOutFile As String)
Dim license As Aspose.Pdf.License = New Aspose.Pdf.License
license.SetLicense(“Aspose.Pdf.Lic”)

Dim Pdf1 As New Document(sInFile)
Dim Pdf2 As New Document(sSigFile)

Pdf1.Pages.Add(Pdf2.Pages)

Pdf1.Save(sOutFile)
If File.Exists(sInFile) Then
File.Delete(sInFile)
File.Move(sOutFile, sInFile)
End If

End Sub

Hi Russ,


Thanks for contacting support.

I have tested the scenario using following code snippet using Aspose.Pdf for .NET 17.5 where I have tried concatenating all three documents and I am unable to notice any issue. As per my observations, the resultant PDF file is properly being generated.

For your reference, I have also attached the output generated over my end. Can you please try using the latest release and share your findings.

[VB.NET]

Dim Pdf1 As New Document(“c:/pdftest/PDF1.pdf”)<o:p></o:p>

Dim Pdf2 As New Document("c:/pdftest/PDF2.pdf")

Dim Pdf3 As New Document("c:/pdftest/PDF3.pdf")

Pdf1.Pages.Add(Pdf2.Pages)

Pdf1.Pages.Add(Pdf3.Pages)

Pdf1.Save(“c:/pdftest/ConcatenatedFile.pdf”)

We were using version 17.2. I have updated to version 17.5 and still have an issue. Please see the 2 attached merged documents. Thr one title MergedPDF2 merges correctly for me but the one titled MergedPDF3 does not.

Hi Russ,


Thanks for sharing the details.

It appears that in both documents, you have added a TextStamp and in order to replicate the issue, I have tried using following code snippet but I am unable to notice any issue. For your reference, I have also attached the output files generated over my end.

Can you please share complete code snippet or sample project, so that we can again test the scenario in our environment. We are sorry for this inconvenience.

[VB.NET]

Dim Pdf1 As New Document(“c:/pdftest/PDF1.pdf”)<o:p></o:p>

Dim Pdf2 As New Document("c:/pdftest/PDF2.pdf")

Dim Pdf3 As New Document("c:/pdftest/PDF3.pdf")

' Create text stamp

Dim textStamp As TextStamp = New TextStamp("Filed May 25, 2017 7:48 AM ET Office of the Judges of Compensation Claims.")

' Set whether stamp is background

textStamp.Background = True

' Set origin

textStamp.XIndent = 100

textStamp.YIndent = 100

textStamp.VerticalAlignment = VerticalAlignment.Bottom

textStamp.HorizontalAlignment = HorizontalAlignment.Center

' Set text properties

textStamp.TextState.Font = FontRepository.FindFont("Arial")

textStamp.TextState.FontSize = 14.0F

textStamp.TextState.FontStyle = FontStyles.Bold

textStamp.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Navy)

' Add stamp to particular page

Pdf1.Pages(1).AddStamp(textStamp)

'Pdf1.Pages.Add(Pdf2.Pages)

Pdf1.Pages.Add(Pdf3.Pages)

Pdf1.Save(“c:/pdftest/ConcatenatedFile_1_3.pdf”)

We stamp the document right after appending the signature page. The call to the stamp routine is

lcDocument.TimeStamp(ConfigurationManager.AppSettings(“EnvUpload”) & ConfigurationManager.AppSettings(“UploadTemp”) & “” & lblFileName.Text & “_e.pdf”, ConfigurationManager.AppSettings(“EnvUpload”) & ConfigurationManager.AppSettings(“UploadTemp”) & “” & lblFileName.Text & “_Stamped.pdf”, Format(Now, “MMMM d, yyyy h:mm tt”))

Here is the TimeStamp routine:
Friend Sub TimeStamp(ByRef sInFile As String, ByVal sOutFile As String, ByVal sTimeStamp As String)
Dim license As Aspose.Pdf.License = New Aspose.Pdf.License
license.SetLicense(“Aspose.Pdf.Lic”)

Dim pdfDocument As New Aspose.Pdf.Document(sInFile)
Dim sFiledText As New TextStamp(“Filed " & sTimeStamp & " ET Office of the Judges of Compensation Claims.”)

sFiledText.Background = False
sFiledText.XIndent = 75
sFiledText.YIndent = 10
sFiledText.TextState.FontSize = 10
sFiledText.TextState.FontStyle = Text.FontStyles.Bold
sFiledText.TextState.ForegroundColor = Aspose.Pdf.Color.Blue
pdfDocument.Pages(1).AddStamp(sFiledText)

pdfDocument.Save(sOutFile)
If File.Exists(sInFile) Then
File.Delete(sInFile)
File.Move(sOutFile, sInFile)
End If

End Sub

I tried bypassing the stamp and it is still skewed on the document.

Thanks

Hi Russ,


Thanks for sharing the details.

I have again tried replicating the issue following code snippet and I am still unable to notice the problem when using Aspose.Pdf for .NET 17.5. For testing purposes, I have also used PFB+Signature+Page±+2.pdf shared in first post of this thread.

Can you please share a sample project with all related files (in case they are missing), so that we can test the scenario in our environment. We are sorry for your inconvenience.

[VB.NET]

Dim Pdf1 As New Document(“c:/pdftest/PDF1.pdf”)<o:p></o:p>

Dim Pdf2 As New Document("c:/pdftest/PDF2.pdf")

Dim Pdf3 As New Document("c:/pdftest/PFB+Signature+Page+-+2.pdf")

'Pdf1.Pages.Add(Pdf2.Pages)

Pdf1.Pages.Add(Pdf3.Pages)

Pdf1.Save("c:/pdftest/ConcatenatedFile_1_3.pdf")

' call stamp method

TimeStamp("c:/pdftest/ConcatenatedFile_1_3.pdf", "c:/pdftest/ConcatenatedFile_1_3__Stamped.pdf", Format(Now, "MMMM d, yyyy h:mm tt"))

Friend Sub TimeStamp(ByRef sInFile As String, ByVal sOutFile As String, ByVal sTimeStamp As String)

Dim pdfDocument As New Aspose.Pdf.Document(sInFile)

Dim sFiledText As New TextStamp("Filed " & sTimeStamp & " ET Office of the Judges of Compensation Claims.")

sFiledText.Background = False

sFiledText.XIndent = 75

sFiledText.YIndent = 10

sFiledText.TextState.FontSize = 10

sFiledText.TextState.FontStyle = Aspose.Pdf.Text.FontStyles.Bold

sFiledText.TextState.ForegroundColor = Aspose.Pdf.Color.Blue

pdfDocument.Pages(1).AddStamp(sFiledText)

pdfDocument.Save(sOutFile)

' If File.Exists(sInFile) Then

'File.Delete(sInFile)

'File.Move(sOutFile, sInFile)

' End If

End Sub

The PDF attached in your last post is not the file that was having the issue. It is the one titled PDF3.pdf in my original post. I have attached it again. Please use it to append to the base PDF and see if you can recreate the problem.


Thanks
Russ

Hi Russ,


Thanks for sharing the details.

I have again tested the scenario using recently shared document where I have used Aspose.Pdf for .NET 17.5 in Visual Studio 2010 running over Windows 7 (x64) and I am unable to notice any issue. As per my observations, the pages are stamp object are properly rendering in resultant file. For your reference, I have also attached the output generated over my end.

In case you still face the same problem, please share a sample project, so that we can again try replicating the issue in our environment. We are sorry for this inconvenience.