Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Jun 09, 2015 8:19 am

Cheers,

I've been having a bit of an issue, trying to merge pdf files with the code below;
which works in our test environment, however, when we move to production environment
only page 1 of the merged pdf is created, and adobe gives this error when trying to view page 2 onwards...

"There was a problem reading this document (14)"


environment: VS2013/C#/ASP MVC

TIA

Code: Select all
ReportViewer rv1 = new ReportViewer();
ReportViewer rv2 = new ReportViewer();
ReportViewer rv3 = new ReportViewer();
ReportViewer rv4 = new ReportViewer();

PdfDocument _PDF1= new PdfDocument();
PdfDocument _PDF2=new PdfDocument();
PdfDocument _PDF3= new PdfDocument();
PdfDocument _PDF4= new PdfDocument();
PdfDocument pdfMerged= new PdfDocument();

byte[] File1 = null;
byte[] File2 = null;
byte[] File3 = null;
byte[] File4 = null;

File1 = rv1.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
_PDF1.LoadFromBytes(File1);

File2 = rv2.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
_PDF2.LoadFromBytes(File2);

File3 = rv3.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
_PDF3.LoadFromBytes(File3);

File4 = rv4.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
_PDF4.LoadFromBytes(File4);

if (_PDF1 != null)
   pdfMerged.AppendPage(_PDF1);

if (_PDF2 != null)
   pdfMerged.AppendPage(_PDF2);

if (_PDF3 != null)
   pdfMerged.AppendPage(_PDF3);

if (_PDF4 != null)
   pdfMerged.AppendPage(_PDF4);

hazelD.pc
 
Posts: 6
Joined: Thu Aug 14, 2014 6:39 am

Tue Jun 09, 2015 8:58 am

Hello,
Thanks for your inquiry. I suggest you use our new method to merge pdf files. Here is the tutorial.
http://www.e-iceblue.com/Tutorials/Spir ... -in-C.html
Please let us know if you have any questions.
Sincerely,
Gary
E-iceblue support tem
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Jun 10, 2015 9:03 am

Hello,

Have you tried the new method? Has your issue been resolved? Could you please give us some feedback at your convenience?

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Jun 17, 2015 3:30 am

thanks for the suggestion. tried it today, it works really well.

thanks for the help!

hazelD.pc
 
Posts: 6
Joined: Thu Aug 14, 2014 6:39 am

Wed Jun 17, 2015 7:42 am

Hello,

Thanks for your response. Glad to hear that. Please let us know if you have any questions.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.PDF