You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Xin Lin (JIRA)" <ji...@apache.org> on 2018/06/22 20:53:00 UTC
[jira] [Comment Edited] (PDFBOX-4249) After flattening, barcode
fields are always at the lower left corner of the page
[ https://issues.apache.org/jira/browse/PDFBOX-4249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16520761#comment-16520761 ]
Xin Lin edited comment on PDFBOX-4249 at 6/22/18 8:52 PM:
----------------------------------------------------------
When flattening [^barcode.pdf] with just a single barcode field using PDFBox 2.0.9, the barcode field in the flattened file [^barcode flattened.pdf] is at the lower left corner of the page.
I traced it to line 308 in PDAcroForm.java:
{code:java}
boolean needsTranslation = resolveNeedsTranslation(appearanceStream);
{code}
If I change that to
{code:java}
boolean needsTranslation = true;
{code}
The field will appear in the correct position.
In the method resolveNeedsTranslation starting from line 748
{code:java}
if (xObject instanceof PDFormXObject)
{
PDRectangle bbox = ((PDFormXObject)xObject).getBBox();
float llX = bbox.getLowerLeftX();
float llY = bbox.getLowerLeftY();
if (llX == 0 && llY == 0)
{
needsTranslation = true;
}
}
{code}
The xObject in this case is an instance of PDImageXObject instead of PDFormXObject, therefore, resolveNeedsTranslation() in this case will always return false.
was (Author: xin.lin):
When flattening [^barcode.pdf] with just a single barcode field using PDFBox 2.0.9, the barcode field in the flattened file [^barcode flattened.pdf] is at the lower left corner of the page.
I traced it to line 308 in PDAcroForm.java:
{code:java}
boolean needsTranslation = resolveNeedsTranslation(appearanceStream);
{code}
If I changed that to
{code:java}
boolean needsTranslation = true;
{code}
The field will appear in the correct position.
In the method resolveNeedsTranslation starting from line 748
{code:java}
if (xObject instanceof PDFormXObject)
{
PDRectangle bbox = ((PDFormXObject)xObject).getBBox();
float llX = bbox.getLowerLeftX();
float llY = bbox.getLowerLeftY();
if (llX == 0 && llY == 0)
{
needsTranslation = true;
}
}
{code}
The xObject in this case is an instance of PDImageXObject instead of PDFormXObject, therefore, resolveNeedsTranslation() in this case will always return false.
> After flattening, barcode fields are always at the lower left corner of the page
> --------------------------------------------------------------------------------
>
> Key: PDFBOX-4249
> URL: https://issues.apache.org/jira/browse/PDFBOX-4249
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.9
> Reporter: Xin Lin
> Priority: Major
> Attachments: barcode flattened.pdf, barcode.pdf
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org