Click here to Skip to main content
14,644,614 members
Rate this:
Please Sign up or sign in to vote.
See more:
Please help me to create multiple PDF files to Single PDF file without itextsharp.
OR
multiple png images to Single Pdf file.

[EDIT Op info from comments]
var originalDocument = PDDocument.load(@"C:\\temp\\1.pdf");
 var originalCatalog = originalDocument.getDocumentCatalog();
 java.util.List sourceDocumentPages = originalCatalog.getAllPages();

 var originalDocument2 = PDDocument.load(@"C:\temp\2.pdf");
 var originalCatalog2 = originalDocument.getDocumentCatalog();
 java.util.List sourceDocumentPages2 = originalCatalog.getAllPages();

 var newDocument = new PDDocument();
 newDocument.addPage((PDPage)sourceDocumentPages.get(1));
 newDocument.addPage((PDPage)sourceDocumentPages2.get(1));


 newDocument.save(@"C:\temp\merge.pdf");

This is the error i got in the First line
Quote:
{"Could not load file or assembly 'commons-logging, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)":"commons-logging, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"}
Posted
Updated 18-Dec-15 0:39am
v2
Comments
CHill60 18-Dec-15 5:20am
   
And what have you tried?
Mohammed_Faisal_Majeed 18-Dec-15 5:40am
   
I tried this but its not working :(

var originalDocument = PDDocument.load(@"C:\\temp\\1.pdf");
var originalCatalog = originalDocument.getDocumentCatalog();
java.util.List sourceDocumentPages = originalCatalog.getAllPages();

var originalDocument2 = PDDocument.load(@"C:\temp\2.pdf");
var originalCatalog2 = originalDocument.getDocumentCatalog();
java.util.List sourceDocumentPages2 = originalCatalog.getAllPages();

var newDocument = new PDDocument();
newDocument.addPage((PDPage)sourceDocumentPages.get(1));
newDocument.addPage((PDPage)sourceDocumentPages2.get(1));


newDocument.save(@"C:\temp\merge.pdf");
CHill60 18-Dec-15 6:16am
   
"not working" does not help us understand the problem.
Use the Improve question link to update your question with this code and a description of the problem
Mohammed_Faisal_Majeed 18-Dec-15 6:28am
   
This is the error i got in the First line

{"Could not load file or assembly 'commons-logging, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)":"commons-logging, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"}
kendokumar 18-Dec-15 6:45am
   
thank u for ur answer
Richard MacCutchan 18-Dec-15 7:12am
   
You are trying to use a library that does not exist on your system, or is not in a directory that the .NET Framework uses for searching. It is also interesting that you are using (or trying to use) a Java library in a C# program; are you sure this works?
Mohammed_Faisal_Majeed 18-Dec-15 7:35am
   
I am using the libraries, and i have included in the application also but still getting this error
Richard MacCutchan 18-Dec-15 8:23am
   
How are you using the Java libraries in a C# application? Also, please read my earlier comment, you are trying to access an assembly that is not available at run time, even if you included it in your project. It seems to me there is a lot of information missing from your question.
Mohammed_Faisal_Majeed 18-Dec-15 8:40am
   
I solved it actually i was using Iprintable in the namespace. when i removed from the header it worked :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100