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

Free Support Forum - aspose.com

pdfEditor.concatenate Creates a 0KB file

I am having problems concatenating a number of files together to make a large sized PDF file.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

What I do in my program is allow the user to choose from a list of PDF files from a folder location on my network. Once they have chosen a list of PDF files they would like to look at, I have my program create a cover letter that shows where each of the PDFs they have chosen will be on the concatenated PDF file. The Cover letter is usually 65KB. In the attachment I have a list of PDF files I am working with and there file size. If I try concatenating the PDFs from the bottom of the list up, I can only make a PDF that adds up to about 50,000KB. After that 50,000 mark the concatenated PDF returns with 0KB and no data. Also, if I try just choosing the file on the top of the list, which is 28,717KB and try to concatenate it with the 65KB cover letter, it almost always returns a PDF file with 0KB.

I am working with Aspose.PDF.Kit that I purchased in July 2008 for VB.NET. The code that I use is to create a String Array of all the file locations the user has chosen.

Once the String Array is ready I use

pdfEditor.Concatenate(TheFilesToMerge, FullDocLocation +“\FullDoc.PDF")

Is there a file size limitation or something I must do to allow bigger files to be concatenated together? This seems to be happening to others form your forum but I did not see if there was some kind of fix. If you need my PDF files I will see If I can provide them if necessary.

Hi Andrew,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We apologize for your inconvenience.

Concatenation feature in Aspose.Pdf.Kit has a limitation that, it can support the Pdf files with in 200MB range. As you have mentioned, if you concatenate the Pdf files from bottom to top, you come up with a resultant Pdf with a size of 50MB approximately, so I don’t think this could be an issues related to size.

In order for us to test the issue, we would require the resource files. Can you please share the resource files and the code snippet.

I will have to receive permission to get you the PDF files. Hopefully I can get that to you in my next response. In the meantime, below is a snippet of the code I use to retrieve the file locations to put into the string array. The code is for VB.NET on an ASPX page. There is a Datagrid with two columns of check boxes that the user checks, which tells the function what PDFs they would like to look at. The cover page is created in a prior function.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

The function simply creates a list of file locations that get put into a String Array.

To verify what the problem is that I am facing is that if I pick a bunch of smaller sized PDFs, the concatenate will work until the combined size of the PDFs reaches around 50,000KB. I can do any combination of the smaller sized PDFs if the combined sizes of the files are around 50,000KB or less. The problem changes if I choose from the larger sized PDFs. Most of the time when I try to combine the large file with my cover page it does not want to work. I have had it work with the largest of the files once in a great while.

Imports Aspose.Pdf.Kit

Private Sub MergeTheFiles()

Dim license As Aspose.Pdf.Kit.License = New Aspose.Pdf.Kit.License

license.SetLicense("C:\Inetpub\wwwroot\PortalVBVS\Fixed_Process_Filing\bin\Aspose.Pdf.Kit.Lic")

'Instantiate PdfFileEditor object

Dim pdfEditor As PdfFileEditor = New PdfFileEditor

Dim objItem As DataGridItem

Dim TabName As String

Dim myCheckBox As CheckBox

Dim PenCheckBox As CheckBox

Dim SeeTab As Boolean

Dim SeePending As Boolean

Dim Counter As Integer = 0

Dim FileInfo As New ArrayList

Dim FilePathway As String

Dim StoreStringLocations As New ArrayList

Call CreateTempForViewFolder()

Dim BuiltPath As String = "\\aceprecision.com\dfs-root\data\AceFiling\ViewPDF\" & Viewstate("CurrentSessionId") & "\"

For Each objItem In SelectTabTG.Items

If objItem.ItemType <> ListItemType.Header And objItem.ItemType <> ListItemType.Footer And objItem.ItemType <> ListItemType.Pager Then

myCheckBox = CType(objItem.Cells(3).FindControl("Tabs"), CheckBox)

PenCheckBox = CType(objItem.Cells(4).FindControl("Pending"), CheckBox)

TabName = objItem.Cells(1).Text.Trim

If Not PenCheckBox Is Nothing Then

SeePending = PenCheckBox.Checked

If SeePending = True Then

If Counter <> 0 Then

FilePathway = "\\aceprecision.com\dfs-root\data\AceFiling\Fixed_Processes\" & PartNumberLB.Text.Trim & "\Pending\" & TabName & ".PDF"

StoreStringLocations.Add(FilePathway)

Counter = Counter + 1

Else

FilePathway = "\\aceprecision.com\dfs-root\data\AceFiling\ViewPDF\" & Viewstate("CurrentSessionId") & "\CoverPage.PDF"

StoreStringLocations.Add(FilePathway)

FilePathway = "\\aceprecision.com\dfs-root\data\AceFiling\Fixed_Processes\" & PartNumberLB.Text.Trim & "\Pending\" & TabName & ".PDF"

StoreStringLocations.Add(FilePathway)

Counter = Counter + 1

End If

End If

SeeTab = myCheckBox.Checked

If SeeTab = True Then

If Counter <> 0 Then

FileInfo.Clear()

FileInfo = FixedProcessConnections.GetFileLocationAndFileNameWithPartRevAndTabName(PartNumberLB.Text.Trim, RevisionLB.Text.Trim, TabName)

FilePathway = "\\aceprecision.com\dfs-root\data\AceFiling\Fixed_Processes\" & PartNumberLB.Text.Trim & "\" & FileInfo(0) & "\" & FileInfo(1) & ".PDF"

StoreStringLocations.Add(FilePathway)

Counter = Counter + 1

Else

FilePathway = "\\aceprecision.com\dfs-root\data\AceFiling\ViewPDF\" & Viewstate("CurrentSessionId") & "\CoverPage.PDF"

StoreStringLocations.Add(FilePathway)

FileInfo.Clear()

FileInfo = FixedProcessConnections.GetFileLocationAndFileNameWithPartRevAndTabName(PartNumberLB.Text.Trim, RevisionLB.Text.Trim, TabName)

FilePathway = "\\aceprecision.com\dfs-root\data\AceFiling\Fixed_Processes\" & PartNumberLB.Text.Trim & "\" & FileInfo(0) & "\" & FileInfo(1) & ".PDF"

StoreStringLocations.Add(FilePathway)

Counter = Counter + 1

End If

End If

End If

End If

Next

Dim TheFilesToMerge(StoreStringLocations.Count - 1) As String

For i As Integer = 0 To StoreStringLocations.Count - 1

TheFilesToMerge(i) = StoreStringLocations(i)

Next

pdfEditor.Concatenate(TheFilesToMerge, "\\aceprecision.com\dfs-root\data\AceFiling\ViewPDF\" & Viewstate("CurrentSessionId") & "\FullDoc.PDF")

End Sub

Hopefully I can get you the PDF files or substitutes within the week.

Thank you for all your help.

Hello Andrew,

I have tested the scenario while concatenating large size pdf files, that gave me a resultant file of about 54MB and I am able to open it, successfully. I think the issue seems to be with the files you are using. Please share the resource files and the sample cover letter.

I do not have permission to give you the original files but I have made two files that do the same thing. Both files will have the same page repeated but have different file sizes.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

The file names and sizes are:

(1)[N_CPNCPItem 3,4,5 & 6 from Section A 2-131-110-76.PDF] has file size 29,667KB

(2)[N_CSPAR (LASER CUTTING).PDF] has file size 3,692KB

(2)[CoverPage.PDF] has file size 64KB

(4)[CoverPage-WhenFailed.PDF] has file size 63KB (Cover page when merge fails)

I cannot attach file (1) to this message. Is there another way to get you my large file.

To test this please copy file (2) as 20 different files.

I tried the following scenario in two different servers and got the same result.

I could merge up to 17 files of file (2) plus the cover page, which gave me a file size of around 62,829KB or I could Merge File (1) with 9 files of (2) plus the cover page which gave me around the same file size. If I tried merging one more file it would return a 0KB file size.

Here is another oddity that happens when the file comes back as a 0KB file. If I try coping the 0KB file to another folder I receive the following Error.

<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />Error Copying File or Folder

Cannot copy FullDoc: It is being used by another person or program.

Close any programs that might be using the file and try again.

If the file merges correctly I can copy the file normally.

Thank you for your help.

Hello Andrew,

I have tested the scenario while creating 23 copies of File "N_CSPAR (LASER CUTTING).PDF" and have tried merging it with both the cover files, and in my case the resultant pdf is not of 0KB and the file size is 83KB. I have tested the issue using Aspose.Pdf.Kit v3.2.0.0

Hi Andrew,

And we are working on the performance issues for Aspose.Pdf.Kit again. I hope we could significantly improve the performance of Kit this time, within about a month.

I will inform you in this thread when we could make progress in the file-merging-issues.

Thanks,

I think I have been running the PDF.KIT under the previous version I will update and retry.

You had mentioned that the concatenate has a 200MB limitation. Can that size be increased at all? The files that merge do so quickly when it works. If I can, I would like to try and increase that size limit.

Thank you for all your help

Hello Andrew,
Let me share some thing related to Concatenate method. The method with string parameters could support 200MB; and in order to break the concatenate limitation is a very difficult task; we will try, but can not promise.
Currently, our main purpose is to improve the methods with stream parameters. As we have made any progress over this issue, we will keep you updated with the status of correction.

Hi Andrew,

We have improved the performance for PdfFileEditor class. Please download and try the attached beta version(3.2.0.7) of Aspose.Pdf.Kit.dll, and your feedback will be greatly appreciated.

Note that applying license will get better performance :-)

Thanks,