Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
1.00/5 (1 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?
[no name] 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
[no name] 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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900