pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Lehmkühler (Jira) <j...@apache.org>
Subject [jira] [Issue Comment Deleted] (PDFBOX-2116) Compare tow pdf file and hilight the mismatch value in generated pdf file
Date Tue, 17 Sep 2019 15:51:00 GMT

     [ https://issues.apache.org/jira/browse/PDFBOX-2116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Andreas Lehmkühler updated PDFBOX-2116:
---------------------------------------
    Comment: was deleted

(was: Zeonpad provides the free java api to compare two PDF files and generates pdf which
contain highlighted value of mismatch after comparing two pdf. its based on PDFBOX api.

[http://www.zeonpad.com/app/index.html]

 

Example :

{{ZPDFCompare obj = new ZPDFCompare(); }}

{{obj.pdfcompare("C:\\Users\\Desktop\\expectedFile.pdf", "C:\\Users\\Desktop\\actualFile.pdf",
"C:\\Users\\Desktop\\expectedFile_Diff.pdf","C:\\Users\\tarun.kumar\\Desktop\\actualFile_Diff.pdf");}})

> Compare tow pdf file and hilight the mismatch value in generated pdf file 
> --------------------------------------------------------------------------
>
>                 Key: PDFBOX-2116
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2116
>             Project: PDFBox
>          Issue Type: Task
>          Components: PDModel
>    Affects Versions: 1.8.5
>         Environment: Java Environment using PDF box
>            Reporter: Amit Vishwakarma
>            Priority: Major
>              Labels: test
>   Original Estimate: 12h
>  Remaining Estimate: 12h
>
> {code}
> 		PDDocument doc= PDDocument.load(pdf1);
> 		PDDocument doc2= PDDocument.load(pdf2);
> 		
> 		System.out.println(doc);
> 		
> 		@SuppressWarnings("rawtypes")
> 		List list=doc.getDocumentCatalog().getAllPages();
> 		@SuppressWarnings("rawtypes")
> 		List list2=doc2.getDocumentCatalog().getAllPages();
> 		
> 		PDFTextStripper stripper=new PDFTextStripper();
> 		PDFTextStripper stripper2=new PDFTextStripper();
> 		
> 		String pages= null;
> 		String pages2= null;
> 		
> 		System.out.println("list1 size : "+list.size());
> 		System.out.println("list2 size : "+list2.size());
> 		
> 		if(list.size()==list2.size()){
> 			
> 			for(int i=1;i<=list.size();i++){
> 				stripper.setStartPage(i);
> 				stripper.setEndPage(i);
> 				
> 				stripper2.setStartPage(i);
> 				stripper2.setEndPage(i);
> 				
> //				System.out.println("-----------"+stripper.getEndPage());
> 				
> 				pages = stripper.getText(doc);
> 				pages2 = stripper2.getText(doc2);
> 				
> 				String lines[] = pages.split("\\r?\\n");
> 				String lines2[] = pages2.split("\\r?\\n");
> 				
> 				System.out.println("Line in first page : "+lines.length);
> 				System.out.println("Line in second page : "+lines2.length);
> 				
> 				if(lines.length==lines2.length){
> 					
> 					for(int a=0;a<lines.length;a++){
> //						System.out.println(lines[a]);
> //						System.out.println("************----------**********");
> 						String cols[] = lines[a].split("\\s+");
> 						String cols2[] = lines2[a].split("\\s+");
> 						if(cols.length==cols2.length){
> 							for(int b=0;b<cols.length;b++){
> 								//System.out.println(cols[b].toString()+" - - - - "+cols2[b].toString());
> 								//System.out.println("Page : "+i+" Row : "+a+" Column : "+b);
> 								if(!cols[b].toString().equalsIgnoreCase(cols2[b].toString())){
> 									System.out.println("Not matched : "+cols2[b].toString());
> 									//System.out.println("Page : "+i+" Row : "+a+" Column : "+b);
> 								}
> 								
> 							}
> 						}else{
> 							System.out.println("column are not equals");
> 						}
> 					}
> 					System.out.println("******");
> 				}else{
> 					System.out.println("Line are not equal ");
> 				}
> 				
> 			}
> 		}else{
> 			System.out.println("Page size is not equal");
> 		}
> 		
> 		
> 	    doc.close();
> {code}



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Mime
View raw message