Error writing files to disk



I'm evaluating Aspose.Pdf.Kit for a program I am writing and it seems ideal for my purposes but for one issue.

I'm trying to concatenate two files and save the output to disk. The code given below does the job very well, creating the new file and writing it to disk.

When I run it as part of the program, however, despite the subroutine doing what I requested, it throws up a Microsoft Development Environment error as follows:

An unhandled exception of type 'System.IO.IOException' occurred in aspose.pdf.kit.dll

Additional information: Bad password!

The code is a minor modification of your example code:

Public Sub Concatenate(ByVal inputfile1 As String, ByVal inputfile2 As String, ByVal outputfile As String)

'read input Pdf documents

Dim inStream1 As FileStream = File.Open(inputfile1, FileMode.Open, FileAccess.Read, FileShare.Read)

Dim inStream2 As FileStream = File.Open(inputfile2, FileMode.Open, FileAccess.Read, FileShare.Read)

Dim OutStream As FileStream = File.Open(outputfile, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite)

Dim pdfInfo As PdfFileInfo = New PdfFileInfo(OutStream)

'set new PdfFileEditor object

Dim pdfEditor As PdfFileEditor = New PdfFileEditor

'generate new Pdf file stream.

pdfEditor.Concatenate(inStream1, inStream2, OutStream)

'save the information



End Sub

I'd appreciate the help.



Dear customer,

Thanks for considering Aspose.

1) I have read your code and found that the following line is not needed:

Dim pdfInfo As PdfFileInfo = New PdfFileInfo(OutStream)

The pdfInfo object is not needed. The correct code is in this example:

and this too:

Please change your code according to the example and if the error occurs too, please upload your pdf.

2)It seems that the input Pdf file s are proctected by passwords from the Exception message, if so, please decrypt the pdf files firstly ,then manipulate the files.

Best regards.


Dear Ken,

Thank you so very much for your extremely prompt reply.

The process as described worked perfectly and the program now does all that I wanted it to do.

I found your site this morning after wanting to concatenate PDF files to give a professional output for clients that they could print with their specifications (moving from our traditional A4 to letter format is always an issue in programs such as Word).

Thanks to your excellent software and your fantastic customer service, I solved the issue within a day (even on the other side of the world).

For those who are interested in how to launch the newly concatenated files, they can be opened in Adobe via the VB following command:

Diagnostics.Process.Start("AcroRd32.exe", "output.pdf")

I am going onto your sales site to place my order.

Kind regards Smile [:)]