[jira] [Commented] (PDFBOX-5346) PDFBox 2.0.12 | Regarding log4j 0 day vulnerability

2021-12-16 Thread Amit Maheshwari (Jira)


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

Amit Maheshwari commented on PDFBOX-5346:
-

Thanks a lot [~lehmi] .

Sure, we will take care to post our query in right medium

> PDFBox 2.0.12 | Regarding log4j 0 day vulnerability
> ---
>
> Key: PDFBOX-5346
> URL: https://issues.apache.org/jira/browse/PDFBOX-5346
> Project: PDFBox
>  Issue Type: Task
>Affects Versions: 2.0.12
>Reporter: Amit Maheshwari
>Priority: Critical
>
> We are using PDFBox 2.0.12 in our software.
> We found that 'commons logging' is dependency of PDFBox and Log4J is 
> dependency of commons logging.
> We have not done any explicit configuration for log4j, in that case, will the 
> PDFBox or Commons Logging will consume Log4J solution by any chance?
> If yes, what is recommendation of avoiding it (and any possibility to 
> compromise due to 0 day vulnerability present in Log4J in 2.0.12)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-5346) PDFBox 2.0.12 | Regarding log4j 0 day vulnerability

2021-12-16 Thread Jira


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

Andreas Lehmkühler commented on PDFBOX-5346:


First of all, you should update to a more recent PDFBox version. We've just 
released 2.0.25

Log4J2 is not a dependency of commons logging, see 
[pom.xml|https://github.com/apache/commons-logging/blob/master/pom.xml]

{noformat}

  log4j
  log4j
  1.2.17
  true

{noformat}

That dependency is optional and furthermore it references log4j 1.2.17 which 
isn't affected by the log4shell issue.

Commons-logging is a wrapper for different logging-framewroks and the users 
decides which one to use by adding it to the classpath

BTW: this is a bug tracker and such queries belong to our [mailing 
list|https://pdfbox.apache.org/mailinglists.html]


> PDFBox 2.0.12 | Regarding log4j 0 day vulnerability
> ---
>
> Key: PDFBOX-5346
> URL: https://issues.apache.org/jira/browse/PDFBOX-5346
> Project: PDFBox
>  Issue Type: Task
>Affects Versions: 2.0.12
>Reporter: Amit Maheshwari
>Priority: Critical
>
> We are using PDFBox 2.0.12 in our software.
> We found that 'commons logging' is dependency of PDFBox and Log4J is 
> dependency of commons logging.
> We have not done any explicit configuration for log4j, in that case, will the 
> PDFBox or Commons Logging will consume Log4J solution by any chance?
> If yes, what is recommendation of avoiding it (and any possibility to 
> compromise due to 0 day vulnerability present in Log4J in 2.0.12)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



Re: [VOTE] Release Apache PDFBox 2.0.25

2021-12-16 Thread Andreas Lehmkuehler

Am 15.12.21 um 17:39 schrieb Tilman Hausherr:

Am 15.12.2021 um 12:31 schrieb Tilman Hausherr:

I ran Tim's regression tests and here are the results:
https://home.snafu.de/tilman/tmp/reports_pdfbox_2.0.24_vs_2.0.25.tar.xz
Thanks Tilman, especially as I totally forgot to ask if someone has the time to 
run those tests.




I have not yet investigated whether there are regressions. We have a 57% 
increase in tokens and 8% increase in common tokens. Probably thanks to

https://issues.apache.org/jira/browse/PDFBOX-5324
https://issues.apache.org/jira/browse/PDFBOX-5331



We have lots of files that extract trash. Some "common tokens" are "lost" 
because the "new trash" is connected to the token.
I've expected such results. Most likely changes like the above mentioned ones 
have two side of a coin. There are a lot of improvements but more or less "false 
positives" as well. IMHO that's ok.



There is one real regression, that's the file

bug_trackers/poppler/poppler-89422-0.pdf

https://bugs.freedesktop.org/show_bug.cgi?id=89422

but this isn't a real world file so it isn't THAT important. I tried to fix it 
but failed for now.

I agree, it is a corner case and already fixed :-)



Tilman





Tilman


Am 13.12.2021 um 20:02 schrieb Andreas Lehmkuehler:

Hi,

a candidate for the PDFBox 2.0.25 release is available at:

    https://dist.apache.org/repos/dist/dev/pdfbox/2.0.25/

The release candidate is a zip archive of the sources in:

    http://svn.apache.org/repos/asf/pdfbox/tags/2.0.25/

The SHA-512 checksum of the archive is 
e143b2a9aaa4b1f1be72e16a1c9968dacfcb3e89b4f21fdbd0580d8c9f1c9b54ee38d05fe3e52ff93493c858c51090fdd8256d22153cffba1e9b523fdbd1f2f4. 



Please vote on releasing this package as Apache PDFBox 2.0.25.
The vote is open for the next 72 hours and passes if a majority of at
least three +1 PDFBox PMC votes are cast.

    [ ] +1 Release this package as Apache PDFBox 2.0.25
    [ ] -1 Do not release this package because...

Here is my +1

Andreas

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




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




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




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



[ANNOUNCE] Apache PDFBox 2.0.25 released

2021-12-16 Thread Andreas Lehmkuehler

The Apache PDFBox community is pleased to announce the release of
Apache PDFBox version 2.0.25. The release is available for download at:

https://pdfbox.apache.org/download.html

See the full release notes below for details about this release.

Release Notes -- Apache PDFBox -- Version 2.0.25

Introduction


The Apache PDFBox library is an open source Java tool for working with PDF 
documents.


This is an incremental bugfix release based on the earlier 2.0.24 release. It 
contains

a couple of fixes and small improvements.

For more details on these changes and all the other fixes and improvements
included in this release, please refer to the following issues on the
PDFBox issue tracker at https://issues.apache.org/jira/browse/PDFBOX.

Bug

[PDFBOX-5228] - ArrayIndexOutOfBoundsException: arraycopy: length -2 is negative 
 in PDPanose.getPanose

[PDFBOX-5232] - LayerUtility().importPageAsForm() doesn't return
[PDFBOX-5236] - PDPageContentStream.setLineWidth(float) not allowed in text 
block
[PDFBOX-5240] - preflight SMask entry check incorrect
[PDFBOX-5257] - NumberFormatException in merge if fieldname is 
"dummyFieldName1#1"
[PDFBOX-5264] - FDFJavaScript.getDoc() always returns null or empty
[PDFBOX-5266] - Annotation shown with thick border
[PDFBOX-5271] - Deeply nested drawings not shown
[PDFBOX-5274] - Not existing rectangle appears on page image
[PDFBOX-5275] - Not rendered (white) pages for given pdf
[PDFBOX-5276] - Encryption on Split documents
[PDFBOX-5278] - PDPage.getAnnotations() causes subsequent calls to 
PDDocument.getPages() to fail
[PDFBOX-5281] - Error rendering png from PDF - Error at Type1Parser parseBinary 
for Type 1 Font

[PDFBOX-5285] - EOFException during TTF parsing
[PDFBOX-5294] - Incorrect rendering of Type3 character
[PDFBOX-5297] - class org.apache.pdfbox.cos.COSName cannot be cast to class 
org.apache.pdfbox.cos.COSString

[PDFBOX-5298] - unneeded / double code in PageExtractor
[PDFBOX-5302] - When PDF is converted to an image, the image has a large black 
rectangle.

[PDFBOX-5310] - Slow rendering for specific PDF File with small chunks 16x8
[PDFBOX-5312] - Decryption for V4 fails when no Length entry is set in 
Encryption Dictionary
[PDFBOX-5313] - `NullPointerException` when intersecting area with null clipping 
path

[PDFBOX-5315] - Stack overflow in PDColorSpace.create()
[PDFBOX-5317] - Splitter: Problematic /Info causes big files
[PDFBOX-5318] - Resolution of ambiguities in inline images don't follow the 
standard
[PDFBOX-5321] - Silent fail of PDTextField.setValue when font encoding missing
[PDFBOX-5326] - TTFSubsetter incorrectly calculating 'searchRange'
[PDFBOX-5328] - Failing to get multiple encodings from cmap table
[PDFBOX-5331] - Text "820-01869-U-A" is omitted from PDF doc
[PDFBOX-5333] - Wrong number of fonts leads to OOM-Exception

New Feature

[PDFBOX-5314] - Additional `showTransparencyGroupOnGraphics()` method

Improvement

[PDFBOX-5224] - Optimize SampledImageReader.from1Bit()
[PDFBOX-5229] - Optimize reading of masked images
[PDFBOX-5239] - Support BGR for OpenCV and JavaCV
[PDFBOX-5254] - Preserve indirect object reference when copying resources
[PDFBOX-5256] - PDFBox should use the quadding for fields with the comb flag
[PDFBOX-5258] - Lazier clipping
[PDFBOX-5267] - LegacyPDFStreamEngine.glyphList loaded from disk on each 
instantiation rather than static final?
[PDFBOX-5308] - Prefer MergeSort over QuickSort and try native TimSort first 
(with explanation)

[PDFBOX-5319] - Avoid creating Paint objects and filling when there is nothing 
to do
[PDFBOX-5324] - support get unicode from embedded TrueTypeFont cmap
[PDFBOX-5336] - Update liberation fonts

Test

[PDFBOX-5244] - Add test for double visible signature on the same page

Task

[PDFBOX-5215] - Add test for double visible signature on encrypted file
[PDFBOX-5287] - Add test for comb fields adjustment
[PDFBOX-5293] - Store x and y scaling factor
[PDFBOX-5340] - Update CCITTFaxDecoderStream.java from twelvemonkeys (3)

Sub-task

[PDFBOX-5277] - Add print dpi submenu
[PDFBOX-5320] - Reduce HighResolutionImageIcons memory leaks

Release Contents


This release consists of a single source archive packaged as a zip file.
The archive can be unpacked with the jar tool from your JDK installation.
See the README.txt file for instructions on how to build this release.

The source archive is accompanied by a SHA512 checksum and a PGP signature
that you can use to verify the authenticity of your download.
The public key used for the PGP signature can be found at
https://www.apache.org/dist/pdfbox/KEYS.

About Apache PDFBox
---

Apache PDFBox is an open source Java library for working with PDF documents.
This project allows creation of new PDF documents, manipulation of existing
documents and the ability to extract content from documents. Apache PDFBox
also includes several command line utilities. Apache PDFBox is published
under the Apache License, Version 2.0.

For 

[jira] [Updated] (PDFBOX-5346) PDFBox 2.0.12 | Regarding log4j 0 day vulnerability

2021-12-16 Thread Amit Maheshwari (Jira)


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

Amit Maheshwari updated PDFBOX-5346:

Description: 
We are using PDFBox 2.0.12 in our software.

We found that 'commons logging' is dependency of PDFBox and Log4J is dependency 
of commons logging.

We have not done any explicit configuration for log4j, in that case, will the 
PDFBox or Commons Logging will consume Log4J solution by any chance?

If yes, what is recommendation of avoiding it (and any possibility to 
compromise due to 0 day vulnerability present in Log4J in 2.0.12)

  was:
We are using PDFBox 2.0.12 in our software.

We found that 'commons logging' is dependency of PDFBox and Log4J is dependency 
of commons logging.

We have not done any explicit configuration for log4j, in that case, will the 
PDFBox or Commons Logging will consume Log4J solution by any chance?

If yes, what is recommendation of avoiding it (and any possibility to 
compromise due to 0 day vulnerability present in Log4J in older versions)


> PDFBox 2.0.12 | Regarding log4j 0 day vulnerability
> ---
>
> Key: PDFBOX-5346
> URL: https://issues.apache.org/jira/browse/PDFBOX-5346
> Project: PDFBox
>  Issue Type: Task
>Affects Versions: 2.0.12
>Reporter: Amit Maheshwari
>Priority: Critical
>
> We are using PDFBox 2.0.12 in our software.
> We found that 'commons logging' is dependency of PDFBox and Log4J is 
> dependency of commons logging.
> We have not done any explicit configuration for log4j, in that case, will the 
> PDFBox or Commons Logging will consume Log4J solution by any chance?
> If yes, what is recommendation of avoiding it (and any possibility to 
> compromise due to 0 day vulnerability present in Log4J in 2.0.12)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Created] (PDFBOX-5346) PDFBox 2.0.12 | Regarding log4j 0 day vulnerability

2021-12-16 Thread Amit Maheshwari (Jira)
Amit Maheshwari created PDFBOX-5346:
---

 Summary: PDFBox 2.0.12 | Regarding log4j 0 day vulnerability
 Key: PDFBOX-5346
 URL: https://issues.apache.org/jira/browse/PDFBOX-5346
 Project: PDFBox
  Issue Type: Task
Affects Versions: 2.0.12
Reporter: Amit Maheshwari


We are using PDFBox 2.0.12 in our software.

We found that 'commons logging' is dependency of PDFBox and Log4J is dependency 
of commons logging.

We have not done any explicit configuration for log4j, in that case, will the 
PDFBox or Commons Logging will consume Log4J solution by any chance?

If yes, what is recommendation of avoiding it (and any possibility to 
compromise due to 0 day vulnerability present in Log4J in older versions)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Tilman Hausherr (Jira)


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

Tilman Hausherr commented on PDFBOX-5343:
-

Here's code that creates a push button with an image. The position is set only 
in the widget rectangle, not in the BBox and not in the content stream.
{code}
PDDocument doc = new PDDocument();
PDPage page = new PDPage();
doc.addPage(page);
PDAcroForm acroForm = new PDAcroForm(doc);
doc.getDocumentCatalog().setAcroForm(acroForm);
PDPushButton pushButton = new PDPushButton(acroForm);
pushButton.setPartialName("push");

acroForm.getFields().add(pushButton);
PDAnnotationWidget widget = pushButton.getWidgets().get(0);
page.getAnnotations().add(widget);
widget.setRectangle(new PDRectangle(50, 500, 100, 100)); // position on the page
widget.setPrinted(true);
widget.setPage(page);

PDActionJavaScript javascriptAction = new 
PDActionJavaScript("app.alert(\"button pressed\")");
PDAnnotationAdditionalActions actions = new PDAnnotationAdditionalActions();
actions.setU(javascriptAction);
widget.setActions(actions);

// Create a PDFormXObject
PDFormXObject form = new PDFormXObject(doc);
form.setResources(new PDResources());
form.setBBox(new PDRectangle(100, 100));
form.setFormType(1);

PDAppearanceDictionary appearanceDictionary = new PDAppearanceDictionary(new 
COSDictionary());
widget.setAppearance(appearanceDictionary);
PDAppearanceStream appearanceStream = new 
PDAppearanceStream(form.getCOSObject());
appearanceDictionary.setNormalAppearance(appearanceStream);

// Create the content stream
BufferedImage bim = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); // 
black
PDImageXObject image = LosslessFactory.createFromImage(doc, bim);
try (PDAppearanceContentStream cs = new 
PDAppearanceContentStream(appearanceStream))
{
cs.drawImage(image, 0, 0);
}

doc.save("button.pdf");
acroForm.flatten();
doc.save("button-flat.pdf");

doc.close();
{code}

> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Mohamed Sameem (Jira)


[ https://issues.apache.org/jira/browse/PDFBOX-5343 ]


Mohamed Sameem deleted comment on PDFBOX-5343:


was (Author: JIRAUSER281940):
CaN u correct it and send

> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Mohamed Sameem (Jira)


[ https://issues.apache.org/jira/browse/PDFBOX-5343 ]


Mohamed Sameem deleted comment on PDFBOX-5343:


was (Author: JIRAUSER281940):
U can use this pdf

On Wed, 15 Dec, 2021, 10:24 pm Mohamed Sameem, 



> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[RESULT][VOTE] Release Apache PDFBox 2.0.25

2021-12-16 Thread Andreas Lehmkuehler

Am 13.12.21 um 20:02 schrieb Andreas Lehmkuehler:

Please vote on releasing this package as Apache PDFBox 2.0.25.


   +1 Maruan Sahyoun
   +1 Tilman Hausherr
   +1 Timo Boehme
   +1 Andreas Lehmkühler

Thanks for your support and help!! I'm going to push the release out.

Andreas

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



Build failed in Jenkins: PDFBox » PDFBox-Trunk-jdk17 #451

2021-12-16 Thread Apache Jenkins Server
See 


Changes:

[Tilman Hausherr] PDFBOX-5345: use encryption dictionary length value, as 
suggested by Andreas Lehmkühler


--
Started by an SCM change
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Building remotely on H31 (ubuntu) in workspace 

Cleaning up 

Deleting 

Deleting 

Deleting 

Deleting 

Deleting 

Deleting 

Deleting 

Deleting 

Deleting 

Deleting 

Deleting 

Deleting 

Updating http://svn.apache.org/repos/asf/pdfbox/trunk at revision 
'2021-12-16T20:45:54.674 +' --quiet
At revision 1896072

Parsing POMs
Established TCP socket on 34725
maven35-agent.jar already up to date
maven35-interceptor.jar already up to date
maven3-interceptor-commons.jar already up to date
[PDFBox-Trunk-jdk17] $ /home/jenkins/tools/java/latest17/bin/java -cp 
/home/jenkins/maven35-agent.jar:/home/jenkins/tools/maven/apache-maven-3.6.3/boot/plexus-classworlds-2.6.0.jar:/home/jenkins/tools/maven/apache-maven-3.6.3/conf/logging
 jenkins.maven3.agent.Maven35Main /home/jenkins/tools/maven/apache-maven-3.6.3 
/home/jenkins/slave.jar /home/jenkins/maven35-interceptor.jar 
/home/jenkins/maven3-interceptor-commons.jar 34725
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program 
"/home/jenkins/tools/java/latest17/bin/java" (in directory 
": 
error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at hudson.Proc$LocalProc.(Proc.java:252)
at hudson.Proc$LocalProc.(Proc.java:221)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:996)
at hudson.Launcher$ProcStarter.start(Launcher.java:508)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1390)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1333)
at hudson.remoting.UserRequest.perform(UserRequest.java:211)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:376)
at 
hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to 
H31
at 
hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1800)
at 
hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
at hudson.remoting.Channel.call(Channel.java:1001)
at hudson.Launcher$RemoteLauncher.launch(Launcher.java:1121)
at hudson.Launcher$ProcStarter.start(Launcher.java:508)
at 
hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:280)
at hudson.maven.ProcessCache.get(ProcessCache.java:236)
at 
hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:802)
at 
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:513)
at hudson.model.Run.execute(Run.java:1906)
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 by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Me

[jira] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Mohamed Sameem (Jira)


[ https://issues.apache.org/jira/browse/PDFBOX-5343 ]


Mohamed Sameem deleted comment on PDFBOX-5343:


was (Author: JIRAUSER281940):
Yeah by default its a button, so i had to implement that way, i could share
yout the generic piece of code where i do , the thing is  image we paste
isn't persistent  after flattening.
The below is the script, ping me if u find anything wrong over here.
{code}
 PDNonTerminalField imageBoxes = (PDNonTerminalField) pdAcroForm.getField("#i");

  if (Objects.nonNull(imageBoxes)) {
imageBoxes
.getChildren()
.forEach(
x -> {
  PDPushButton pdNonTerminalFieldX = (PDPushButton) x;
  setField(
  pdNonTerminalFieldX,
  values.get(pdNonTerminalFieldX.getPartialName()),
  pdfDocument);
});
  }
  for (PDField field : pdAcroForm.getFieldTree()) {
field.setReadOnly(true);
  }
  pdfDocument.save(byteArrayOutputStream);
  pdfDocument.close();
  return byteArrayOutputStream.toByteArray();
} catch (Exception e) {
  log.error("exception caught while generating pdf: ", e);
  return null;
}
  }

  private static PDRectangle getFieldArea(PDAnnotationWidget
pdAnnotationWidget) {
COSDictionary fieldDict = pdAnnotationWidget.getCOSObject();
COSArray fieldAreaArray = (COSArray)
fieldDict.getDictionaryObject(COSName.RECT);
return new PDRectangle(fieldAreaArray);
  }

  private static void setField(PDField field, String value, PDDocument
pdfDocument) {
if (Objects.isNull(field)) {
  return;
}
try {
  if (field instanceof PDCheckBox) {
PDCheckBox checkbox = (PDCheckBox) field;
if (value.isEmpty()) {
  checkbox.unCheck();
} else {
  checkbox.check();
}
  } else if (field instanceof PDComboBox) {
field.setValue(value);
  } else if (field instanceof PDListBox) {
field.setValue(value);
  } else if (field instanceof PDRadioButton) {
field.setValue(value);
  } else if (field instanceof PDTextField) {
PDTextField textField = (PDTextField) field;
textField.setDefaultAppearance("/Helv 22 Tf 0 g");
textField.setValue(value);
  } else if (field instanceof PDPushButton) {
setImageField(field, value, pdfDocument);
  }
} catch (Exception e) {
  log.error("Failed to set value {} at field {}", value,
field.getFullyQualifiedName(), e);
}
  }

  static void setImageField(PDField field, String value, PDDocument pdfDocument)
  throws IOException {
if (StringUtils.isEmpty(value)) {
  return;
}
PDPushButton pdPushButton = (PDPushButton) field;
List widgets = pdPushButton.getWidgets();
byte[] byteArray = Base64.getDecoder().decode(value);
for (PDAnnotationWidget annotationWidget : widgets) {
  PDImageXObject pdImageXObject =
PDImageXObject.createFromByteArray(pdfDocument, byteArray,
field.getPartialName());
  float imageScaleRatio =
  (float) pdImageXObject.getHeight() / (float)
pdImageXObject.getWidth();
  PDRectangle buttonPosition = getFieldArea(annotationWidget);
  float height = buttonPosition.getHeight();
  float width = height / imageScaleRatio;
  float x = buttonPosition.getLowerLeftX();
  float y = buttonPosition.getLowerLeftY();
  PDAppearanceStream pdAppearanceStream = new
PDAppearanceStream(pdfDocument);
  pdAppearanceStream.setResources(new PDResources());
  try (PDPageContentStream pdPageContentStream =
  new PDPageContentStream(pdfDocument, pdAppearanceStream)) {
pdPageContentStream.drawImage(pdImageXObject, x, y, width, height);
  }
  pdAppearanceStream.setBBox(new PDRectangle(x, y, width, height));
  PDAppearanceDictionary pdAppearanceDictionary =
annotationWidget.getAppearance();
  if (pdAppearanceDictionary == null) {
pdAppearanceDictionary = new PDAppearanceDictionary();
annotationWidget.setAppearance(pdAppearanceDictionary);
  }
  pdAppearanceDictionary.setNormalAppearance(pdAppearanceStream);
}
  }
}
{code}

> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 

[jira] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Mohamed Sameem (Jira)


[ https://issues.apache.org/jira/browse/PDFBOX-5343 ]


Mohamed Sameem deleted comment on PDFBOX-5343:


was (Author: JIRAUSER281940):
Image relocation happened when i save the file using my mobile as pdf when
the forms get disappears.

On Wed, 15 Dec, 2021, 10:49 pm Mohamed Sameem, 



> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Mohamed Sameem (Jira)


[ https://issues.apache.org/jira/browse/PDFBOX-5343 ]


Mohamed Sameem deleted comment on PDFBOX-5343:


was (Author: JIRAUSER281940):
Ok wait a minute

On Wed, 15 Dec, 2021, 10:38 pm Tilman Hausherr (Jira), 



> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Mohamed Sameem (Jira)


[ https://issues.apache.org/jira/browse/PDFBOX-5343 ]


Mohamed Sameem deleted comment on PDFBOX-5343:


was (Author: JIRAUSER281940):
Please look into priority as i have already deployed code for millions of
customers, where i entrusted pdfbox where my manager suggested itextpdf as
alternative .

On Wed, 15 Dec, 2021, 10:25 pm Mohamed Sameem, 



> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Mohamed Sameem (Jira)


[ https://issues.apache.org/jira/browse/PDFBOX-5343 ]


Mohamed Sameem deleted comment on PDFBOX-5343:


was (Author: JIRAUSER281940):
I store the images in Pddbutton ,when the forms disappear the images have
no proper coordinates and relocate i guess. Is there any solution for this
to save the image cordinates

On Wed, 15 Dec, 2021, 10:51 pm Mohamed Sameem, 



> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Mohamed Sameem (Jira)


[ https://issues.apache.org/jira/browse/PDFBOX-5343 ]


Mohamed Sameem deleted comment on PDFBOX-5343:


was (Author: JIRAUSER281940):
This is the actual pdf image with forms that i generate.

On Wed, 15 Dec, 2021, 10:47 pm Mohamed Sameem, 



> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Mohamed Sameem (Jira)


[ https://issues.apache.org/jira/browse/PDFBOX-5343 ]


Mohamed Sameem deleted comment on PDFBOX-5343:


was (Author: JIRAUSER281940):
Hey i have found the issue,
Even if i try to print the pdf file after the forms get removed images
relocation happens. Will send u the pdf now

On Wed, 15 Dec, 2021, 10:38 pm Mohamed Sameem, 



> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Mohamed Sameem (Jira)


[ https://issues.apache.org/jira/browse/PDFBOX-5343 ]


Mohamed Sameem deleted comment on PDFBOX-5343:


was (Author: JIRAUSER281940):
[~will86]  please look into this

> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Mohamed Sameem (Jira)


[ https://issues.apache.org/jira/browse/PDFBOX-5343 ]


Mohamed Sameem deleted comment on PDFBOX-5343:


was (Author: JIRAUSER281940):
We are using this for some critical business logic.Sorry couldn't attach
the original pdf for official privacy concern of customer. Its a pdbutton
works fine without using flatten function.

On Wed, 15 Dec, 2021, 4:03 pm Tilman Hausherr (Jira), 



> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Mohamed Sameem (Jira)


[ https://issues.apache.org/jira/browse/PDFBOX-5343 ]


Mohamed Sameem deleted comment on PDFBOX-5343:


was (Author: JIRAUSER281940):
Ok, I will do that.  1 page


On Wed, 15 Dec, 2021, 10:15 pm Tilman Hausherr (Jira), 



> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Tilman Hausherr (Jira)


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

Tilman Hausherr commented on PDFBOX-5343:
-

No, 1) going to sleep and 2) your code isn't self working. This is an excerpt 
of something bigger.

> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Comment Edited] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Mohamed Sameem (Jira)


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

Mohamed Sameem edited comment on PDFBOX-5343 at 12/16/21, 7:44 PM:
---

CaN u correct it and send


was (Author: JIRAUSER281940):
CN u correct it and send

> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Mohamed Sameem (Jira)


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

Mohamed Sameem commented on PDFBOX-5343:


CN u correct it and send

> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Tilman Hausherr (Jira)


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

Tilman Hausherr commented on PDFBOX-5343:
-

There is one difference to the code in our examples. We set the bbox to 
(height, width), i.e. (0,0) origin, and the image is also positioned from 
(0,0). You set the position always. We set the positioning is done through the 
widget .setRectangle(). See the CreateCheckBox.java and 
CreateVisibleSignature2.java examples.

I'm not saying your code is bad, but maybe it's the cause that the flattening 
fails. So try generating your PDF differently.

> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Comment Edited] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Tilman Hausherr (Jira)


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

Tilman Hausherr edited comment on PDFBOX-5343 at 12/16/21, 7:30 PM:


Yeah by default its a button, so i had to implement that way, i could share
yout the generic piece of code where i do , the thing is  image we paste
isn't persistent  after flattening.
The below is the script, ping me if u find anything wrong over here.
{code}
 PDNonTerminalField imageBoxes = (PDNonTerminalField) pdAcroForm.getField("#i");

  if (Objects.nonNull(imageBoxes)) {
imageBoxes
.getChildren()
.forEach(
x -> {
  PDPushButton pdNonTerminalFieldX = (PDPushButton) x;
  setField(
  pdNonTerminalFieldX,
  values.get(pdNonTerminalFieldX.getPartialName()),
  pdfDocument);
});
  }
  for (PDField field : pdAcroForm.getFieldTree()) {
field.setReadOnly(true);
  }
  pdfDocument.save(byteArrayOutputStream);
  pdfDocument.close();
  return byteArrayOutputStream.toByteArray();
} catch (Exception e) {
  log.error("exception caught while generating pdf: ", e);
  return null;
}
  }

  private static PDRectangle getFieldArea(PDAnnotationWidget
pdAnnotationWidget) {
COSDictionary fieldDict = pdAnnotationWidget.getCOSObject();
COSArray fieldAreaArray = (COSArray)
fieldDict.getDictionaryObject(COSName.RECT);
return new PDRectangle(fieldAreaArray);
  }

  private static void setField(PDField field, String value, PDDocument
pdfDocument) {
if (Objects.isNull(field)) {
  return;
}
try {
  if (field instanceof PDCheckBox) {
PDCheckBox checkbox = (PDCheckBox) field;
if (value.isEmpty()) {
  checkbox.unCheck();
} else {
  checkbox.check();
}
  } else if (field instanceof PDComboBox) {
field.setValue(value);
  } else if (field instanceof PDListBox) {
field.setValue(value);
  } else if (field instanceof PDRadioButton) {
field.setValue(value);
  } else if (field instanceof PDTextField) {
PDTextField textField = (PDTextField) field;
textField.setDefaultAppearance("/Helv 22 Tf 0 g");
textField.setValue(value);
  } else if (field instanceof PDPushButton) {
setImageField(field, value, pdfDocument);
  }
} catch (Exception e) {
  log.error("Failed to set value {} at field {}", value,
field.getFullyQualifiedName(), e);
}
  }

  static void setImageField(PDField field, String value, PDDocument pdfDocument)
  throws IOException {
if (StringUtils.isEmpty(value)) {
  return;
}
PDPushButton pdPushButton = (PDPushButton) field;
List widgets = pdPushButton.getWidgets();
byte[] byteArray = Base64.getDecoder().decode(value);
for (PDAnnotationWidget annotationWidget : widgets) {
  PDImageXObject pdImageXObject =
PDImageXObject.createFromByteArray(pdfDocument, byteArray,
field.getPartialName());
  float imageScaleRatio =
  (float) pdImageXObject.getHeight() / (float)
pdImageXObject.getWidth();
  PDRectangle buttonPosition = getFieldArea(annotationWidget);
  float height = buttonPosition.getHeight();
  float width = height / imageScaleRatio;
  float x = buttonPosition.getLowerLeftX();
  float y = buttonPosition.getLowerLeftY();
  PDAppearanceStream pdAppearanceStream = new
PDAppearanceStream(pdfDocument);
  pdAppearanceStream.setResources(new PDResources());
  try (PDPageContentStream pdPageContentStream =
  new PDPageContentStream(pdfDocument, pdAppearanceStream)) {
pdPageContentStream.drawImage(pdImageXObject, x, y, width, height);
  }
  pdAppearanceStream.setBBox(new PDRectangle(x, y, width, height));
  PDAppearanceDictionary pdAppearanceDictionary =
annotationWidget.getAppearance();
  if (pdAppearanceDictionary == null) {
pdAppearanceDictionary = new PDAppearanceDictionary();
annotationWidget.setAppearance(pdAppearanceDictionary);
  }
  pdAppearanceDictionary.setNormalAppearance(pdAppearanceStream);
}
  }
}
{code}


was (Author: JIRAUSER281940):
Yeah by default its a button, so i had to implement that way, i could share
yout the generic piece of code where i do , the thing is  image we paste
isn't persistent  after flattening.
The below is the script, ping me if u find anything wrong over here.

 PDNonTerminalField imageBoxes = (PDNonTerminalField) pdAcroForm.getField("#i");

  if (Objects.nonNull(imageBoxes)) {
imageBoxes
.getChildren()
.forEach(
x -> {
  PDPushButton pdNonTerminalFieldX = (PDPushButton) x;
  setField(
  

[jira] [Resolved] (PDFBOX-5345) IllegalArgumentException: Input buffer too short in StandardSecurityHandler.computeRC4key

2021-12-16 Thread Tilman Hausherr (Jira)


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

Tilman Hausherr resolved PDFBOX-5345.
-
Fix Version/s: 2.0.26
   3.0.0 PDFBox
 Assignee: Tilman Hausherr
   Resolution: Fixed

> IllegalArgumentException: Input buffer too short in 
> StandardSecurityHandler.computeRC4key
> -
>
> Key: PDFBOX-5345
> URL: https://issues.apache.org/jira/browse/PDFBOX-5345
> Project: PDFBox
>  Issue Type: Bug
>  Components: Crypto
>Affects Versions: 2.0.24
>Reporter: Tilman Hausherr
>Assignee: Tilman Hausherr
>Priority: Minor
>  Labels: regression
> Fix For: 2.0.26, 3.0.0 PDFBox
>
> Attachments: poppler-89422-0.pdf
>
>
> {noformat}
> java.lang.IllegalArgumentException: Input buffer too short
> at 
> java.base/java.security.MessageDigest.update(MessageDigest.java:347)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.computeRC4key(StandardSecurityHandler.java:894)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.getUserPassword(StandardSecurityHandler.java:617)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.isOwnerPassword(StandardSecurityHandler.java:595)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareForDecryption(StandardSecurityHandler.java:213)
> at 
> org.apache.pdfbox.pdfparser.COSParser.prepareDecryption(COSParser.java:2532)
> {noformat}
> Probably because of PDFBOX-5312



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-5345) IllegalArgumentException: Input buffer too short in StandardSecurityHandler.computeRC4key

2021-12-16 Thread Tilman Hausherr (Jira)


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

Tilman Hausherr commented on PDFBOX-5345:
-

[~lehmi] thanks, that works!

> IllegalArgumentException: Input buffer too short in 
> StandardSecurityHandler.computeRC4key
> -
>
> Key: PDFBOX-5345
> URL: https://issues.apache.org/jira/browse/PDFBOX-5345
> Project: PDFBox
>  Issue Type: Bug
>  Components: Crypto
>Affects Versions: 2.0.24
>Reporter: Tilman Hausherr
>Priority: Minor
>  Labels: regression
> Attachments: poppler-89422-0.pdf
>
>
> {noformat}
> java.lang.IllegalArgumentException: Input buffer too short
> at 
> java.base/java.security.MessageDigest.update(MessageDigest.java:347)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.computeRC4key(StandardSecurityHandler.java:894)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.getUserPassword(StandardSecurityHandler.java:617)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.isOwnerPassword(StandardSecurityHandler.java:595)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareForDecryption(StandardSecurityHandler.java:213)
> at 
> org.apache.pdfbox.pdfparser.COSParser.prepareDecryption(COSParser.java:2532)
> {noformat}
> Probably because of PDFBOX-5312



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-5345) IllegalArgumentException: Input buffer too short in StandardSecurityHandler.computeRC4key

2021-12-16 Thread ASF subversion and git services (Jira)


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

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

Commit 1896070 from Tilman Hausherr in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1896070 ]

PDFBOX-5345: use encryption dictionary length value, as suggested by Andreas 
Lehmkühler

> IllegalArgumentException: Input buffer too short in 
> StandardSecurityHandler.computeRC4key
> -
>
> Key: PDFBOX-5345
> URL: https://issues.apache.org/jira/browse/PDFBOX-5345
> Project: PDFBox
>  Issue Type: Bug
>  Components: Crypto
>Affects Versions: 2.0.24
>Reporter: Tilman Hausherr
>Priority: Minor
>  Labels: regression
> Attachments: poppler-89422-0.pdf
>
>
> {noformat}
> java.lang.IllegalArgumentException: Input buffer too short
> at 
> java.base/java.security.MessageDigest.update(MessageDigest.java:347)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.computeRC4key(StandardSecurityHandler.java:894)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.getUserPassword(StandardSecurityHandler.java:617)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.isOwnerPassword(StandardSecurityHandler.java:595)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareForDecryption(StandardSecurityHandler.java:213)
> at 
> org.apache.pdfbox.pdfparser.COSParser.prepareDecryption(COSParser.java:2532)
> {noformat}
> Probably because of PDFBOX-5312



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-5345) IllegalArgumentException: Input buffer too short in StandardSecurityHandler.computeRC4key

2021-12-16 Thread ASF subversion and git services (Jira)


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

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

Commit 1896069 from Tilman Hausherr in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1896069 ]

PDFBOX-5345: use encryption dictionary length value, as suggested by Andreas 
Lehmkühler

> IllegalArgumentException: Input buffer too short in 
> StandardSecurityHandler.computeRC4key
> -
>
> Key: PDFBOX-5345
> URL: https://issues.apache.org/jira/browse/PDFBOX-5345
> Project: PDFBox
>  Issue Type: Bug
>  Components: Crypto
>Affects Versions: 2.0.24
>Reporter: Tilman Hausherr
>Priority: Minor
>  Labels: regression
> Attachments: poppler-89422-0.pdf
>
>
> {noformat}
> java.lang.IllegalArgumentException: Input buffer too short
> at 
> java.base/java.security.MessageDigest.update(MessageDigest.java:347)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.computeRC4key(StandardSecurityHandler.java:894)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.getUserPassword(StandardSecurityHandler.java:617)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.isOwnerPassword(StandardSecurityHandler.java:595)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareForDecryption(StandardSecurityHandler.java:213)
> at 
> org.apache.pdfbox.pdfparser.COSParser.prepareDecryption(COSParser.java:2532)
> {noformat}
> Probably because of PDFBOX-5312



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-5345) IllegalArgumentException: Input buffer too short in StandardSecurityHandler.computeRC4key

2021-12-16 Thread Jira


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

Andreas Lehmkühler commented on PDFBOX-5345:


[~tilman]  the \{{encryption}} dictionary is the relevant one not 
\{{stdCryptFilterDictionary}}

> IllegalArgumentException: Input buffer too short in 
> StandardSecurityHandler.computeRC4key
> -
>
> Key: PDFBOX-5345
> URL: https://issues.apache.org/jira/browse/PDFBOX-5345
> Project: PDFBox
>  Issue Type: Bug
>  Components: Crypto
>Affects Versions: 2.0.24
>Reporter: Tilman Hausherr
>Priority: Minor
>  Labels: regression
> Attachments: poppler-89422-0.pdf
>
>
> {noformat}
> java.lang.IllegalArgumentException: Input buffer too short
> at 
> java.base/java.security.MessageDigest.update(MessageDigest.java:347)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.computeRC4key(StandardSecurityHandler.java:894)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.getUserPassword(StandardSecurityHandler.java:617)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.isOwnerPassword(StandardSecurityHandler.java:595)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareForDecryption(StandardSecurityHandler.java:213)
> at 
> org.apache.pdfbox.pdfparser.COSParser.prepareDecryption(COSParser.java:2532)
> {noformat}
> Probably because of PDFBOX-5312



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Comment Edited] (PDFBOX-5345) IllegalArgumentException: Input buffer too short in StandardSecurityHandler.computeRC4key

2021-12-16 Thread Jira


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

Andreas Lehmkühler edited comment on PDFBOX-5345 at 12/16/21, 4:18 PM:
---

[~tilman]  the {{encryption}} dictionary is the relevant one not 
{{stdCryptFilterDictionary}}


was (Author: lehmi):
[~tilman]  the \{{encryption}} dictionary is the relevant one not 
\{{stdCryptFilterDictionary}}

> IllegalArgumentException: Input buffer too short in 
> StandardSecurityHandler.computeRC4key
> -
>
> Key: PDFBOX-5345
> URL: https://issues.apache.org/jira/browse/PDFBOX-5345
> Project: PDFBox
>  Issue Type: Bug
>  Components: Crypto
>Affects Versions: 2.0.24
>Reporter: Tilman Hausherr
>Priority: Minor
>  Labels: regression
> Attachments: poppler-89422-0.pdf
>
>
> {noformat}
> java.lang.IllegalArgumentException: Input buffer too short
> at 
> java.base/java.security.MessageDigest.update(MessageDigest.java:347)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.computeRC4key(StandardSecurityHandler.java:894)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.getUserPassword(StandardSecurityHandler.java:617)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.isOwnerPassword(StandardSecurityHandler.java:595)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareForDecryption(StandardSecurityHandler.java:213)
> at 
> org.apache.pdfbox.pdfparser.COSParser.prepareDecryption(COSParser.java:2532)
> {noformat}
> Probably because of PDFBOX-5312



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Mohamed Sameem (Jira)


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

Mohamed Sameem commented on PDFBOX-5343:


Yeah by default its a button, so i had to implement that way, i could share
yout the generic piece of code where i do , the thing is  image we paste
isn't persistent  after flattening.
The below is the script, ping me if u find anything wrong over here.

 PDNonTerminalField imageBoxes = (PDNonTerminalField) pdAcroForm.getField("#i");

  if (Objects.nonNull(imageBoxes)) {
imageBoxes
.getChildren()
.forEach(
x -> {
  PDPushButton pdNonTerminalFieldX = (PDPushButton) x;
  setField(
  pdNonTerminalFieldX,
  values.get(pdNonTerminalFieldX.getPartialName()),
  pdfDocument);
});
  }
  for (PDField field : pdAcroForm.getFieldTree()) {
field.setReadOnly(true);
  }
  pdfDocument.save(byteArrayOutputStream);
  pdfDocument.close();
  return byteArrayOutputStream.toByteArray();
} catch (Exception e) {
  log.error("exception caught while generating pdf: ", e);
  return null;
}
  }

  private static PDRectangle getFieldArea(PDAnnotationWidget
pdAnnotationWidget) {
COSDictionary fieldDict = pdAnnotationWidget.getCOSObject();
COSArray fieldAreaArray = (COSArray)
fieldDict.getDictionaryObject(COSName.RECT);
return new PDRectangle(fieldAreaArray);
  }

  private static void setField(PDField field, String value, PDDocument
pdfDocument) {
if (Objects.isNull(field)) {
  return;
}
try {
  if (field instanceof PDCheckBox) {
PDCheckBox checkbox = (PDCheckBox) field;
if (value.isEmpty()) {
  checkbox.unCheck();
} else {
  checkbox.check();
}
  } else if (field instanceof PDComboBox) {
field.setValue(value);
  } else if (field instanceof PDListBox) {
field.setValue(value);
  } else if (field instanceof PDRadioButton) {
field.setValue(value);
  } else if (field instanceof PDTextField) {
PDTextField textField = (PDTextField) field;
textField.setDefaultAppearance("/Helv 22 Tf 0 g");
textField.setValue(value);
  } else if (field instanceof PDPushButton) {
setImageField(field, value, pdfDocument);
  }
} catch (Exception e) {
  log.error("Failed to set value {} at field {}", value,
field.getFullyQualifiedName(), e);
}
  }

  static void setImageField(PDField field, String value, PDDocument pdfDocument)
  throws IOException {
if (StringUtils.isEmpty(value)) {
  return;
}
PDPushButton pdPushButton = (PDPushButton) field;
List widgets = pdPushButton.getWidgets();
byte[] byteArray = Base64.getDecoder().decode(value);
for (PDAnnotationWidget annotationWidget : widgets) {
  PDImageXObject pdImageXObject =
PDImageXObject.createFromByteArray(pdfDocument, byteArray,
field.getPartialName());
  float imageScaleRatio =
  (float) pdImageXObject.getHeight() / (float)
pdImageXObject.getWidth();
  PDRectangle buttonPosition = getFieldArea(annotationWidget);
  float height = buttonPosition.getHeight();
  float width = height / imageScaleRatio;
  float x = buttonPosition.getLowerLeftX();
  float y = buttonPosition.getLowerLeftY();
  PDAppearanceStream pdAppearanceStream = new
PDAppearanceStream(pdfDocument);
  pdAppearanceStream.setResources(new PDResources());
  try (PDPageContentStream pdPageContentStream =
  new PDPageContentStream(pdfDocument, pdAppearanceStream)) {
pdPageContentStream.drawImage(pdImageXObject, x, y, width, height);
  }
  pdAppearanceStream.setBBox(new PDRectangle(x, y, width, height));
  PDAppearanceDictionary pdAppearanceDictionary =
annotationWidget.getAppearance();
  if (pdAppearanceDictionary == null) {
pdAppearanceDictionary = new PDAppearanceDictionary();
annotationWidget.setAppearance(pdAppearanceDictionary);
  }
  pdAppearanceDictionary.setNormalAppearance(pdAppearanceStream);
}
  }
}


On Thu, Dec 16, 2021 at 7:17 PM Tilman Hausherr (Jira) 



> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.

[jira] [Commented] (PDFBOX-5344) Adding a signature on nested fields has no effect

2021-12-16 Thread Laurence Urbain (Jira)


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

Laurence Urbain commented on PDFBOX-5344:
-

Hi [~tilman], 

Indeed, when I use the new saveIncremental method to pass the PDSignatureField, 
the signature works (and the document signature looks valid). Although it does 
not feel right to use PDDocument.addSignature() to perform operations on some 
objects we may not know about, and then retrieve the objects  we assume needs 
to be updated afterwards...

Besides, I am not in control of the code who calls PDDocument.addSignature(). 
To give you some context, we work with the dss library for all our signature 
operations. Initially, I opened a DSS ticket: 
[https://ec.europa.eu/cefdigital/tracker/browse/DSS-2653].


Changing the saveIncremental logic would probably have a significant impact, I 
am not sure they would want to go for it anytime soon (You can correct me if I 
am wrong [~mkl]).

We have a strong requirement to support nested fields, do you know if there is 
any plan in the future to work on PDDocument.addSignature() ? We would really 
prefer to avoid forking libraries.  

Thanks for you help

> Adding a signature on nested fields has no effect
> -
>
> Key: PDFBOX-5344
> URL: https://issues.apache.org/jira/browse/PDFBOX-5344
> Project: PDFBox
>  Issue Type: Bug
>  Components: Signing
>Affects Versions: 2.0.24
>Reporter: Laurence Urbain
>Priority: Major
> Attachments: nested-signature-field.pdf
>
>
> Hi,
> I am not able add a signature to a document if the signature field is nested 
> (the signature field is not a direct child of the acro form).
> When I call the method PDDocument.addSignature(), the signature field is 
> properly marked as  "needs to be updated" but not its parents.
> As a result, when the incremental save is done, the changes are lost.
> To be able to add the signature for such field, all the parent fields in the 
> hierachy should also be marked as "needs to be updated".
> Please find a sample file attached.
> Here is the code snippet to build it:
> {code:java}
> final PDDocument pdDocument = new PDDocument();
> final PDPage page = new PDPage();
> pdDocument.addPage(page);
> PDAcroForm form = new PDAcroForm(pdDocument);
> pdDocument.getDocumentCatalog().setAcroForm(form);
> final PDNonTerminalField level1 = new PDNonTerminalField(form);
> level1.setPartialName("level1");
> form.getFields().add(level1);
> final PDNonTerminalField level2 = new PDNonTerminalField(form);
> level2.setPartialName("level2");
> level1.setChildren(List.of(level2));
> final PDSignatureField signatureField = new PDSignatureField(form);
> signatureField.setPartialName("field1");
> PDAnnotationWidget widget = signatureField.getWidgets().get(0);
> widget.setRectangle(new PDRectangle(50, 700, 200, 20));
> widget.setPage(page);
> widget.setPrinted(true);
> page.getAnnotations().add(widget);
> level2.setChildren(List.of(signatureField)); {code}
> Thanks



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Comment Edited] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Tilman Hausherr (Jira)


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

Tilman Hausherr edited comment on PDFBOX-5343 at 12/16/21, 1:46 PM:


I wonder why you have a button in the first place. Your use case is probably 
that the client enters his data in a form and uploads a photo, you then create 
a PDF for printing and signing. You don't need a button to add an image to a 
PDF.


was (Author: tilman):
I wonder why you have a button in the first place. Your use case is probably 
that the client enters his data in a form and uploads a photo, you then create 
a PDF for printing. You don't need a button to add an image to a PDF.

> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-5343) PdfBox images Alignation Issue after using flatten function

2021-12-16 Thread Tilman Hausherr (Jira)


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

Tilman Hausherr commented on PDFBOX-5343:
-

I wonder why you have a button in the first place. Your use case is probably 
that the client enters his data in a form and uploads a photo, you then create 
a PDF for printing. You don't need a button to add an image to a PDF.

> PdfBox images Alignation Issue after using flatten function
> ---
>
> Key: PDFBOX-5343
> URL: https://issues.apache.org/jira/browse/PDFBOX-5343
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 3.0.0 PDFBox
>Reporter: Mohamed Sameem
>Priority: Major
>  Labels: PDFBox, acroform, bug, flatten, pdf
> Attachments: Screenshot_2021-12-15-22-49-00-277_com.adobe.reader.jpg, 
> Screenshot_2021-12-15-22-50-18-641_com.adobe.reader.jpg, bug.pdf, 
> irregular.png, irregular2.png
>
>
> Using flatten function of pdfbox changes the position of images from the 
> required box to be filled.I would like to know if there is a fix for this. I 
> would like the pdfbox team to look into it.Images attached The images are 
> moving out of their respective position after using PDAcroForm.flatten() 
> Images attached
> https://stackoverflow.com/questions/70361091/pdfbox-images-alignation-issue-after-using-flatten-function



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



Jenkins build is back to stable : PDFBox » PDFBox-trunk #1078

2021-12-16 Thread Apache Jenkins Server
See 



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



Jenkins build is back to stable : PDFBox » PDFBox-trunk » Apache PDFBox #1078

2021-12-16 Thread Apache Jenkins Server
See 



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



Jenkins build is back to stable : PDFBox » PDFBox-2.0.x #651

2021-12-16 Thread Apache Jenkins Server
See 



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



Jenkins build is back to stable : PDFBox » PDFBox-2.0.x » Apache PDFBox #651

2021-12-16 Thread Apache Jenkins Server
See 



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



Jenkins build is back to stable : PDFBox » PDFBox-Trunk-jdk18 » Apache PDFBox #432

2021-12-16 Thread Apache Jenkins Server
See 



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



Jenkins build is back to stable : PDFBox » PDFBox-Trunk-jdk18 #432

2021-12-16 Thread Apache Jenkins Server
See 



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



[jira] [Commented] (PDFBOX-5345) IllegalArgumentException: Input buffer too short in StandardSecurityHandler.computeRC4key

2021-12-16 Thread ASF subversion and git services (Jira)


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

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

Commit 1896045 from Tilman Hausherr in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1896045 ]

PDFBOX-5345: partial revert; use more tailored approach instead

> IllegalArgumentException: Input buffer too short in 
> StandardSecurityHandler.computeRC4key
> -
>
> Key: PDFBOX-5345
> URL: https://issues.apache.org/jira/browse/PDFBOX-5345
> Project: PDFBox
>  Issue Type: Bug
>  Components: Crypto
>Affects Versions: 2.0.24
>Reporter: Tilman Hausherr
>Priority: Minor
>  Labels: regression
> Attachments: poppler-89422-0.pdf
>
>
> {noformat}
> java.lang.IllegalArgumentException: Input buffer too short
> at 
> java.base/java.security.MessageDigest.update(MessageDigest.java:347)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.computeRC4key(StandardSecurityHandler.java:894)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.getUserPassword(StandardSecurityHandler.java:617)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.isOwnerPassword(StandardSecurityHandler.java:595)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareForDecryption(StandardSecurityHandler.java:213)
> at 
> org.apache.pdfbox.pdfparser.COSParser.prepareDecryption(COSParser.java:2532)
> {noformat}
> Probably because of PDFBOX-5312



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-5345) IllegalArgumentException: Input buffer too short in StandardSecurityHandler.computeRC4key

2021-12-16 Thread ASF subversion and git services (Jira)


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

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

Commit 1896047 from Tilman Hausherr in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1896047 ]

PDFBOX-5345: partial revert; use more tailored approach instead

> IllegalArgumentException: Input buffer too short in 
> StandardSecurityHandler.computeRC4key
> -
>
> Key: PDFBOX-5345
> URL: https://issues.apache.org/jira/browse/PDFBOX-5345
> Project: PDFBox
>  Issue Type: Bug
>  Components: Crypto
>Affects Versions: 2.0.24
>Reporter: Tilman Hausherr
>Priority: Minor
>  Labels: regression
> Attachments: poppler-89422-0.pdf
>
>
> {noformat}
> java.lang.IllegalArgumentException: Input buffer too short
> at 
> java.base/java.security.MessageDigest.update(MessageDigest.java:347)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.computeRC4key(StandardSecurityHandler.java:894)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.getUserPassword(StandardSecurityHandler.java:617)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.isOwnerPassword(StandardSecurityHandler.java:595)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareForDecryption(StandardSecurityHandler.java:213)
> at 
> org.apache.pdfbox.pdfparser.COSParser.prepareDecryption(COSParser.java:2532)
> {noformat}
> Probably because of PDFBOX-5312



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



Jenkins build became unstable: PDFBox » PDFBox-Trunk-jdk18 #431

2021-12-16 Thread Apache Jenkins Server
See 



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



Jenkins build became unstable: PDFBox » PDFBox-Trunk-jdk18 » Apache PDFBox #431

2021-12-16 Thread Apache Jenkins Server
See 



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



Jenkins build is still unstable: PDFBox » PDFBox-trunk #1077

2021-12-16 Thread Apache Jenkins Server
See 



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



Jenkins build is still unstable: PDFBox » PDFBox-trunk » Apache PDFBox #1077

2021-12-16 Thread Apache Jenkins Server
See 



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



[jira] [Commented] (PDFBOX-4892) Improve code quality (4)

2021-12-16 Thread ASF subversion and git services (Jira)


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

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

Commit 1896037 from Tilman Hausherr in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1896037 ]

PDFBOX-4892: allow 20 seconds old OCSP answers

> Improve code quality (4)
> 
>
> Key: PDFBOX-4892
> URL: https://issues.apache.org/jira/browse/PDFBOX-4892
> Project: PDFBox
>  Issue Type: Improvement
>Affects Versions: 2.0.20
>Reporter: Tilman Hausherr
>Priority: Minor
>
> This is a longterm issue for the task to improve code quality, by using the 
> [SonarQube report|https://sonarcloud.io/project/issues?id=pdfbox-reactor], 
> hints in different IDEs, the FindBugs tool and other code quality tools.
> This is a follow-up of PDFBOX-4071, which was getting too long.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-4892) Improve code quality (4)

2021-12-16 Thread ASF subversion and git services (Jira)


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

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

Commit 1896036 from Tilman Hausherr in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1896036 ]

PDFBOX-4892: allow 20 seconds old OCSP answers

> Improve code quality (4)
> 
>
> Key: PDFBOX-4892
> URL: https://issues.apache.org/jira/browse/PDFBOX-4892
> Project: PDFBox
>  Issue Type: Improvement
>Affects Versions: 2.0.20
>Reporter: Tilman Hausherr
>Priority: Minor
>
> This is a longterm issue for the task to improve code quality, by using the 
> [SonarQube report|https://sonarcloud.io/project/issues?id=pdfbox-reactor], 
> hints in different IDEs, the FindBugs tool and other code quality tools.
> This is a follow-up of PDFBOX-4071, which was getting too long.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-4892) Improve code quality (4)

2021-12-16 Thread ASF subversion and git services (Jira)


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

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

Commit 1896035 from Tilman Hausherr in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1896035 ]

PDFBOX-4892: add comment why no logging; use jdk8 class

> Improve code quality (4)
> 
>
> Key: PDFBOX-4892
> URL: https://issues.apache.org/jira/browse/PDFBOX-4892
> Project: PDFBox
>  Issue Type: Improvement
>Affects Versions: 2.0.20
>Reporter: Tilman Hausherr
>Priority: Minor
>
> This is a longterm issue for the task to improve code quality, by using the 
> [SonarQube report|https://sonarcloud.io/project/issues?id=pdfbox-reactor], 
> hints in different IDEs, the FindBugs tool and other code quality tools.
> This is a follow-up of PDFBOX-4071, which was getting too long.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



Re: [VOTE] Release Apache PDFBox 2.0.25

2021-12-16 Thread Timo Boehme

+1

Thanks,
Timo


Am 13.12.21 um 20:02 schrieb Andreas Lehmkuehler:

Hi,

a candidate for the PDFBox 2.0.25 release is available at:

     https://dist.apache.org/repos/dist/dev/pdfbox/2.0.25/

The release candidate is a zip archive of the sources in:

     http://svn.apache.org/repos/asf/pdfbox/tags/2.0.25/

The SHA-512 checksum of the archive is 
e143b2a9aaa4b1f1be72e16a1c9968dacfcb3e89b4f21fdbd0580d8c9f1c9b54ee38d05fe3e52ff93493c858c51090fdd8256d22153cffba1e9b523fdbd1f2f4. 



Please vote on releasing this package as Apache PDFBox 2.0.25.
The vote is open for the next 72 hours and passes if a majority of at
least three +1 PDFBox PMC votes are cast.

     [ ] +1 Release this package as Apache PDFBox 2.0.25
     [ ] -1 Do not release this package because...

Here is my +1

Andreas

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




--
OntoChem GmbH
Blücherstraße 24
06120 Halle (Saale)
Germany

email: timo.boe...@ontochem.com | web: www.ontochem.com
| fax: +49 345 478 047 1
HRB 215461 Amtsgericht Stendal  | USt-IdNr.: DE246232735
managing directors: Dr. Lutz Weber (CEO), Dr. Felix Berthelmann (COO)


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



Jenkins build became unstable: PDFBox » PDFBox-trunk » Apache PDFBox #1076

2021-12-16 Thread Apache Jenkins Server
See 



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



Jenkins build became unstable: PDFBox » PDFBox-trunk #1076

2021-12-16 Thread Apache Jenkins Server
See 



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



Jenkins build became unstable: PDFBox » PDFBox-2.0.x #650

2021-12-16 Thread Apache Jenkins Server
See 



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



Jenkins build became unstable: PDFBox » PDFBox-2.0.x » Apache PDFBox #650

2021-12-16 Thread Apache Jenkins Server
See 



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



[jira] [Commented] (PDFBOX-5344) Adding a signature on nested fields has no effect

2021-12-16 Thread Laurence Urbain (Jira)


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

Laurence Urbain commented on PDFBOX-5344:
-

[~mkl] 

I was not considering all these aspects, thanks for the explanation, it makes 
total sense.

[~tilman]

Thanks, I'm gonna try this approach. 
{quote}
What we could do is to improve the signing examples to catch this corner case 
(by using the {{PDAcroform.getFields()}} method which gets the root level 
fields) so that people notice it and change their code accordingly.
{quote}

I was not aware of these nested fields until recently, adding this logic to the 
examples could definitely help noticing the field hierarchy.

> Adding a signature on nested fields has no effect
> -
>
> Key: PDFBOX-5344
> URL: https://issues.apache.org/jira/browse/PDFBOX-5344
> Project: PDFBox
>  Issue Type: Bug
>  Components: Signing
>Affects Versions: 2.0.24
>Reporter: Laurence Urbain
>Priority: Major
> Attachments: nested-signature-field.pdf
>
>
> Hi,
> I am not able add a signature to a document if the signature field is nested 
> (the signature field is not a direct child of the acro form).
> When I call the method PDDocument.addSignature(), the signature field is 
> properly marked as  "needs to be updated" but not its parents.
> As a result, when the incremental save is done, the changes are lost.
> To be able to add the signature for such field, all the parent fields in the 
> hierachy should also be marked as "needs to be updated".
> Please find a sample file attached.
> Here is the code snippet to build it:
> {code:java}
> final PDDocument pdDocument = new PDDocument();
> final PDPage page = new PDPage();
> pdDocument.addPage(page);
> PDAcroForm form = new PDAcroForm(pdDocument);
> pdDocument.getDocumentCatalog().setAcroForm(form);
> final PDNonTerminalField level1 = new PDNonTerminalField(form);
> level1.setPartialName("level1");
> form.getFields().add(level1);
> final PDNonTerminalField level2 = new PDNonTerminalField(form);
> level2.setPartialName("level2");
> level1.setChildren(List.of(level2));
> final PDSignatureField signatureField = new PDSignatureField(form);
> signatureField.setPartialName("field1");
> PDAnnotationWidget widget = signatureField.getWidgets().get(0);
> widget.setRectangle(new PDRectangle(50, 700, 200, 20));
> widget.setPage(page);
> widget.setPrinted(true);
> page.getAnnotations().add(widget);
> level2.setChildren(List.of(signatureField)); {code}
> Thanks



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-5345) IllegalArgumentException: Input buffer too short in StandardSecurityHandler.computeRC4key

2021-12-16 Thread ASF subversion and git services (Jira)


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

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

Commit 1896026 from Tilman Hausherr in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1896026 ]

PDFBOX-5345: don't ignore length value, as suggested by Andreas Lehmkühler

> IllegalArgumentException: Input buffer too short in 
> StandardSecurityHandler.computeRC4key
> -
>
> Key: PDFBOX-5345
> URL: https://issues.apache.org/jira/browse/PDFBOX-5345
> Project: PDFBox
>  Issue Type: Bug
>  Components: Crypto
>Affects Versions: 2.0.24
>Reporter: Tilman Hausherr
>Priority: Minor
>  Labels: regression
> Attachments: poppler-89422-0.pdf
>
>
> {noformat}
> java.lang.IllegalArgumentException: Input buffer too short
> at 
> java.base/java.security.MessageDigest.update(MessageDigest.java:347)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.computeRC4key(StandardSecurityHandler.java:894)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.getUserPassword(StandardSecurityHandler.java:617)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.isOwnerPassword(StandardSecurityHandler.java:595)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareForDecryption(StandardSecurityHandler.java:213)
> at 
> org.apache.pdfbox.pdfparser.COSParser.prepareDecryption(COSParser.java:2532)
> {noformat}
> Probably because of PDFBOX-5312



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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



[jira] [Commented] (PDFBOX-5345) IllegalArgumentException: Input buffer too short in StandardSecurityHandler.computeRC4key

2021-12-16 Thread ASF subversion and git services (Jira)


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

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

Commit 1896025 from Tilman Hausherr in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1896025 ]

PDFBOX-5345: don't ignore length value, as suggested by Andreas Lehmkühler

> IllegalArgumentException: Input buffer too short in 
> StandardSecurityHandler.computeRC4key
> -
>
> Key: PDFBOX-5345
> URL: https://issues.apache.org/jira/browse/PDFBOX-5345
> Project: PDFBox
>  Issue Type: Bug
>  Components: Crypto
>Affects Versions: 2.0.24
>Reporter: Tilman Hausherr
>Priority: Minor
>  Labels: regression
> Attachments: poppler-89422-0.pdf
>
>
> {noformat}
> java.lang.IllegalArgumentException: Input buffer too short
> at 
> java.base/java.security.MessageDigest.update(MessageDigest.java:347)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.computeRC4key(StandardSecurityHandler.java:894)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.getUserPassword(StandardSecurityHandler.java:617)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.isOwnerPassword(StandardSecurityHandler.java:595)
> at 
> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareForDecryption(StandardSecurityHandler.java:213)
> at 
> org.apache.pdfbox.pdfparser.COSParser.prepareDecryption(COSParser.java:2532)
> {noformat}
> Probably because of PDFBOX-5312



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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