You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (Jira)" <ji...@apache.org> on 2022/05/06 15:42:00 UTC
[jira] [Comment Edited] (PDFBOX-5430) PDFStreamEngine.showTextStrings with font switch
[ https://issues.apache.org/jira/browse/PDFBOX-5430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17532930#comment-17532930 ]
Andreas Lehmkühler edited comment on PDFBOX-5430 at 5/6/22 3:41 PM:
--------------------------------------------------------------------
I guess you are referring to things like this
{code}
[ /F3 8 (Monatliche Kosten ) /F1 8 0 -11 ] TJ
{code}
Maybe I'm missing something, but the TJ operator doesn't define a font switch. It is simply malformed.
was (Author: lehmi):
I guess you rae referring to things like this
{code}
[ /F3 8 (Monatliche Kosten ) /F1 8 0 -11 ] TJ
{code}
Maybe I'm missing something, but the TJ operator doesn't define a font switch. It is simply malformed.
> PDFStreamEngine.showTextStrings with font switch
> ------------------------------------------------
>
> Key: PDFBOX-5430
> URL: https://issues.apache.org/jira/browse/PDFBOX-5430
> Project: PDFBox
> Issue Type: Bug
> Reporter: Oliver Schmidtmer
> Priority: Major
> Attachments: keine Vorschau ELO-1228188_20220228_11462_HD_online.pdf
>
>
> The attached PDF fails to render with an PDFStreamEngine.showTextStrings with the following exception:
> "java.io.IOException: Unknown type COSName in array for TJ operation:COSName\{F3}"
> This seems to be a font switch.
> {code:java}
> diff --git "a/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java" "b/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java"
> index e4f2259a5..12edadd2b 100644
> --- "a/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java"
> +++ "b/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java"
> @@ -680,6 +680,18 @@ public abstract class PDFStreamEngine
> byte[] string = ((COSString)obj).getBytes();
> showText(string);
> }
> + else if (obj instanceof COSName)
> + {
> + if(((COSName) obj).getName().startsWith("F"))
> + {
> + textState.setFont(resources.getFont((COSName) obj));
> + }
> + else
> + {
> + throw new IOException("Unknown type " + obj.getClass().getSimpleName()
> + + " in array for TJ operation:" + obj);
> + }
> + }
> else if (obj instanceof COSArray)
> {
> LOG.error("Nested arrays are not allowed in an array for TJ operation:" + obj);
> {code}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org