[jira] [Updated] (PDFBOX-4312) Signature is not getting inserted into 00000 area

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr updated PDFBOX-4312:

Fix Version/s: 1.8.16

> Signature is not getting inserted into 0 area
> -
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Bug
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9, 1.8.15
>Reporter: bal
>Priority: Major
> Fix For: 1.8.16
>
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature-signed-SaveIncremental-1param-bad-cutoff.pdf, 
> testingSignature-signed-SaveIncremental-2param-good.pdf, 
> testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Updated] (PDFBOX-4312) Signature is not getting inserted into 00000 area

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr updated PDFBOX-4312:

Affects Version/s: 1.8.15

> Signature is not getting inserted into 0 area
> -
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Bug
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9, 1.8.15
>Reporter: bal
>Priority: Major
> Fix For: 1.8.16
>
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature-signed-SaveIncremental-1param-bad-cutoff.pdf, 
> testingSignature-signed-SaveIncremental-2param-good.pdf, 
> testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Comment Edited] (PDFBOX-4312) Signature is not getting inserted into 00000 area

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr edited comment on PDFBOX-4312 at 9/20/18 4:06 AM:
--

{quote}{color:#33}yet my signature in not inserting in the blankbox please 
guide me it's very important to me to solve this issue .{color}
{quote}
{color:#33}indeed. It is still 0.{color}

{color:#33}1) Your file looks as if you called save(). I wonder if 
saveIncremental(filename) works at all (your file is also cut off at the end), 
our examples use the two parameter method. Make sure that the output file name 
is not identical to the input file name. See this excerpt of the example source 
code:{color} 
{code:java}

  public File signPDF(File document) throws IOException, COSVisitorException,
  SignatureException
  {
    byte[] buffer = new byte[8 * 1024];
    if (document == null || !document.exists())
    {
    new RuntimeException("Document for signing does not exist");
    }
    // creating output document and prepare the IO streams.
    String name = document.getName();
    String substring = name.substring(0, name.lastIndexOf("."));
    
    File outputDocument = new File(document.getParent(), 
substring+"_signed.pdf");
    FileInputStream fis = new FileInputStream(document);
    FileOutputStream fos = new FileOutputStream(outputDocument);
    int c;
    while ((c = fis.read(buffer)) != -1)
    {
  fos.write(buffer, 0, c);
    }
    fis.close();
    fis = new FileInputStream(outputDocument);

…
…

  PDDocument doc = PDDocument.loadNonSeq(document, randomAccessFile);
  
  // create signature dictionary
  PDSignature signature = new PDSignature();
  signature.setFilter(PDSignature.FILTER_ADOBE_PPKLITE); // default filter
  // subfilter for basic and PAdES Part 2 signatures
  signature.setSubFilter(PDSignature.SUBFILTER_ADBE_PKCS7_DETACHED);
  signature.setName("signer name");
  signature.setLocation("signer location");
  signature.setReason("reason for signature");
  
  // the signing date, needed for valid signature
  signature.setSignDate(Calendar.getInstance());
  
  // register signature dictionary and sign interface
  if (options==null)
  {
    doc.addSignature(signature, this);
  } 
  else 
  {
    doc.addSignature(signature, this, options);
  }
  
  // write incremental (only for signing purpose)
  doc.saveIncremental(fis, fos);
{code}
{color:#33}2) Your image is a png image. Please pass a jpeg image. This is 
not documented, sadly.{color}


was (Author: tilman):
{quote}{color:#33}yet my signature in not inserting in the blankbox please 
guide me it's very important to me to solve this issue .{color}
{quote}
{color:#33}indeed. It is still 0.{color}

{color:#33}1) Your file looks as if you called save(). I wonder if 
saveIncremental(filename) works at all (your file is also cut off at the end), 
our examples use the two parameter method. Make sure that the output file name 
is not identical to the input file name.{color}

 
{code:java}

  public File signPDF(File document) throws IOException, COSVisitorException,
  SignatureException
  {
    byte[] buffer = new byte[8 * 1024];
    if (document == null || !document.exists())
    {
    new RuntimeException("Document for signing does not exist");
    }
    // creating output document and prepare the IO streams.
    String name = document.getName();
    String substring = name.substring(0, name.lastIndexOf("."));
    
    File outputDocument = new File(document.getParent(), 
substring+"_signed.pdf");
    FileInputStream fis = new FileInputStream(document);
    FileOutputStream fos = new FileOutputStream(outputDocument);
    int c;
    while ((c = fis.read(buffer)) != -1)
    {
  fos.write(buffer, 0, c);
    }
    fis.close();
    fis = new FileInputStream(outputDocument);

…
…

  PDDocument doc = PDDocument.loadNonSeq(document, randomAccessFile);
  
  // create signature dictionary
  PDSignature signature = new PDSignature();
  signature.setFilter(PDSignature.FILTER_ADOBE_PPKLITE); // default filter
  // subfilter for basic and PAdES Part 2 signatures
  signature.setSubFilter(PDSignature.SUBFILTER_ADBE_PKCS7_DETACHED);
  signature.setName("signer name");
  signature.setLocation("signer location");
  signature.setReason("reason for signature");
  
  // the signing date, needed for valid signature
  signature.setSignDate(Calendar.getInstance());
  
  // register signature dictionary and sign interface
  if (options==null)
  {
    doc.addSignature(signature, this);
  } 
  else 
  {
    doc.addSignature(signature, this, options);
  }
  
  // write incremental (only for signing purpose)
  doc.saveIncremental(fis, fos);

[jira] [Comment Edited] (PDFBOX-4312) Signature is not getting inserted into 00000 area

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr edited comment on PDFBOX-4312 at 9/20/18 4:05 AM:
--

So I was able to reproduce the effect, see attached files. This 1.8 source code
{code:java}
    public void saveIncremental( String fileName ) throws IOException, 
COSVisitorException
    {
    saveIncremental(new BufferedInputStream(new FileInputStream(fileName)), 
    new BufferedOutputStream(new FileOutputStream(fileName, true)));
    }
{code}
is suspicious, because one is writing on the same file than the one where one 
is writing, but I'm not sure if the writing start offset is really correct.


was (Author: tilman):
So I was able to reproduce the effect, see attached files. This code
{code:java}
    public void saveIncremental( String fileName ) throws IOException, 
COSVisitorException
    {
    saveIncremental(new BufferedInputStream(new FileInputStream(fileName)), 
    new BufferedOutputStream(new FileOutputStream(fileName, true)));
    }
{code}
is suspicious, because one is writing on the same file than the one where one 
is writing, but I'm not sure if the writing start offset is really correct.

> Signature is not getting inserted into 0 area
> -
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Bug
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature-signed-SaveIncremental-1param-bad-cutoff.pdf, 
> testingSignature-signed-SaveIncremental-2param-good.pdf, 
> testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Updated] (PDFBOX-4312) Signature is not getting inserted into 00000 area

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr updated PDFBOX-4312:

Summary: Signature is not getting inserted into 0 area  (was: byte 
array format to pass to sign method)

> Signature is not getting inserted into 0 area
> -
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Bug
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature-signed-SaveIncremental-1param-bad-cutoff.pdf, 
> testingSignature-signed-SaveIncremental-2param-good.pdf, 
> testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Updated] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr updated PDFBOX-4312:

Issue Type: Bug  (was: Wish)

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Bug
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature-signed-SaveIncremental-1param-bad-cutoff.pdf, 
> testingSignature-signed-SaveIncremental-2param-good.pdf, 
> testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



Build failed in Jenkins: PDFBox-sonar #573

2018-09-19 Thread Apache Jenkins Server
See 

--
[...truncated 5.65 KB...]
at hudson.FilePath.act(FilePath.java:1025)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:937)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:864)
at hudson.scm.SCM.checkout(SCM.java:504)
at 
hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
at 
hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
at 
jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at 
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
at hudson.model.Run.execute(Run.java:1794)
at 
hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
at 
hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Caused: hudson.remoting.ProxyException: java.io.IOException
at 
hudson.scm.subversion.UpdateUpdater$TaskImpl.perform(UpdateUpdater.java:216)
at 
hudson.scm.subversion.WorkspaceUpdater$UpdateTask.delegateTo(WorkspaceUpdater.java:168)
at 
hudson.scm.SubversionSCM$CheckOutTask.perform(SubversionSCM.java:1041)
at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:1017)
at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:990)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2918)
at hudson.remoting.UserRequest.perform(UserRequest.java:212)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:369)
at 
hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused: java.io.IOException: remote file operation failed: 
 at 
hudson.remoting.Channel@151643a6:H33
at hudson.FilePath.act(FilePath.java:1043)
at hudson.FilePath.act(FilePath.java:1025)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:937)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:864)
at hudson.scm.SCM.checkout(SCM.java:504)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
at 
hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at 
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
at hudson.model.Run.execute(Run.java:1794)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Retrying after 10 seconds
Cleaning up 
ERROR: Failed to update http://svn.apache.org/repos/asf/pdfbox/trunk
org.tmatesoft.svn.core.SVNException: svn: E155032: The pristine text with 
checksum '$sha1$0d8a658d1ecd3fa00dd8f46d24a9d2fdef18f3e4' was found in the DB 
but not on disk
at 
org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:70)
at 
org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:57)
at 
org.tmatesoft.svn.core.internal.wc17.db.SvnWcDbPristines.checkPristine(SvnWcDbPristines.java:159)
at 
org.tmatesoft.svn.core.internal.wc17.db.SvnWcDbPristines.getPristinePath(SvnWcDbPristines.java:184)
at 
org.tmatesoft.svn.core.internal.wc17.db.SVNWCDb.getPristinePath(SVNWCDb.java:1724)
at 
org.tmatesoft.svn.core.internal.wc17.SVNWCContext.isTextModified(SVNWCContext.java:754)
at 
org.tmatesoft.svn.core.internal.wc17.SVNStatusEditor17.assembleStatus(SVNStatusEditor17.java:356)
at 
org.tmatesoft.svn.core.internal.wc17.SVNStatusEditor17.sendStatusStructure(SVNStatusEditor17.java:216)
at 
org.tmatesoft.svn.core.internal.wc17.SVNStatusEditor17.getDirStatus(SVNStatusEditor17.java:742)
at 
org.tmatesoft.svn.core.internal.wc17.SVNStatusEditor17.walkStatus(SVNStatusEditor17.java:665)
at 
org.tmatesoft.svn.core.internal.wc2.ng.SvnNgGetStatus.run(SvnNgGetStatus.java:132)
at 
org.tmatesoft.svn.core.internal.wc2.ng.SvnNgGetStatus.run(SvnNgGetStatus.java:27)
at 
org.tmatesoft.svn.core.internal.wc2.ng.SvnNgOperationRunner.run(SvnNgOperationRunner.java:20)
at 

[jira] [Commented] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr commented on PDFBOX-4312:
-

This code seems to work... the problem is something with the append mode of 
FileOutputStream. So use the code below, or the long code I posted earlier 
today.

{code:java}
    public void saveIncrementalNEW( String fileName ) throws IOException, 
COSVisitorException
    {
    FileInputStream fis = new FileInputStream(fileName);
    byte[] ba = IOUtils.toByteArray(fis);
    fis.close();
    FileOutputStream fos = new FileOutputStream(fileName);
    fos.write(ba);
    fis = new FileInputStream(fileName);    
    saveIncremental(fis, fos);
    }{code}

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature-signed-SaveIncremental-1param-bad-cutoff.pdf, 
> testingSignature-signed-SaveIncremental-2param-good.pdf, 
> testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Comment Edited] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr edited comment on PDFBOX-4312 at 9/19/18 7:25 PM:
--

So I was able to reproduce the effect, see attached files. This code
{code:java}
    public void saveIncremental( String fileName ) throws IOException, 
COSVisitorException
    {
    saveIncremental(new BufferedInputStream(new FileInputStream(fileName)), 
    new BufferedOutputStream(new FileOutputStream(fileName, true)));
    }
{code}
is suspicious, because one is writing on the same file than the one where one 
is writing, but I'm not sure if the writing start offset is really correct.


was (Author: tilman):
So I was able to reproduce the effect, see attached files. This code
{code:java}
    public void saveIncremental( String fileName ) throws IOException, 
COSVisitorException
    {
    saveIncremental(new BufferedInputStream(new FileInputStream(fileName)), 
    new BufferedOutputStream(new FileOutputStream(fileName, true)));
    }
{code}
is suspicious, because one is writing on the same file than the one where one 
is writing, but I'm not sure if the writing start offset is really correct. 
Likely the solution would be to read the input into a buffer first and to pass 
that one.

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature-signed-SaveIncremental-1param-bad-cutoff.pdf, 
> testingSignature-signed-SaveIncremental-2param-good.pdf, 
> testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Comment Edited] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr edited comment on PDFBOX-4312 at 9/19/18 6:35 PM:
--

So I was able to reproduce the effect, see attached files. This code
{code:java}
    public void saveIncremental( String fileName ) throws IOException, 
COSVisitorException
    {
    saveIncremental(new BufferedInputStream(new FileInputStream(fileName)), 
    new BufferedOutputStream(new FileOutputStream(fileName, true)));
    }
{code}
is suspicious, because one is writing on the same file than the one where one 
is writing, but I'm not sure if the writing start offset is really correct. 
Likely the solution would be to read the input into a buffer first and to pass 
that one.


was (Author: tilman):
So I was able to reproduce the effect, see attached files. This code
{code:java}
    public void saveIncremental( String fileName ) throws IOException, 
COSVisitorException
    {
    saveIncremental(new BufferedInputStream(new FileInputStream(fileName)), 
    new BufferedOutputStream(new FileOutputStream(fileName, true)));
    }
{code}
is suspicious, because one is writing on the same file than the one where one 
is writing, but I'm not sure is the writing start offset is really correct. 
Likely the solution would be to read the input into a buffer first and to pass 
that one.

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature-signed-SaveIncremental-1param-bad-cutoff.pdf, 
> testingSignature-signed-SaveIncremental-2param-good.pdf, 
> testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr commented on PDFBOX-4312:
-

Note that even if I fix the (probable) bug, you'll still have the problem I 
mentioned several days ago, i.e. you can only pass your file to the external 
service in {{sign()}}, not before.

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature-signed-SaveIncremental-1param-bad-cutoff.pdf, 
> testingSignature-signed-SaveIncremental-2param-good.pdf, 
> testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Comment Edited] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr edited comment on PDFBOX-4312 at 9/19/18 6:22 PM:
--

So I was able to reproduce the effect, see attached files. This code
{code:java}
    public void saveIncremental( String fileName ) throws IOException, 
COSVisitorException
    {
    saveIncremental(new BufferedInputStream(new FileInputStream(fileName)), 
    new BufferedOutputStream(new FileOutputStream(fileName, true)));
    }
{code}
is suspicious, because one is writing on the same file than the one where one 
is writing, but I'm not sure is the writing start offset is really correct. 
Likely the solution would be to read the input into a buffer first and to pass 
that one.


was (Author: tilman):
So I was able to reproduce the effect. This code
{code:java}
    public void saveIncremental( String fileName ) throws IOException, 
COSVisitorException
    {
    saveIncremental(new BufferedInputStream(new FileInputStream(fileName)), 
    new BufferedOutputStream(new FileOutputStream(fileName, true)));
    }
{code}
is suspicious, because one is writing on the same file than the one where one 
is writing, but I'm not sure is the writing start offset is really correct. 
Likely the solution would be to read the input into a buffer first and to pass 
that one.

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature-signed-SaveIncremental-1param-bad-cutoff.pdf, 
> testingSignature-signed-SaveIncremental-2param-good.pdf, 
> testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr commented on PDFBOX-4312:
-

So I was able to reproduce the effect. This code
{code:java}
    public void saveIncremental( String fileName ) throws IOException, 
COSVisitorException
    {
    saveIncremental(new BufferedInputStream(new FileInputStream(fileName)), 
    new BufferedOutputStream(new FileOutputStream(fileName, true)));
    }
{code}
is suspicious, because one is writing on the same file than the one where one 
is writing, but I'm not sure is the writing start offset is really correct. 
Likely the solution would be to read the input into a buffer first and to pass 
that one.

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature-signed-SaveIncremental-1param-bad-cutoff.pdf, 
> testingSignature-signed-SaveIncremental-2param-good.pdf, 
> testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Updated] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr updated PDFBOX-4312:

Attachment: testingSignature-signed-SaveIncremental-1param-bad-cutoff.pdf
testingSignature-signed-SaveIncremental-2param-good.pdf

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature-signed-SaveIncremental-1param-bad-cutoff.pdf, 
> testingSignature-signed-SaveIncremental-2param-good.pdf, 
> testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr commented on PDFBOX-4312:
-

TODO for me:
 * check whether saveIncrementtal (filename) works at all, it seems that it 
doesn't
 * document stream type in 1.8 (jpeg only)

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr commented on PDFBOX-4312:
-

{quote}{color:#33}yet my signature in not inserting in the blankbox please 
guide me it's very important to me to solve this issue .{color}
{quote}
{color:#33}indeed. It is still 0.{color}

{color:#33}1) Your file looks as if you called save(). I wonder if 
saveIncremental(filename) works at all (your file is also cut off at the end), 
our examples use the two parameter method. Make sure that the output file name 
is not identical to the input file name.{color}

 
{code:java}

  public File signPDF(File document) throws IOException, COSVisitorException,
  SignatureException
  {
    byte[] buffer = new byte[8 * 1024];
    if (document == null || !document.exists())
    {
    new RuntimeException("Document for signing does not exist");
    }
    // creating output document and prepare the IO streams.
    String name = document.getName();
    String substring = name.substring(0, name.lastIndexOf("."));
    
    File outputDocument = new File(document.getParent(), 
substring+"_signed.pdf");
    FileInputStream fis = new FileInputStream(document);
    FileOutputStream fos = new FileOutputStream(outputDocument);
    int c;
    while ((c = fis.read(buffer)) != -1)
    {
  fos.write(buffer, 0, c);
    }
    fis.close();
    fis = new FileInputStream(outputDocument);

…
…

  PDDocument doc = PDDocument.loadNonSeq(document, randomAccessFile);
  
  // create signature dictionary
  PDSignature signature = new PDSignature();
  signature.setFilter(PDSignature.FILTER_ADOBE_PPKLITE); // default filter
  // subfilter for basic and PAdES Part 2 signatures
  signature.setSubFilter(PDSignature.SUBFILTER_ADBE_PKCS7_DETACHED);
  signature.setName("signer name");
  signature.setLocation("signer location");
  signature.setReason("reason for signature");
  
  // the signing date, needed for valid signature
  signature.setSignDate(Calendar.getInstance());
  
  // register signature dictionary and sign interface
  if (options==null)
  {
    doc.addSignature(signature, this);
  } 
  else 
  {
    doc.addSignature(signature, this, options);
  }
  
  // write incremental (only for signing purpose)
  doc.saveIncremental(fis, fos);
{code}
{color:#33}2) Your image is a png image. Please pass a jpeg image. This is 
not documented, sadly.{color}

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (PDFBOX-4184) [PATCH]: Support simple lossless compression of 16 bit RGB images

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr commented on PDFBOX-4184:
-

I committed it anyway, still without the equality test which we didn't have 
before either.

A possible explanation is that converting from RGB to CMYK and back is not 
always perfect. Maybe use the code that you had commented?

> [PATCH]: Support simple lossless compression of 16 bit RGB images
> -
>
> Key: PDFBOX-4184
> URL: https://issues.apache.org/jira/browse/PDFBOX-4184
> Project: PDFBox
>  Issue Type: Improvement
>  Components: Writing
>Affects Versions: 2.0.9
>Reporter: Emmeran Seehuber
>Priority: Minor
> Fix For: 2.0.12, 3.0.0 PDFBox
>
> Attachments: 16bit.png, LoadGovdocs.java, fix_profile_use.patch, 
> fix_profile_use3.patch, fix_profile_use4.patch, images.zip, 
> lossless_predictor_based_imageencoding.patch, 
> lossless_predictor_based_imageencoding_v2.patch, 
> lossless_predictor_based_imageencoding_v3.patch, 
> lossless_predictor_based_imageencoding_v4.patch, 
> lossless_predictor_based_imageencoding_v5.patch, 
> lossless_predictor_based_imageencoding_v6.patch, 
> pdfbox_support_16bit_image_write.patch, png16-arrow-bad-no-smask.pdf, 
> png16-arrow-bad.pdf, png16-arrow-good-no-mask.pdf, png16-arrow-good.pdf, 
> size_compare.txt
>
>
> The attached patch add support to write 16 bit per component images 
> correctly. I've integrated a test for this here: 
> [https://github.com/rototor/pdfbox-graphics2d/commit/8bf089cb74945bd4f0f15054754f51dd5b361fe9]
> It only supports 16-Bit TYPE_CUSTOM with DataType == USHORT images - but this 
> is what you usually get when you read a 16 bit PNG file.
> This would also fix [https://github.com/danfickle/openhtmltopdf/issues/173].
> The patch is against 2.0.9, but should apply to 3.0.0 too.
> There is still some room for improvements when writing lossless images, as 
> the images are currently not efficiently encoded. I.e. you could use PNG 
> encodings to get a better compression. (By adding a COSName.DECODE_PARMS with 
> a COSName.PREDICTOR == 15 and encoding the images as PNG). But this is 
> something for a later patch. It would also need another API, as there is a 
> tradeoff speed vs compression ratio. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (PDFBOX-4184) [PATCH]: Support simple lossless compression of 16 bit RGB images

2018-09-19 Thread ASF subversion and git services (JIRA)


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

ASF subversion and git services commented on PDFBOX-4184:
-

Commit 1841354 from til...@apache.org in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1841354 ]

PDFBOX-4184: keep ICC colorspace + set alternate colorspace, by Emmeran Seehuber

> [PATCH]: Support simple lossless compression of 16 bit RGB images
> -
>
> Key: PDFBOX-4184
> URL: https://issues.apache.org/jira/browse/PDFBOX-4184
> Project: PDFBox
>  Issue Type: Improvement
>  Components: Writing
>Affects Versions: 2.0.9
>Reporter: Emmeran Seehuber
>Priority: Minor
> Fix For: 2.0.12, 3.0.0 PDFBox
>
> Attachments: 16bit.png, LoadGovdocs.java, fix_profile_use.patch, 
> fix_profile_use3.patch, fix_profile_use4.patch, images.zip, 
> lossless_predictor_based_imageencoding.patch, 
> lossless_predictor_based_imageencoding_v2.patch, 
> lossless_predictor_based_imageencoding_v3.patch, 
> lossless_predictor_based_imageencoding_v4.patch, 
> lossless_predictor_based_imageencoding_v5.patch, 
> lossless_predictor_based_imageencoding_v6.patch, 
> pdfbox_support_16bit_image_write.patch, png16-arrow-bad-no-smask.pdf, 
> png16-arrow-bad.pdf, png16-arrow-good-no-mask.pdf, png16-arrow-good.pdf, 
> size_compare.txt
>
>
> The attached patch add support to write 16 bit per component images 
> correctly. I've integrated a test for this here: 
> [https://github.com/rototor/pdfbox-graphics2d/commit/8bf089cb74945bd4f0f15054754f51dd5b361fe9]
> It only supports 16-Bit TYPE_CUSTOM with DataType == USHORT images - but this 
> is what you usually get when you read a 16 bit PNG file.
> This would also fix [https://github.com/danfickle/openhtmltopdf/issues/173].
> The patch is against 2.0.9, but should apply to 3.0.0 too.
> There is still some room for improvements when writing lossless images, as 
> the images are currently not efficiently encoded. I.e. you could use PNG 
> encodings to get a better compression. (By adding a COSName.DECODE_PARMS with 
> a COSName.PREDICTOR == 15 and encoding the images as PNG). But this is 
> something for a later patch. It would also need another API, as there is a 
> tradeoff speed vs compression ratio. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (PDFBOX-4184) [PATCH]: Support simple lossless compression of 16 bit RGB images

2018-09-19 Thread ASF subversion and git services (JIRA)


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

ASF subversion and git services commented on PDFBOX-4184:
-

Commit 1841355 from til...@apache.org in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1841355 ]

PDFBOX-4184: keep ICC colorspace + set alternate colorspace, by Emmeran Seehuber

> [PATCH]: Support simple lossless compression of 16 bit RGB images
> -
>
> Key: PDFBOX-4184
> URL: https://issues.apache.org/jira/browse/PDFBOX-4184
> Project: PDFBox
>  Issue Type: Improvement
>  Components: Writing
>Affects Versions: 2.0.9
>Reporter: Emmeran Seehuber
>Priority: Minor
> Fix For: 2.0.12, 3.0.0 PDFBox
>
> Attachments: 16bit.png, LoadGovdocs.java, fix_profile_use.patch, 
> fix_profile_use3.patch, fix_profile_use4.patch, images.zip, 
> lossless_predictor_based_imageencoding.patch, 
> lossless_predictor_based_imageencoding_v2.patch, 
> lossless_predictor_based_imageencoding_v3.patch, 
> lossless_predictor_based_imageencoding_v4.patch, 
> lossless_predictor_based_imageencoding_v5.patch, 
> lossless_predictor_based_imageencoding_v6.patch, 
> pdfbox_support_16bit_image_write.patch, png16-arrow-bad-no-smask.pdf, 
> png16-arrow-bad.pdf, png16-arrow-good-no-mask.pdf, png16-arrow-good.pdf, 
> size_compare.txt
>
>
> The attached patch add support to write 16 bit per component images 
> correctly. I've integrated a test for this here: 
> [https://github.com/rototor/pdfbox-graphics2d/commit/8bf089cb74945bd4f0f15054754f51dd5b361fe9]
> It only supports 16-Bit TYPE_CUSTOM with DataType == USHORT images - but this 
> is what you usually get when you read a 16 bit PNG file.
> This would also fix [https://github.com/danfickle/openhtmltopdf/issues/173].
> The patch is against 2.0.9, but should apply to 3.0.0 too.
> There is still some room for improvements when writing lossless images, as 
> the images are currently not efficiently encoded. I.e. you could use PNG 
> encodings to get a better compression. (By adding a COSName.DECODE_PARMS with 
> a COSName.PREDICTOR == 15 and encoding the images as PNG). But this is 
> something for a later patch. It would also need another API, as there is a 
> tradeoff speed vs compression ratio. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Comment Edited] (PDFBOX-4184) [PATCH]: Support simple lossless compression of 16 bit RGB images

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr edited comment on PDFBOX-4184 at 9/19/18 4:39 PM:
--

The cmyk test fails, there are many 1-differences like this if I modify the 
test so that it reports differences without failing:

 

expected:  but was: ;

expected:  but was: ;

expected:  but was: ;

expected:  but was: ;

expected:  but was: ;

This is not much but I wonder why it works for you. What OS and what Java are 
you using? I tested this on W10 with jdk8 latest.


was (Author: tilman):
The cmyk test fails, there are many 1-differences like this:

 

expected:  but was: ;

expected:  but was: ;

expected:  but was: ;

expected:  but was: ;

expected:  but was: ;

This is not much but I wonder why it works for you. What OS and what Java are 
you using? I tested this on W10 with jdk8 latest.

> [PATCH]: Support simple lossless compression of 16 bit RGB images
> -
>
> Key: PDFBOX-4184
> URL: https://issues.apache.org/jira/browse/PDFBOX-4184
> Project: PDFBox
>  Issue Type: Improvement
>  Components: Writing
>Affects Versions: 2.0.9
>Reporter: Emmeran Seehuber
>Priority: Minor
> Fix For: 2.0.12, 3.0.0 PDFBox
>
> Attachments: 16bit.png, LoadGovdocs.java, fix_profile_use.patch, 
> fix_profile_use3.patch, fix_profile_use4.patch, images.zip, 
> lossless_predictor_based_imageencoding.patch, 
> lossless_predictor_based_imageencoding_v2.patch, 
> lossless_predictor_based_imageencoding_v3.patch, 
> lossless_predictor_based_imageencoding_v4.patch, 
> lossless_predictor_based_imageencoding_v5.patch, 
> lossless_predictor_based_imageencoding_v6.patch, 
> pdfbox_support_16bit_image_write.patch, png16-arrow-bad-no-smask.pdf, 
> png16-arrow-bad.pdf, png16-arrow-good-no-mask.pdf, png16-arrow-good.pdf, 
> size_compare.txt
>
>
> The attached patch add support to write 16 bit per component images 
> correctly. I've integrated a test for this here: 
> [https://github.com/rototor/pdfbox-graphics2d/commit/8bf089cb74945bd4f0f15054754f51dd5b361fe9]
> It only supports 16-Bit TYPE_CUSTOM with DataType == USHORT images - but this 
> is what you usually get when you read a 16 bit PNG file.
> This would also fix [https://github.com/danfickle/openhtmltopdf/issues/173].
> The patch is against 2.0.9, but should apply to 3.0.0 too.
> There is still some room for improvements when writing lossless images, as 
> the images are currently not efficiently encoded. I.e. you could use PNG 
> encodings to get a better compression. (By adding a COSName.DECODE_PARMS with 
> a COSName.PREDICTOR == 15 and encoding the images as PNG). But this is 
> something for a later patch. It would also need another API, as there is a 
> tradeoff speed vs compression ratio. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (PDFBOX-4184) [PATCH]: Support simple lossless compression of 16 bit RGB images

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr commented on PDFBOX-4184:
-

The cmyk test fails, there are many 1-differences like this:

 

expected:  but was: ;

expected:  but was: ;

expected:  but was: ;

expected:  but was: ;

expected:  but was: ;

This is not much but I wonder why it works for you. What OS and what Java are 
you using? I tested this on W10 with jdk8 latest.

> [PATCH]: Support simple lossless compression of 16 bit RGB images
> -
>
> Key: PDFBOX-4184
> URL: https://issues.apache.org/jira/browse/PDFBOX-4184
> Project: PDFBox
>  Issue Type: Improvement
>  Components: Writing
>Affects Versions: 2.0.9
>Reporter: Emmeran Seehuber
>Priority: Minor
> Fix For: 2.0.12, 3.0.0 PDFBox
>
> Attachments: 16bit.png, LoadGovdocs.java, fix_profile_use.patch, 
> fix_profile_use3.patch, fix_profile_use4.patch, images.zip, 
> lossless_predictor_based_imageencoding.patch, 
> lossless_predictor_based_imageencoding_v2.patch, 
> lossless_predictor_based_imageencoding_v3.patch, 
> lossless_predictor_based_imageencoding_v4.patch, 
> lossless_predictor_based_imageencoding_v5.patch, 
> lossless_predictor_based_imageencoding_v6.patch, 
> pdfbox_support_16bit_image_write.patch, png16-arrow-bad-no-smask.pdf, 
> png16-arrow-bad.pdf, png16-arrow-good-no-mask.pdf, png16-arrow-good.pdf, 
> size_compare.txt
>
>
> The attached patch add support to write 16 bit per component images 
> correctly. I've integrated a test for this here: 
> [https://github.com/rototor/pdfbox-graphics2d/commit/8bf089cb74945bd4f0f15054754f51dd5b361fe9]
> It only supports 16-Bit TYPE_CUSTOM with DataType == USHORT images - but this 
> is what you usually get when you read a 16 bit PNG file.
> This would also fix [https://github.com/danfickle/openhtmltopdf/issues/173].
> The patch is against 2.0.9, but should apply to 3.0.0 too.
> There is still some room for improvements when writing lossless images, as 
> the images are currently not efficiently encoded. I.e. you could use PNG 
> encodings to get a better compression. (By adding a COSName.DECODE_PARMS with 
> a COSName.PREDICTOR == 15 and encoding the images as PNG). But this is 
> something for a later patch. It would also need another API, as there is a 
> tradeoff speed vs compression ratio. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread bal (JIRA)


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

bal commented on PDFBOX-4312:
-

please see the attached signed pdf i want to show only one name please suggest 
some solution on priority

 

!Screenshot (31).png!

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Updated] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread bal (JIRA)


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

bal updated PDFBOX-4312:

Attachment: Screenshot (31).png

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Updated] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread bal (JIRA)


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

bal updated PDFBOX-4312:

Attachment: Screenshot (31).png

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, Screenshot (31).png, 
> testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread bal (JIRA)


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

bal commented on PDFBOX-4312:
-

please find attached PDF  for reference. instead of signed by unknown i want to 
show signed by name of the person signing that document.  !Screenshot (30).png!

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, testingSignature.pdf, 
> testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Updated] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread bal (JIRA)


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

bal updated PDFBOX-4312:

Attachment: Screenshot (30).png

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: Screenshot (30).png, testingSignature.pdf, 
> testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Updated] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread bal (JIRA)


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

bal updated PDFBOX-4312:

Attachment: testingSignature.pdf

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



***UNCHECKED*** [jira] [Updated] (PDFBOX-4312) byte array format to pass to sign method

2018-09-19 Thread bal (JIRA)


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

bal updated PDFBOX-4312:

Attachment: testingSignature.pdf

> byte array format to pass to sign method
> 
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
>  Issue Type: Wish
>  Components: .NET, PDModel, Signing
>Affects Versions: 1.8.9
>Reporter: bal
>Priority: Major
> Attachments: testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (PDFBOX-4184) [PATCH]: Support simple lossless compression of 16 bit RGB images

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr commented on PDFBOX-4184:
-

If you try something with the cache, please create a new issue, release is 
expected next week (build on WE).

Contrary to what I wrote, only the CMYK test needs an ICC space, so most users 
won't have a size difference, only users "like you" who create BufferedImages 
in an advanced way.

If somebody hits the problem in the new release, the workaround is easy - just 
replace the colorspace with a common object.

> [PATCH]: Support simple lossless compression of 16 bit RGB images
> -
>
> Key: PDFBOX-4184
> URL: https://issues.apache.org/jira/browse/PDFBOX-4184
> Project: PDFBox
>  Issue Type: Improvement
>  Components: Writing
>Affects Versions: 2.0.9
>Reporter: Emmeran Seehuber
>Priority: Minor
> Fix For: 2.0.12, 3.0.0 PDFBox
>
> Attachments: 16bit.png, LoadGovdocs.java, fix_profile_use.patch, 
> fix_profile_use3.patch, fix_profile_use4.patch, images.zip, 
> lossless_predictor_based_imageencoding.patch, 
> lossless_predictor_based_imageencoding_v2.patch, 
> lossless_predictor_based_imageencoding_v3.patch, 
> lossless_predictor_based_imageencoding_v4.patch, 
> lossless_predictor_based_imageencoding_v5.patch, 
> lossless_predictor_based_imageencoding_v6.patch, 
> pdfbox_support_16bit_image_write.patch, png16-arrow-bad-no-smask.pdf, 
> png16-arrow-bad.pdf, png16-arrow-good-no-mask.pdf, png16-arrow-good.pdf, 
> size_compare.txt
>
>
> The attached patch add support to write 16 bit per component images 
> correctly. I've integrated a test for this here: 
> [https://github.com/rototor/pdfbox-graphics2d/commit/8bf089cb74945bd4f0f15054754f51dd5b361fe9]
> It only supports 16-Bit TYPE_CUSTOM with DataType == USHORT images - but this 
> is what you usually get when you read a 16 bit PNG file.
> This would also fix [https://github.com/danfickle/openhtmltopdf/issues/173].
> The patch is against 2.0.9, but should apply to 3.0.0 too.
> There is still some room for improvements when writing lossless images, as 
> the images are currently not efficiently encoded. I.e. you could use PNG 
> encodings to get a better compression. (By adding a COSName.DECODE_PARMS with 
> a COSName.PREDICTOR == 15 and encoding the images as PNG). But this is 
> something for a later patch. It would also need another API, as there is a 
> tradeoff speed vs compression ratio. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Resolved] (PDFBOX-4306) Image clipping area rounding error

2018-09-19 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr resolved PDFBOX-4306.
-
Resolution: Fixed
  Assignee: Tilman Hausherr

> Image clipping area rounding error
> --
>
> Key: PDFBOX-4306
> URL: https://issues.apache.org/jira/browse/PDFBOX-4306
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.11
>Reporter: Daniel Persson
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.12, 3.0.0 PDFBox
>
> Attachments: page-1.pdf, page-2.pdf, patch.diff, patch2.diff, test.jpg
>
>
> Creating images with PDFBox and merging them together when you have two pages 
> that connect will create a white line between the images.
> We have looked into the issue and tried to fix it and found that the clipping 
> area is a bit to tight so the images will not be rendered correctly. My guess 
> is that this is due to a rounding error when using floats. 
> Most of the graphics functions in java use double precision and PDFBox uses 
> floats so when using layer upon layer of bounding boxes intersecting the 
> clipping area it might get skewed to a bad bounding box.
> I've added a patch to this issue with the code we use as a workaround today. 
> It's by no means the final solution to the problem but it resolves the white 
> line issue.
> To be sure that you get the error when generating the images use the 
> following command
> ```
> java -jar pdfbox-app-3.0.0-SNAPSHOT.jar PDFToImage -dpi 150 -quality 0.95 
> -format jpg page-1.pdf
> ```
> We run java 8 on our machines.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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