[ 
https://issues.apache.org/jira/browse/PDFBOX-4797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17056176#comment-17056176
 ] 

Andrei Toropov edited comment on PDFBOX-4797 at 3/10/20, 5:36 PM:
------------------------------------------------------------------

Thank you [~tilman] 

So what the solution for that ?

there is the code :

 
 
{code:java}
 public JSONObject overLay(String firstOverlayFile, String secondOverlayFile, 
String outputFileName) throws IOException {          JSONObject json = new 
JSONObject();        //        Overlay overlayer = new Overlay();        //     
    shell.log(5, "=== overLay.firstPageOverlayFile === ",firstOverlayFile);     
   shell.log(5, "=== overLay.lastPageOverlayFile  === ",secondOverlayFile);     
             overlayer.setOverlayPosition(Overlay.Position.FOREGROUND); 
        PDDocument firstFile = 
PDDocument.load(aws.getAwsFile(firstOverlayFile));         PDDocument 
secondFile = PDDocument.load(aws.getAwsFile(secondOverlayFile));
        String pdfFirstData = pdfContent(firstFile);        String pdfLastData 
= pdfContent(secondFile);                   overlayer.setInputPDF(firstFile);   
     overlayer.setAllPagesOverlayPDF(secondFile);
        Map<Integer, String> ovmap = new HashMap<Integer, String>();            
 ByteArrayOutputStream baos = new ByteArrayOutputStream();        
overlayer.overlay(ovmap).save(baos);        InputStream overlayedContent = new 
ByteArrayInputStream(baos.toByteArray());        IOUtils.copy(overlayedContent, 
new FileOutputStream(outputFileName));                       firstFile.close(); 
       secondFile.close();                 overlayer.close();          
shell.log(5, "=== overLay                      === ",outputFileName);        // 
       json.put("fileName",outputFileName);        json.put("pdfFirstData", 
pdfFirstData);        json.put("pdfLastData", pdfLastData);        return json; 
   }

{code}
 

 


was (Author: andrei toropov):
Thank you [~tilman] 

So what the solution for that ?

there is the code :

 
publicJSONObjectoverLay(StringfirstOverlayFile, StringsecondOverlayFile, 
StringoutputFileName) throwsIOException {
JSONObjectjson = newJSONObject();
//
Overlayoverlayer = newOverlay();
//
shell.log(5, "=== overLay.firstPageOverlayFile === ",firstOverlayFile);
shell.log(5, "=== overLay.lastPageOverlayFile === ",secondOverlayFile);
 
overlayer.setOverlayPosition(Overlay.Position.FOREGROUND);

PDDocumentfirstFile = PDDocument.load(aws.getAwsFile(firstOverlayFile));
PDDocumentsecondFile = PDDocument.load(aws.getAwsFile(secondOverlayFile));

StringpdfFirstData = pdfContent(firstFile);
StringpdfLastData = pdfContent(secondFile);
 
overlayer.setInputPDF(firstFile);
overlayer.setAllPagesOverlayPDF(secondFile);

Map<Integer, String> ovmap = newHashMap<Integer, String>();
ByteArrayOutputStreambaos = newByteArrayOutputStream();
overlayer.overlay(ovmap).save(baos);
InputStreamoverlayedContent = newByteArrayInputStream(baos.toByteArray());
IOUtils.copy(overlayedContent, newFileOutputStream(outputFileName));
 
 
firstFile.close();
secondFile.close();
 
overlayer.close();
 
shell.log(5, "=== overLay === ",outputFileName);
//
json.put("fileName",outputFileName);
json.put("pdfFirstData", pdfFirstData);
json.put("pdfLastData", pdfLastData);
return json;
}

> Overlayed PDF file do not shows the difference 
> -----------------------------------------------
>
>                 Key: PDFBOX-4797
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4797
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.19
>         Environment: Java Maven
>            Reporter: Andrei Toropov
>            Priority: Major
>         Attachments: 10.pdf, 114.pdf, 1583843507134004.overlay.PDF, 
> 2020-03-10_10-34-56.png, screenshot-1.png, screenshot-2.png
>
>
> There are two differences in this two files, in the table on last page and in 
> the table on the previous page the second row, column "% since inception" has 
> values 11.74 in one pdf and 11.75 in another one. The textual html diff picks 
> up and shows both cases. However, visual overlay shows this on page 5, but 
> doesn't show on page 6.  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to