From f11c7a92b08c56aa1815010553054fe1e8d4ef13 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Fri, 19 Aug 2011 14:38:29 +0000 Subject: [PATCH] --- .../operator/BeginMarkedContentSequence.java | 56 -------- ...inMarkedContentSequenceWithProperties.java | 61 -------- .../pdfbox/util/operator/BeginText.java | 44 ------ .../util/operator/CloseAndStrokePath.java | 47 ------ .../pdfbox/util/operator/Concatenate.java | 67 --------- .../operator/EndMarkedContentSequence.java | 46 ------ .../apache/pdfbox/util/operator/EndText.java | 42 ------ .../apache/pdfbox/util/operator/GRestore.java | 41 ------ .../apache/pdfbox/util/operator/GSave.java | 43 ------ .../apache/pdfbox/util/operator/Invoke.java | 77 ---------- .../pdfbox/util/operator/MoveAndShow.java | 47 ------ .../apache/pdfbox/util/operator/MoveText.java | 49 ------- .../util/operator/MoveTextSetLeading.java | 54 ------- .../apache/pdfbox/util/operator/NextLine.java | 53 ------- .../util/operator/OperatorProcessor.java | 73 ---------- .../pdfbox/util/operator/SetCharSpacing.java | 53 ------- .../operator/SetGraphicsStateParameters.java | 52 ------- .../operator/SetHorizontalTextScaling.java | 49 ------- .../pdfbox/util/operator/SetLineCapStyle.java | 48 ------- .../util/operator/SetLineDashPattern.java | 52 ------- .../util/operator/SetLineJoinStyle.java | 48 ------- .../util/operator/SetLineMiterLimit.java | 49 ------- .../pdfbox/util/operator/SetLineWidth.java | 49 ------- .../pdfbox/util/operator/SetMatrix.java | 59 -------- .../pdfbox/util/operator/SetMoveAndShow.java | 47 ------ .../operator/SetNonStrokingCMYKColor.java | 55 ------- .../operator/SetNonStrokingCalRGBColor.java | 51 ------- .../util/operator/SetNonStrokingColor.java | 106 -------------- .../operator/SetNonStrokingColorSpace.java | 69 --------- .../util/operator/SetNonStrokingDeviceN.java | 105 -------------- .../operator/SetNonStrokingGrayColor.java | 59 -------- .../operator/SetNonStrokingICCBasedColor.java | 53 ------- .../util/operator/SetNonStrokingRGBColor.java | 55 ------- .../operator/SetNonStrokingSeparation.java | 56 -------- .../util/operator/SetStrokingCMYKColor.java | 55 ------- .../util/operator/SetStrokingCalRGBColor.java | 53 ------- .../util/operator/SetStrokingColor.java | 106 -------------- .../util/operator/SetStrokingColorSpace.java | 72 ---------- .../util/operator/SetStrokingDeviceN.java | 105 -------------- .../util/operator/SetStrokingGrayColor.java | 59 -------- .../operator/SetStrokingICCBasedColor.java | 53 ------- .../util/operator/SetStrokingRGBColor.java | 55 ------- .../util/operator/SetStrokingSeparation.java | 56 -------- .../pdfbox/util/operator/SetTextFont.java | 62 -------- .../pdfbox/util/operator/SetTextLeading.java | 43 ------ .../util/operator/SetTextRenderingMode.java | 49 ------- .../pdfbox/util/operator/SetTextRise.java | 49 ------- .../pdfbox/util/operator/SetWordSpacing.java | 44 ------ .../apache/pdfbox/util/operator/ShowText.java | 48 ------- .../pdfbox/util/operator/ShowTextGlyph.java | 71 --------- .../apache/pdfbox/util/operator/package.html | 25 ---- .../pagedrawer/AppendRectangleToPath.java | 77 ---------- .../operator/pagedrawer/BeginInlineImage.java | 106 -------------- .../operator/pagedrawer/ClipEvenOddRule.java | 64 --------- .../operator/pagedrawer/ClipNonZeroRule.java | 64 --------- .../CloseFillEvenOddAndStrokePath.java | 49 ------- .../CloseFillNonZeroAndStrokePath.java | 50 ------- .../util/operator/pagedrawer/ClosePath.java | 62 -------- .../util/operator/pagedrawer/CurveTo.java | 61 -------- .../CurveToReplicateFinalPoint.java | 58 -------- .../CurveToReplicateInitialPoint.java | 61 -------- .../util/operator/pagedrawer/EndPath.java | 46 ------ .../pagedrawer/FillEvenOddAndStrokePath.java | 54 ------- .../operator/pagedrawer/FillEvenOddRule.java | 64 --------- .../pagedrawer/FillNonZeroAndStrokePath.java | 54 ------- .../operator/pagedrawer/FillNonZeroRule.java | 65 --------- .../util/operator/pagedrawer/Invoke.java | 136 ------------------ .../util/operator/pagedrawer/LineTo.java | 54 ------- .../util/operator/pagedrawer/MoveTo.java | 66 --------- .../util/operator/pagedrawer/SHFill.java | 66 --------- .../operator/pagedrawer/SetLineCapStyle.java | 61 -------- .../pagedrawer/SetLineDashPattern.java | 80 ----------- .../operator/pagedrawer/SetLineJoinStyle.java | 61 -------- .../pagedrawer/SetLineMiterLimit.java | 61 -------- .../operator/pagedrawer/SetLineWidth.java | 64 --------- .../util/operator/pagedrawer/StrokePath.java | 85 ----------- .../util/operator/pagedrawer/package.html | 25 ---- 77 files changed, 4614 deletions(-) delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/BeginMarkedContentSequence.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/BeginMarkedContentSequenceWithProperties.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/BeginText.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/CloseAndStrokePath.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/Concatenate.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/EndMarkedContentSequence.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/EndText.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/GRestore.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/GSave.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/Invoke.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/MoveAndShow.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/MoveText.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/MoveTextSetLeading.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/NextLine.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/OperatorProcessor.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetCharSpacing.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetGraphicsStateParameters.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetHorizontalTextScaling.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetLineCapStyle.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetLineDashPattern.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetLineJoinStyle.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetLineMiterLimit.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetLineWidth.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetMatrix.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetMoveAndShow.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingCMYKColor.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingCalRGBColor.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingColor.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingColorSpace.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingDeviceN.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingGrayColor.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingICCBasedColor.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingRGBColor.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingSeparation.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingCMYKColor.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingCalRGBColor.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingColor.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingColorSpace.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingDeviceN.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingGrayColor.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingICCBasedColor.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingRGBColor.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingSeparation.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextFont.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextLeading.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextRenderingMode.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextRise.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetWordSpacing.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/ShowText.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/ShowTextGlyph.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/package.html delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/AppendRectangleToPath.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/BeginInlineImage.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/ClipEvenOddRule.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/ClipNonZeroRule.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CloseFillEvenOddAndStrokePath.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CloseFillNonZeroAndStrokePath.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/ClosePath.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CurveTo.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateFinalPoint.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateInitialPoint.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/EndPath.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddAndStrokePath.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddRule.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroAndStrokePath.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroRule.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/Invoke.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/LineTo.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/MoveTo.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SHFill.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SetLineCapStyle.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SetLineDashPattern.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SetLineJoinStyle.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SetLineMiterLimit.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SetLineWidth.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/StrokePath.java delete mode 100644 fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/package.html diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/BeginMarkedContentSequence.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/BeginMarkedContentSequence.java deleted file mode 100644 index 2db36675c..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/BeginMarkedContentSequence.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.io.IOException; -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSName; -import org.apache.pdfbox.util.PDFMarkedContentExtractor; -import org.apache.pdfbox.util.PDFOperator; -/** - * BMC : Begins a marked-content sequence. - * @author koch - * @version $Revision$ - * - */ -public class BeginMarkedContentSequence extends OperatorProcessor -{ - - /** - * {@inheritDoc} - */ - @Override - public void process(PDFOperator operator, List arguments) - throws IOException - { - COSName tag = null; - for (COSBase argument : arguments) - { - if (argument instanceof COSName) - { - tag = (COSName) argument; - } - } - if (this.context instanceof PDFMarkedContentExtractor) - { - ((PDFMarkedContentExtractor) this.context).beginMarkedContentSequence(tag, null); - } - } - -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/BeginMarkedContentSequenceWithProperties.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/BeginMarkedContentSequenceWithProperties.java deleted file mode 100644 index 4357e1418..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/BeginMarkedContentSequenceWithProperties.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.io.IOException; -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSDictionary; -import org.apache.pdfbox.cos.COSName; -import org.apache.pdfbox.util.PDFMarkedContentExtractor; -import org.apache.pdfbox.util.PDFOperator; -/** - * BDC : Begins a marked-content sequence with property list. - * - * @author koch - * @version $Revision$ - */ -public class BeginMarkedContentSequenceWithProperties extends OperatorProcessor -{ - - /** - * {@inheritDoc} - */ - public void process(PDFOperator operator, List arguments) - throws IOException - { - COSName tag = null; - COSDictionary properties = null; - for (COSBase argument : arguments) - { - if (argument instanceof COSName) - { - tag = (COSName) argument; - } - else if (argument instanceof COSDictionary) - { - properties = (COSDictionary) argument; - } - } - if (this.context instanceof PDFMarkedContentExtractor) - { - ((PDFMarkedContentExtractor) this.context).beginMarkedContentSequence(tag, properties); - } - } - -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/BeginText.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/BeginText.java deleted file mode 100644 index fae97cf2c..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/BeginText.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.util.Matrix; -import org.apache.pdfbox.util.PDFOperator; - -/** - * - * @author Ben Litchfield - * @author Huault : huault@free.fr - * @version $Revision: 1.5 $ - */ -public class BeginText extends OperatorProcessor -{ - - /** - * process : BT : Begin text object. - * @param operator The operator that is being executed. - * @param arguments List - */ - public void process(PDFOperator operator, List arguments) - { - context.setTextMatrix( new Matrix()); - context.setTextLineMatrix( new Matrix() ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/CloseAndStrokePath.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/CloseAndStrokePath.java deleted file mode 100644 index e560da7c7..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/CloseAndStrokePath.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.util.PDFOperator; - -import java.io.IOException; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.2 $ - */ -public class CloseAndStrokePath extends OperatorProcessor -{ - - /** - * s close and stroke the path. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - context.processOperator( "h", arguments ); - context.processOperator( "S", arguments ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/Concatenate.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/Concatenate.java deleted file mode 100644 index 98b04b1c6..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/Concatenate.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; -import java.io.IOException; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.util.Matrix; -import org.apache.pdfbox.util.PDFOperator; - -/** - * - * @author Huault : huault@free.fr - * @version $Revision: 1.5 $ - */ - -public class Concatenate extends OperatorProcessor -{ - - /** - * process : cm : Concatenate matrix to current transformation matrix. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If there is an error processing the operator. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - - //concatenate matrix to current transformation matrix - COSNumber a = (COSNumber) arguments.get(0); - COSNumber b = (COSNumber) arguments.get(1); - COSNumber c = (COSNumber) arguments.get(2); - COSNumber d = (COSNumber) arguments.get(3); - COSNumber e = (COSNumber) arguments.get(4); - COSNumber f = (COSNumber) arguments.get(5); - - Matrix newMatrix = new Matrix(); - newMatrix.setValue(0, 0, a.floatValue()); - newMatrix.setValue(0, 1, b.floatValue()); - newMatrix.setValue(1, 0, c.floatValue()); - newMatrix.setValue(1, 1, d.floatValue()); - newMatrix.setValue(2, 0, e.floatValue()); - newMatrix.setValue(2, 1, f.floatValue()); - - //this line has changed - context.getGraphicsState().setCurrentTransformationMatrix( - newMatrix.multiply( context.getGraphicsState().getCurrentTransformationMatrix() ) ); - - - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/EndMarkedContentSequence.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/EndMarkedContentSequence.java deleted file mode 100644 index 992095ca9..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/EndMarkedContentSequence.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.io.IOException; -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.util.PDFMarkedContentExtractor; -import org.apache.pdfbox.util.PDFOperator; - -/** - * EMC : Ends a marked-content sequence begun by BMC or BDC. - * @author koch - * @version $Revision: $ - */ -public class EndMarkedContentSequence extends OperatorProcessor -{ - - /** - * {@inheritDoc} - */ - public void process(PDFOperator operator, List arguments) - throws IOException - { - if (this.context instanceof PDFMarkedContentExtractor) - { - ((PDFMarkedContentExtractor) this.context).endMarkedContentSequence(); - } - } - -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/EndText.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/EndText.java deleted file mode 100644 index bc7fa6f7e..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/EndText.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.util.PDFOperator; -/** - * - * @author Huault : huault@free.fr - * @version $Revision: 1.4 $ - */ -public class EndText extends OperatorProcessor -{ - - /** - * process : ET : End text object. - * @param operator The operator that is being executed. - * @param arguments List - */ - public void process(PDFOperator operator, List arguments) - { - context.setTextMatrix( null); - context.setTextLineMatrix( null); - } - -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/GRestore.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/GRestore.java deleted file mode 100644 index 896ace9aa..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/GRestore.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.pdmodel.graphics.PDGraphicsState; -import org.apache.pdfbox.util.PDFOperator; - -/** - * - * @author Huault : huault@free.fr - * @version $Revision: 1.4 $ - */ -public class GRestore extends OperatorProcessor -{ - /** - * process : Q : Restore graphics state. - * @param operator The operator that is being executed. - * @param arguments List - */ - public void process(PDFOperator operator, List arguments) - { - context.setGraphicsState( (PDGraphicsState)context.getGraphicsStack().pop() ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/GSave.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/GSave.java deleted file mode 100644 index bca1273d4..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/GSave.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.pdmodel.graphics.PDGraphicsState; -import org.apache.pdfbox.util.PDFOperator; - -/** - * - * @author Huault : huault@free.fr - * @version $Revision: 1.4 $ - */ - -public class GSave extends OperatorProcessor -{ - /** - * process : q : Save graphics state. - * @param operator The operator that is being executed. - * @param arguments List - */ - public void process(PDFOperator operator, List arguments) - { - context.getGraphicsStack().push( (PDGraphicsState)context.getGraphicsState().clone() ); - } - -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/Invoke.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/Invoke.java deleted file mode 100644 index 92c1b7b60..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/Invoke.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSName; -import org.apache.pdfbox.cos.COSStream; -import org.apache.pdfbox.pdmodel.PDPage; -import org.apache.pdfbox.pdmodel.PDResources; -import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObject; -import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectForm; -import org.apache.pdfbox.util.PDFMarkedContentExtractor; -import org.apache.pdfbox.util.PDFOperator; - -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * Invoke named XObject. - * - * @author Ben Litchfield - * @author Mario Ivankovits - * - * @version $Revision: 1.9 $ - */ -public class Invoke extends OperatorProcessor -{ - //private Set inProcess = new TreeSet(); - - /** - * process : Do - Invoke a named xobject. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException If there is an error processing this operator. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - COSName name = (COSName) arguments.get( 0 ); - - Map xobjects = context.getXObjects(); - PDXObject xobject = (PDXObject) xobjects.get(name.getName()); - if (this.context instanceof PDFMarkedContentExtractor) - { - ((PDFMarkedContentExtractor) this.context).xobject(xobject); - } - - if(xobject instanceof PDXObjectForm) - { - PDXObjectForm form = (PDXObjectForm)xobject; - COSStream invoke = (COSStream)form.getCOSObject(); - PDResources pdResources = form.getResources(); - PDPage page = context.getCurrentPage(); - if(pdResources == null) - { - pdResources = page.findResources(); - } - - getContext().processSubStream( page, pdResources, invoke ); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/MoveAndShow.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/MoveAndShow.java deleted file mode 100644 index 58266dd69..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/MoveAndShow.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.util.PDFOperator; - -import java.io.IOException; - -/** - * @author Huault : huault@free.fr - * @version $Revision: 1.5 $ - */ -public class MoveAndShow extends OperatorProcessor -{ - /** - * ' Move to next line and show text. - * @param arguments List - * @param operator The operator that is being executed. - * @throws IOException If there is an error processing the operator. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - // Move to start of next text line, and show text - // - - context.processOperator("T*", null); - context.processOperator("Tj", arguments); - } - -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/MoveText.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/MoveText.java deleted file mode 100644 index d7cac8851..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/MoveText.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.util.Matrix; -import org.apache.pdfbox.util.PDFOperator; - -/** - * - * @author Huault : huault@free.fr - * @version $Revision: 1.4 $ - */ -public class MoveText extends OperatorProcessor -{ - - /** - * process : Td : Move text position. - * @param operator The operator that is being executed. - * @param arguments List - */ - public void process(PDFOperator operator, List arguments) - { - COSNumber x = (COSNumber)arguments.get( 0 ); - COSNumber y = (COSNumber)arguments.get( 1 ); - Matrix td = new Matrix(); - td.setValue( 2, 0, x.floatValue() ); - td.setValue( 2, 1, y.floatValue() ); - context.setTextLineMatrix( td.multiply( context.getTextLineMatrix() ) ); - context.setTextMatrix( context.getTextLineMatrix().copy() ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/MoveTextSetLeading.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/MoveTextSetLeading.java deleted file mode 100644 index 7b399bd84..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/MoveTextSetLeading.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSFloat; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.util.PDFOperator; - -/** - * - * @author Huault : huault@free.fr - * @version $Revision: 1.5 $ - */ -public class MoveTextSetLeading extends OperatorProcessor -{ - - /** - * process : TD Move text position and set leading. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException If there is an error during processing. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - //move text position and set leading - COSNumber y = (COSNumber)arguments.get( 1 ); - - ArrayList args = new ArrayList(); - args.add(new COSFloat(-1*y.floatValue())); - context.processOperator("TL", args); - context.processOperator("Td", arguments); - - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/NextLine.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/NextLine.java deleted file mode 100644 index 34db42fcd..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/NextLine.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSFloat; -import org.apache.pdfbox.util.PDFOperator; - -/** - * - * @author Huault : huault@free.fr - * @version $Revision: 1.5 $ - */ -public class NextLine extends OperatorProcessor -{ - /** - * process : T* Move to start of next text line. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException If there is an error during processing. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - //move to start of next text line - ArrayList args = new ArrayList(); - args.add(new COSFloat(0.0f)); - // this must be -leading instead of just leading as written in the - // specification (p.369) the acrobat reader seems to implement it the same way - args.add(new COSFloat(-1*context.getGraphicsState().getTextState().getLeading())); - // use Td instead of repeating code - context.processOperator("Td", args); - - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/OperatorProcessor.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/OperatorProcessor.java deleted file mode 100644 index 610991e13..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/OperatorProcessor.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.PDFStreamEngine; -import java.util.List; -import java.io.IOException; - -/** - * @author Huault : huault@free.fr - * @version $Revision: 1.3 $ - */ -public abstract class OperatorProcessor -{ - - /** - * The stream engine processing context. - */ - protected PDFStreamEngine context = null; - - /** - * Constructor. - * - */ - protected OperatorProcessor() - { - } - - /** - * Get the context for processing. - * - * @return The processing context. - */ - protected PDFStreamEngine getContext() - { - return context; - } - - /** - * Set the processing context. - * - * @param ctx The context for processing. - */ - public void setContext(PDFStreamEngine ctx) - { - context = ctx; - } - - /** - * process the operator. - * @param operator The operator that is being processed. - * @param arguments arguments needed by this operator. - * - * @throws IOException If there is an error processing the operator. - */ - public abstract void process(PDFOperator operator, List arguments) throws IOException; -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetCharSpacing.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetCharSpacing.java deleted file mode 100644 index da1c13415..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetCharSpacing.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.util.PDFOperator; - -/** - * - * @author Huault : huault@free.fr - * @version $Revision: 1.5 $ - */ -public class SetCharSpacing extends OperatorProcessor -{ - /** - * process : Tc Set character spacing. - * @param operator The operator that is being executed. - * @param arguments List - */ - public void process(PDFOperator operator, List arguments) - { - //set character spacing - if( arguments.size() > 0 ) - { - //There are some documents which are incorrectly structured, and have - //a wrong number of arguments to this, so we will assume the last argument - //in the list - Object charSpacing = arguments.get( arguments.size()-1 ); - if( charSpacing instanceof COSNumber ) - { - COSNumber characterSpacing = (COSNumber)charSpacing; - context.getGraphicsState().getTextState().setCharacterSpacing( characterSpacing.floatValue() ); - } - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetGraphicsStateParameters.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetGraphicsStateParameters.java deleted file mode 100644 index 3d17877cc..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetGraphicsStateParameters.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSName; -import org.apache.pdfbox.pdmodel.graphics.PDExtendedGraphicsState; -import org.apache.pdfbox.util.PDFOperator; - -import java.io.IOException; - -/** - *

Structal modification of the PDFEngine class : - * the long sequence of conditions in processOperator is remplaced by - * this strategy pattern.

- * - * @author Ben Litchfield - * @version $Revision: 1.5 $ - */ - -public class SetGraphicsStateParameters extends OperatorProcessor -{ - /** - * gs Set parameters from graphics state parameter dictionary. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - //set parameters from graphics state parameter dictionary - COSName graphicsName = (COSName)arguments.get( 0 ); - PDExtendedGraphicsState gs = (PDExtendedGraphicsState)context.getGraphicsStates().get( graphicsName.getName() ); - gs.copyIntoGraphicsState( context.getGraphicsState() ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetHorizontalTextScaling.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetHorizontalTextScaling.java deleted file mode 100644 index 62c67d584..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetHorizontalTextScaling.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.util.PDFOperator; - -import java.io.IOException; - -/** - *

Structal modification of the PDFEngine class : - * the long sequence of conditions in processOperator is remplaced by - * this strategy pattern.

- * - * @author Ben Litchfield - * @version $Revision: 1.5 $ - */ - -public class SetHorizontalTextScaling extends OperatorProcessor -{ - /** - * Tz Set horizontal text scaling. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - COSNumber scaling = (COSNumber)arguments.get(0); - context.getGraphicsState().getTextState().setHorizontalScalingPercent( scaling.floatValue() ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetLineCapStyle.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetLineCapStyle.java deleted file mode 100644 index 855ab8b84..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetLineCapStyle.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.util.PDFOperator; - -import java.io.IOException; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.1 $ - */ -public class SetLineDashPattern extends OperatorProcessor -{ - - /** - * Set the line dash pattern. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - COSArray dashArray = (COSArray)arguments.get( 0 ); - int dashPhase = ((COSNumber)arguments.get( 1 )).intValue(); - PDLineDashPattern lineDash = new PDLineDashPattern( dashArray, dashPhase ); - context.getGraphicsState().setLineDashPattern( lineDash ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetLineJoinStyle.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetLineJoinStyle.java deleted file mode 100644 index 88964f2ca..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetLineJoinStyle.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.util.PDFOperator; - -import java.io.IOException; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Structal modification of the PDFEngine class : - * the long sequence of conditions in processOperator is remplaced by - * this strategy pattern.

- * - * @author
Andreas Lehmkühler - * @version $Revision: 1.0 $ - */ - -public class SetLineMiterLimit extends OperatorProcessor -{ - /** - * w Set miter limit. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - COSNumber miterLimit = (COSNumber)arguments.get( 0 ); - context.getGraphicsState().setMiterLimit( miterLimit.doubleValue() ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetLineWidth.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetLineWidth.java deleted file mode 100644 index d36be9413..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetLineWidth.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.util.PDFOperator; - -import java.io.IOException; - -/** - *

Structal modification of the PDFEngine class : - * the long sequence of conditions in processOperator is remplaced by - * this strategy pattern.

- * - * @author Ben Litchfield - * @version $Revision: 1.5 $ - */ - -public class SetLineWidth extends OperatorProcessor -{ - /** - * w Set line width. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - COSNumber width = (COSNumber)arguments.get( 0 ); - context.getGraphicsState().setLineWidth( width.doubleValue() ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetMatrix.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetMatrix.java deleted file mode 100644 index 7499ea603..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetMatrix.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.util.Matrix; -import org.apache.pdfbox.util.PDFOperator; - -/** - * @author Huault : huault@free.fr - * @version $Revision: 1.4 $ - */ - -public class SetMatrix extends OperatorProcessor -{ - - /** - * Tm Set text matrix and text line matrix. - * @param operator The operator that is being executed. - * @param arguments List - */ - public void process(PDFOperator operator, List arguments) - { - //Set text matrix and text line matrix - COSNumber a = (COSNumber)arguments.get( 0 ); - COSNumber b = (COSNumber)arguments.get( 1 ); - COSNumber c = (COSNumber)arguments.get( 2 ); - COSNumber d = (COSNumber)arguments.get( 3 ); - COSNumber e = (COSNumber)arguments.get( 4 ); - COSNumber f = (COSNumber)arguments.get( 5 ); - - Matrix textMatrix = new Matrix(); - textMatrix.setValue( 0, 0, a.floatValue() ); - textMatrix.setValue( 0, 1, b.floatValue() ); - textMatrix.setValue( 1, 0, c.floatValue() ); - textMatrix.setValue( 1, 1, d.floatValue() ); - textMatrix.setValue( 2, 0, e.floatValue() ); - textMatrix.setValue( 2, 1, f.floatValue() ); - context.setTextMatrix( textMatrix ); - context.setTextLineMatrix( textMatrix.copy() ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetMoveAndShow.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetMoveAndShow.java deleted file mode 100644 index 778875b13..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetMoveAndShow.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.util.PDFOperator; - -import java.io.IOException; - -/** - * @author Huault : huault@free.fr - * @version $Revision: 1.6 $ - */ - -public class SetMoveAndShow extends OperatorProcessor -{ - /** - * " Set word and character spacing, move to next line, and show text. - * @param operator The operator that is being executed. - * @param arguments List. - * @throws IOException If there is an error processing the operator. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - //Set word and character spacing, move to next line, and show text - // - context.processOperator("Tw", arguments.subList(0,1)); - context.processOperator("Tc", arguments.subList(1,2)); - context.processOperator("'", arguments.subList(2,3)); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingCMYKColor.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingCMYKColor.java deleted file mode 100644 index 8b6b0d17a..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingCMYKColor.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.io.IOException; -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorState; -import org.apache.pdfbox.pdmodel.graphics.color.PDDeviceCMYK; -import org.apache.pdfbox.util.PDFOperator; - -/** - *

Set the non stroking color space.

- * - * @author Ben Litchfield - * @version $Revision: 1.4 $ - */ -public class SetNonStrokingCMYKColor extends OperatorProcessor -{ - /** - * k Set color space for non stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PDColorSpace cs = PDDeviceCMYK.INSTANCE; - PDColorState colorInstance = context.getGraphicsState().getNonStrokingColor(); - colorInstance.setColorSpace( cs ); - float[] values = new float[4]; - for( int i=0; iSet the non stroking color space.

- * - * @author Ben Litchfield - * @version $Revision: 1.3 $ - */ -public class SetNonStrokingCalRGBColor extends OperatorProcessor -{ - /** - * rg Set color space for non stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PDColorState colorInstance = context.getGraphicsState().getNonStrokingColor(); - float[] values = new float[3]; - for( int i=0; iSet the non stroking color space.

- * - * @author Andreas Lehmkühler - * @version $Revision: 1.0 $ - */ -public class SetNonStrokingColor extends OperatorProcessor -{ - - /** - * Log instance. - */ - private static final Log log = LogFactory.getLog(SetNonStrokingColor.class); - - /** - * sc,scn Set color space for non stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PDColorSpace colorSpace = context.getGraphicsState().getNonStrokingColor().getColorSpace(); - if (colorSpace != null) - { - OperatorProcessor newOperator = null; - if (colorSpace instanceof PDDeviceGray) - { - newOperator = new SetNonStrokingGrayColor(); - } - else if (colorSpace instanceof PDDeviceRGB) - { - newOperator = new SetNonStrokingRGBColor(); - } - else if (colorSpace instanceof PDDeviceCMYK) - { - newOperator = new SetNonStrokingCMYKColor(); - } - else if (colorSpace instanceof PDICCBased) - { - newOperator = new SetNonStrokingICCBasedColor(); - } - else if (colorSpace instanceof PDCalRGB) - { - newOperator = new SetNonStrokingCalRGBColor(); - } - else if (colorSpace instanceof PDSeparation) - { - newOperator = new SetNonStrokingSeparation(); - } - else if (colorSpace instanceof PDDeviceN) - { - newOperator = new SetNonStrokingDeviceN(); - } - - if (newOperator != null) - { - newOperator.setContext(getContext()); - newOperator.process(operator, arguments); - } - else - { - log.warn("Not supported colorspace "+colorSpace.getName() - + " within operator "+operator.getOperation()); - } - } - else - { - log.warn("Colorspace not found in "+getClass().getName()+".process!!"); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingColorSpace.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingColorSpace.java deleted file mode 100644 index 539b1bae8..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingColorSpace.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.io.IOException; -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSName; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorState; -import org.apache.pdfbox.pdmodel.graphics.color.PDDeviceCMYK; -import org.apache.pdfbox.util.PDFOperator; - -/** - *

Set the non stroking color space.

- * - * @author Ben Litchfield - * @version $Revision: 1.4 $ - */ -public class SetNonStrokingColorSpace extends OperatorProcessor -{ - private static final float[] EMPTY_FLOAT_ARRAY = new float[0]; - - /** - * cs Set color space for non stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { -// (PDF 1.1) Set color space for stroking operations - COSName name = (COSName)arguments.get( 0 ); - PDColorSpace cs = PDColorSpaceFactory.createColorSpace( name, context.getColorSpaces() ); - PDColorState colorInstance = context.getGraphicsState().getNonStrokingColor(); - colorInstance.setColorSpace( cs ); - int numComponents = cs.getNumberOfComponents(); - float[] values = EMPTY_FLOAT_ARRAY; - if( numComponents >= 0 ) - { - values = new float[numComponents]; - for( int i=0; i arguments) throws IOException - { - PDColorState colorInstance = context.getGraphicsState().getNonStrokingColor(); - PDColorSpace colorSpace = colorInstance.getColorSpace(); - - if (colorSpace != null) - { - List argList = arguments; - OperatorProcessor newOperator = null; - - if (colorSpace instanceof PDDeviceN) { - PDDeviceN sep = (PDDeviceN) colorSpace; - colorSpace = sep.getAlternateColorSpace(); - argList = sep.calculateColorValues(arguments).toList(); - } - - if (colorSpace instanceof PDDeviceGray) - { - newOperator = new SetNonStrokingGrayColor(); - } - else if (colorSpace instanceof PDDeviceRGB) - { - newOperator = new SetNonStrokingRGBColor(); - } - else if (colorSpace instanceof PDDeviceCMYK) - { - newOperator = new SetNonStrokingCMYKColor(); - } - else if (colorSpace instanceof PDICCBased) - { - newOperator = new SetNonStrokingICCBasedColor(); - } - else if (colorSpace instanceof PDCalRGB) - { - newOperator = new SetNonStrokingCalRGBColor(); - } - - if (newOperator != null) - { - colorInstance.setColorSpace(colorSpace); - newOperator.setContext(getContext()); - newOperator.process(operator, argList); - } - else - { - log.warn("Not supported colorspace "+colorSpace.getName() - + " within operator "+operator.getOperation()); - } - } - - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingGrayColor.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingGrayColor.java deleted file mode 100644 index 27b34101a..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingGrayColor.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.io.IOException; -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorState; -import org.apache.pdfbox.pdmodel.graphics.color.PDDeviceGray; -import org.apache.pdfbox.util.PDFOperator; - -/** - *

Set the non stroking color space.

- * - * @author Ben Litchfield - * @version $Revision: 1.1 $ - */ -public class SetNonStrokingGrayColor extends OperatorProcessor -{ - /** - * rg Set color space for non stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PDColorSpace cs = new PDDeviceGray(); - PDColorState colorInstance = context.getGraphicsState().getNonStrokingColor(); - colorInstance.setColorSpace( cs ); - float[] values = new float[1]; - if( arguments.size() >= 1 ) - { - values[0] = ((COSNumber)arguments.get( 0 )).floatValue(); - } - else - { - throw new IOException( "Error: Expected at least one argument when setting non stroking gray color"); - } - colorInstance.setColorSpaceValue( values ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingICCBasedColor.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingICCBasedColor.java deleted file mode 100644 index d124cf5f8..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetNonStrokingICCBasedColor.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.io.IOException; -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorState; -import org.apache.pdfbox.util.PDFOperator; - -/** - * - * @author Andreas Lehmkühler - * @version $Revision: 1.0 $ - */ -public class SetNonStrokingICCBasedColor extends OperatorProcessor -{ - /** - * scn Set color space for non stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PDColorState colorInstance = context.getGraphicsState().getNonStrokingColor(); - PDColorSpace cs = colorInstance.getColorSpace(); - int numberOfComponents = cs.getNumberOfComponents(); - float[] values = new float[numberOfComponents]; - for( int i=0; iSet the non stroking color space.

- * - * @author Ben Litchfield - * @version $Revision: 1.3 $ - */ -public class SetNonStrokingRGBColor extends OperatorProcessor -{ - /** - * rg Set color space for non stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PDColorSpace cs = PDDeviceRGB.INSTANCE; - PDColorState colorInstance = context.getGraphicsState().getNonStrokingColor(); - colorInstance.setColorSpace( cs ); - float[] values = new float[3]; - for( int i=0; iDaniel Wilson - * @version $Revision: 1.0 $ - */ -public class SetNonStrokingSeparation extends OperatorProcessor -{ - - /** - * scn Set color space for non stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PDColorState colorInstance = context.getGraphicsState().getNonStrokingColor(); - PDColorSpace colorSpace = colorInstance.getColorSpace(); - - if (colorSpace != null) - { - PDSeparation sep = (PDSeparation) colorSpace; - colorSpace = sep.getAlternateColorSpace(); - COSArray values = sep.calculateColorValues(arguments.get(0)); - colorInstance.setColorSpaceValue(values.toFloatArray()); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingCMYKColor.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingCMYKColor.java deleted file mode 100644 index 2df4725b2..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingCMYKColor.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.io.IOException; -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorState; -import org.apache.pdfbox.pdmodel.graphics.color.PDDeviceCMYK; -import org.apache.pdfbox.util.PDFOperator; - -/** - *

Structal modification of the PDFEngine class : - * the long sequence of conditions in processOperator is remplaced by - * this strategy pattern.

- * - * @author Ben Litchfield - * @version $Revision: 1.4 $ - */ -public class SetStrokingCMYKColor extends OperatorProcessor -{ - /** - * K Set color space for stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PDColorState color = context.getGraphicsState().getStrokingColor(); - color.setColorSpace( PDDeviceCMYK.INSTANCE ); - float[] values = new float[4]; - for( int i=0; iStructural modification of the PDFEngine class : - * the long sequence of conditions in processOperator is replaced by - * this strategy pattern.

- * - * @author Ben Litchfield - * @version $Revision: 1.3 $ - */ -public class SetStrokingCalRGBColor extends OperatorProcessor -{ - /** - * RG Set color space for stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PDColorState color = context.getGraphicsState().getStrokingColor(); - float[] values = new float[3]; - for( int i=0; iSet the stroking color space.

- * - * @author Andreas Lehmkühler - * @version $Revision: 1.0 $ - */ -public class SetStrokingColor extends OperatorProcessor -{ - - /** - * Log instance. - */ - private static final Log log = LogFactory.getLog(SetStrokingColor.class); - - /** - * SC,SCN Set color space for stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PDColorSpace colorSpace = context.getGraphicsState().getStrokingColor().getColorSpace(); - if (colorSpace != null) - { - OperatorProcessor newOperator = null; - if (colorSpace instanceof PDDeviceGray) - { - newOperator = new SetStrokingGrayColor(); - } - else if (colorSpace instanceof PDDeviceRGB) - { - newOperator = new SetStrokingRGBColor(); - } - else if (colorSpace instanceof PDDeviceCMYK) - { - newOperator = new SetStrokingCMYKColor(); - } - else if (colorSpace instanceof PDICCBased) - { - newOperator = new SetStrokingICCBasedColor(); - } - else if (colorSpace instanceof PDCalRGB) - { - newOperator = new SetStrokingCalRGBColor(); - } - else if (colorSpace instanceof PDSeparation) - { - newOperator = new SetStrokingSeparation(); - } - else if (colorSpace instanceof PDDeviceN) - { - newOperator = new SetStrokingDeviceN(); - } - - if (newOperator != null) - { - newOperator.setContext(getContext()); - newOperator.process(operator, arguments); - } - else - { - log.info("Not supported colorspace "+colorSpace.getName() - + " within operator "+operator.getOperation()); - } - } - else - { - log.warn("Colorspace not found in "+getClass().getName()+".process!!"); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingColorSpace.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingColorSpace.java deleted file mode 100644 index eeaf34bbe..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingColorSpace.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.io.IOException; -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSName; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorState; -import org.apache.pdfbox.pdmodel.graphics.color.PDDeviceCMYK; -import org.apache.pdfbox.util.PDFOperator; - -/** - *

Structal modification of the PDFEngine class : - * the long sequence of conditions in processOperator is remplaced by - * this strategy pattern.

- * - * @author Ben Litchfield - * @version $Revision: 1.5 $ - */ - -public class SetStrokingColorSpace extends OperatorProcessor -{ - private static final float[] EMPTY_FLOAT_ARRAY = new float[0]; - - /** - * CS Set color space for stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - //(PDF 1.1) Set color space for stroking operations - COSName name = (COSName)arguments.get( 0 ); - PDColorSpace cs = PDColorSpaceFactory.createColorSpace( name, context.getColorSpaces() ); - PDColorState color = context.getGraphicsState().getStrokingColor(); - color.setColorSpace( cs ); - int numComponents = cs.getNumberOfComponents(); - float[] values = EMPTY_FLOAT_ARRAY; - if( numComponents >= 0 ) - { - values = new float[numComponents]; - for( int i=0; i arguments) throws IOException - { - PDColorState color = context.getGraphicsState().getStrokingColor(); - PDColorSpace colorSpace = color.getColorSpace(); - - if (colorSpace != null) - { - OperatorProcessor newOperator = null; - List argList = arguments; - - if (colorSpace instanceof PDDeviceN) - { - PDDeviceN sep = (PDDeviceN) colorSpace; - colorSpace = sep.getAlternateColorSpace(); - argList = sep.calculateColorValues(arguments).toList(); - } - - if (colorSpace instanceof PDDeviceGray) - { - newOperator = new SetStrokingGrayColor(); - } - else if (colorSpace instanceof PDDeviceRGB) - { - newOperator = new SetStrokingRGBColor(); - } - else if (colorSpace instanceof PDDeviceCMYK) - { - newOperator = new SetStrokingCMYKColor(); - } - else if (colorSpace instanceof PDICCBased) - { - newOperator = new SetStrokingICCBasedColor(); - } - else if (colorSpace instanceof PDCalRGB) - { - newOperator = new SetStrokingCalRGBColor(); - } - - if (newOperator != null) - { - color.setColorSpace(colorSpace); - newOperator.setContext(getContext()); - newOperator.process(operator, argList); - } - else - { - log.warn("Not supported colorspace "+colorSpace.getName() - + " within operator "+operator.getOperation()); - } - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingGrayColor.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingGrayColor.java deleted file mode 100644 index 41226461e..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingGrayColor.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.io.IOException; -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorState; -import org.apache.pdfbox.pdmodel.graphics.color.PDDeviceGray; -import org.apache.pdfbox.util.PDFOperator; - -/** - *

Structal modification of the PDFEngine class : - * the long sequence of conditions in processOperator is remplaced by - * this strategy pattern.

- * - * @author Ben Litchfield - * @version $Revision: 1.1 $ - */ -public class SetStrokingGrayColor extends OperatorProcessor -{ - /** - * RG Set color space for stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PDColorState color = context.getGraphicsState().getStrokingColor(); - color.setColorSpace( new PDDeviceGray() ); - float[] values = new float[1]; - if( arguments.size() >= 1 ) - { - values[0] = ((COSNumber)arguments.get( 0 )).floatValue(); - } - else - { - throw new IOException( "Error: Expected at least one argument when setting non stroking gray color"); - } - color.setColorSpaceValue( values ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingICCBasedColor.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingICCBasedColor.java deleted file mode 100644 index 4e3009c61..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetStrokingICCBasedColor.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.io.IOException; -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace; -import org.apache.pdfbox.pdmodel.graphics.color.PDColorState; -import org.apache.pdfbox.util.PDFOperator; - -/** - * - * @author Andreas Lehmkühler - * @version $Revision: 1.0 $ - */ -public class SetStrokingICCBasedColor extends OperatorProcessor -{ - /** - * scn Set color space for stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PDColorState color = context.getGraphicsState().getStrokingColor(); - PDColorSpace cs = color.getColorSpace(); - int numberOfComponents = cs.getNumberOfComponents(); - float[] values = new float[numberOfComponents]; - for( int i=0; iStructal modification of the PDFEngine class : - * the long sequence of conditions in processOperator is remplaced by - * this strategy pattern.

- * - * @author Ben Litchfield - * @version $Revision: 1.3 $ - */ -public class SetStrokingRGBColor extends OperatorProcessor -{ - /** - * RG Set color space for stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PDColorState color = context.getGraphicsState().getStrokingColor(); - color.setColorSpace( PDDeviceRGB.INSTANCE ); - float[] values = new float[3]; - for( int i=0; iDaniel Wilson - * @version $Revision: 1.0 $ - */ -public class SetStrokingSeparation extends OperatorProcessor -{ - - /** - * scn Set color space for non stroking operations. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PDColorState colorInstance = context.getGraphicsState().getStrokingColor(); - PDColorSpace colorSpace = colorInstance.getColorSpace(); - - if (colorSpace != null) - { - PDSeparation sep = (PDSeparation) colorSpace; - colorSpace = sep.getAlternateColorSpace(); - COSArray values = sep.calculateColorValues(arguments.get(0)); - colorInstance.setColorSpaceValue(values.toFloatArray()); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextFont.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextFont.java deleted file mode 100644 index 5beeeb1ed..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextFont.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSName; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.pdmodel.font.PDFont; -import org.apache.pdfbox.util.PDFOperator; - -import java.io.IOException; - -/** - * @author Huault : huault@free.fr - * @version $Revision: 1.5 $ - */ - -public class SetTextFont extends OperatorProcessor -{ - /** - * Tf selectfont Set text font and size. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - //there are some documents that are incorrectly structured and - //arguments are in the wrong spot, so we will silently ignore them - //if there are no arguments - if( arguments.size() >= 2 ) - { - //set font and size - COSName fontName = (COSName)arguments.get( 0 ); - float fontSize = ((COSNumber)arguments.get( 1 ) ).floatValue(); - context.getGraphicsState().getTextState().setFontSize( fontSize ); - - context.getGraphicsState().getTextState().setFont( (PDFont)context.getFonts().get( fontName.getName() ) ); - if( context.getGraphicsState().getTextState().getFont() == null ) - { - throw new IOException( "Error: Could not find font(" + fontName + ") in map=" + context.getFonts() ); - } - } - } - -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextLeading.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextLeading.java deleted file mode 100644 index 8d07b0412..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextLeading.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.util.PDFOperator; - -/** - * @author Huault : huault@free.fr - * @version $Revision: 1.4 $ - */ - -public class SetTextLeading extends OperatorProcessor -{ - /** - * TL Set text leading. - * @param operator The operator that is being executed. - * @param arguments List - */ - public void process(PDFOperator operator, List arguments) - { - COSNumber leading = (COSNumber)arguments.get( 0 ); - context.getGraphicsState().getTextState().setLeading( leading.floatValue() ); - } - -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextRenderingMode.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextRenderingMode.java deleted file mode 100644 index ae40667e6..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextRenderingMode.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.util.PDFOperator; - -import java.io.IOException; - -/** - *

Structal modification of the PDFEngine class : - * the long sequence of conditions in processOperator is remplaced by - * this strategy pattern.

- * - * @author Ben Litchfield - * @version $Revision: 1.5 $ - */ - -public class SetTextRenderingMode extends OperatorProcessor -{ - /** - * Tr Set text rendering mode. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - COSNumber mode = (COSNumber)arguments.get( 0 ); - context.getGraphicsState().getTextState().setRenderingMode( mode.intValue() ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextRise.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextRise.java deleted file mode 100644 index e56472879..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetTextRise.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.util.PDFOperator; - -import java.io.IOException; - -/** - *

Structal modification of the PDFEngine class : - * the long sequence of conditions in processOperator is remplaced by - * this strategy pattern.

- * - * @author Ben Litchfield - * @version $Revision: 1.5 $ - */ - -public class SetTextRise extends OperatorProcessor -{ - /** - * Ts Set text rise. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - COSNumber rise = (COSNumber)arguments.get(0); - context.getGraphicsState().getTextState().setRise( rise.floatValue() ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetWordSpacing.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetWordSpacing.java deleted file mode 100644 index bed107f42..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/SetWordSpacing.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.util.PDFOperator; - -/** - * @author Huault : huault@free.fr - * @version $Revision: 1.4 $ - */ - -public class SetWordSpacing extends OperatorProcessor -{ - /** - * Tw Set word spacing. - * @param operator The operator that is being executed. - * @param arguments List - */ - public void process(PDFOperator operator, List arguments) - { - //set word spacing - COSNumber wordSpacing = (COSNumber)arguments.get( 0 ); - context.getGraphicsState().getTextState().setWordSpacing( wordSpacing.floatValue() ); - } - -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/ShowText.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/ShowText.java deleted file mode 100644 index 3731368da..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/ShowText.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSString; -import org.apache.pdfbox.util.PDFOperator; - -import java.io.IOException; - -/** - * @author Huault : huault@free.fr - * @version $Revision: 1.4 $ - */ - -public class ShowText extends OperatorProcessor -{ - - /** - * Tj show Show text. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException If there is an error processing this operator. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - COSString string = (COSString)arguments.get( 0 ); - context.processEncodedText( string.getBytes() ); - } - -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/ShowTextGlyph.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/ShowTextGlyph.java deleted file mode 100644 index c1d1b83df..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/ShowTextGlyph.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator; - -import java.util.List; - -import org.apache.pdfbox.util.Matrix; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.cos.COSArray; -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import java.io.IOException; -import org.apache.pdfbox.cos.COSString; - -/** - * @author Huault : huault@free.fr - * @version $Revision: 1.6 $ - */ - -public class ShowTextGlyph extends OperatorProcessor -{ - /** - * TJ Show text, allowing individual glyph positioning. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If there is an error processing this operator. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - COSArray array = (COSArray)arguments.get( 0 ); - int arraySize = array.size(); - float fontsize = context.getGraphicsState().getTextState().getFontSize(); - float horizontalScaling = context.getGraphicsState().getTextState().getHorizontalScalingPercent()/100; - for( int i=0; i - - - - - - -This package contains implementations of all of the PDF operators. - - diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/AppendRectangleToPath.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/AppendRectangleToPath.java deleted file mode 100644 index 0b04318da..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/AppendRectangleToPath.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.awt.geom.GeneralPath; -import java.awt.geom.Point2D; -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.3 $ - */ -public class AppendRectangleToPath extends OperatorProcessor -{ - - - /** - * process : re : append rectangle to path. - * @param operator The operator that is being executed. - * @param arguments List - */ - public void process(PDFOperator operator, List arguments) - { - PageDrawer drawer = (PageDrawer)context; - - COSNumber x = (COSNumber)arguments.get( 0 ); - COSNumber y = (COSNumber)arguments.get( 1 ); - COSNumber w = (COSNumber)arguments.get( 2 ); - COSNumber h = (COSNumber)arguments.get( 3 ); - - double x1 = x.doubleValue(); - double y1 = y.doubleValue(); - // create a pair of coordinates for the transformation - double x2 = w.doubleValue()+x1; - double y2 = h.doubleValue()+y1; - - Point2D startCoords = drawer.transformedPoint(x1,y1); - Point2D endCoords = drawer.transformedPoint(x2,y2); - - float width = (float)(endCoords.getX()-startCoords.getX()); - float height = (float)(endCoords.getY()-startCoords.getY()); - float xStart = (float)startCoords.getX(); - float yStart = (float)startCoords.getY(); - - // To ensure that the path is created in the right direction, - // we have to create it by combining single lines instead of - // creating a simple rectangle - GeneralPath path = drawer.getLinePath(); - path.moveTo(xStart, yStart); - path.lineTo(xStart+width, yStart); - path.lineTo(xStart+width, yStart+height); - path.lineTo(xStart, yStart+height); - path.lineTo(xStart, yStart); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/BeginInlineImage.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/BeginInlineImage.java deleted file mode 100644 index 0a41c42de..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/BeginInlineImage.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.awt.geom.AffineTransform; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.pdmodel.PDPage; -import org.apache.pdfbox.pdmodel.graphics.xobject.PDInlinedImage; -import org.apache.pdfbox.util.ImageParameters; -import org.apache.pdfbox.util.Matrix; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.2 $ - */ -public class BeginInlineImage extends OperatorProcessor -{ - - /** - * Log instance. - */ - private static final Log log = LogFactory.getLog(BeginInlineImage.class); - - /** - * process : BI : begin inline image. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If there is an error displaying the inline image. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PageDrawer drawer = (PageDrawer)context; - PDPage page = drawer.getPage(); - //begin inline image object - ImageParameters params = operator.getImageParameters(); - PDInlinedImage image = new PDInlinedImage(); - image.setImageParameters( params ); - image.setImageData( operator.getImageData() ); - BufferedImage awtImage = image.createImage( context.getColorSpaces() ); - - if (awtImage == null) - { - log.warn("BeginInlineImage.process(): createImage returned NULL"); - return; - } - int imageWidth = awtImage.getWidth(); - int imageHeight = awtImage.getHeight(); - double pageHeight = drawer.getPageSize().getHeight(); - - Matrix ctm = drawer.getGraphicsState().getCurrentTransformationMatrix(); - int pageRotation = page.findRotation(); - - AffineTransform ctmAT = ctm.createAffineTransform(); - ctmAT.scale(1f/imageWidth, 1f/imageHeight); - Matrix rotationMatrix = new Matrix(); - rotationMatrix.setFromAffineTransform( ctmAT ); - // calculate the inverse rotation angle - // scaleX = m00 = cos - // shearX = m01 = -sin - // tan = sin/cos - double angle = Math.atan(ctmAT.getShearX()/ctmAT.getScaleX()); - Matrix translationMatrix = null; - if (pageRotation == 0 || pageRotation == 180) - { - translationMatrix = Matrix.getTranslatingInstance((float)(Math.sin(angle)*ctm.getXScale()), (float)(pageHeight-2*ctm.getYPosition()-Math.cos(angle)*ctm.getYScale())); - } - else if (pageRotation == 90 || pageRotation == 270) - { - translationMatrix = Matrix.getTranslatingInstance((float)(Math.sin(angle)*ctm.getYScale()), (float)(pageHeight-2*ctm.getYPosition())); - } - rotationMatrix = rotationMatrix.multiply(translationMatrix); - rotationMatrix.setValue(0, 1, (-1)*rotationMatrix.getValue(0, 1)); - rotationMatrix.setValue(1, 0, (-1)*rotationMatrix.getValue(1, 0)); - AffineTransform at = new AffineTransform( - rotationMatrix.getValue(0,0),rotationMatrix.getValue(0,1), - rotationMatrix.getValue(1,0), rotationMatrix.getValue( 1, 1), - rotationMatrix.getValue(2,0),rotationMatrix.getValue(2,1) - ); - drawer.drawImage(awtImage, at); - } -} \ No newline at end of file diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/ClipEvenOddRule.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/ClipEvenOddRule.java deleted file mode 100644 index cc642bc6e..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/ClipEvenOddRule.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.awt.geom.GeneralPath; -import java.io.IOException; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Daniel Wilson - * @version $Revision: 1.1 $ - */ -public class ClipEvenOddRule extends OperatorProcessor -{ - - /** - * Log instance. - */ - private static final Log log = LogFactory.getLog(ClipEvenOddRule.class); - - /** - * process : W* : set clipping path using even odd rule. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException if there is an error during execution. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - - try - { - PageDrawer drawer = (PageDrawer)context; - drawer.setClippingPath(GeneralPath.WIND_EVEN_ODD); - } - catch (Exception e) - { - log.warn(e, e); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/ClipNonZeroRule.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/ClipNonZeroRule.java deleted file mode 100644 index bff5046c1..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/ClipNonZeroRule.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.awt.geom.GeneralPath; -import java.io.IOException; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Daniel Wilson - * @version $Revision: 1.1 $ - */ -public class ClipNonZeroRule extends OperatorProcessor -{ - - /** - * Log instance. - */ - private static final Log log = LogFactory.getLog(ClipNonZeroRule.class); - - /** - * process : W : Set the clipping path using non zero winding rule. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException If there is an error during the processing. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - - try - { - PageDrawer drawer = (PageDrawer)context; - drawer.setClippingPath(GeneralPath.WIND_NON_ZERO); - } - catch (Exception e) - { - log.warn(e, e); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CloseFillEvenOddAndStrokePath.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CloseFillEvenOddAndStrokePath.java deleted file mode 100644 index a3bc43d63..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CloseFillEvenOddAndStrokePath.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.util.PDFOperator; -import java.io.IOException; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Andreas Lehmkühler - * @version $Revision: 1.0 $ - */ -public class CloseFillEvenOddAndStrokePath extends org.apache.pdfbox.util.operator.OperatorProcessor -{ - - /** - * fill and stroke the path. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - context.processOperator( "h", arguments ); - - context.processOperator( "f*", arguments ); - - context.processOperator( "S", arguments ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CloseFillNonZeroAndStrokePath.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CloseFillNonZeroAndStrokePath.java deleted file mode 100644 index a076f6d53..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CloseFillNonZeroAndStrokePath.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; -import java.io.IOException; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.1 $ - */ -public class CloseFillNonZeroAndStrokePath extends OperatorProcessor -{ - - /** - * fill and stroke the path. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - context.processOperator( "h", arguments ); - - context.processOperator( "f", arguments ); - - context.processOperator( "S", arguments ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/ClosePath.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/ClosePath.java deleted file mode 100644 index e13323bae..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/ClosePath.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.util.List; -import java.io.IOException; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.3 $ - */ -public class ClosePath extends OperatorProcessor -{ - - /** - * Log instance. - */ - private static final Log log = LogFactory.getLog(ClosePath.class); - - /** - * process : h : Close path. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException if something went wrong during logging - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PageDrawer drawer = (PageDrawer)context; - try - { - drawer.getLinePath().closePath(); - } - catch( Throwable t ) - { - log.warn(t, t); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CurveTo.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CurveTo.java deleted file mode 100644 index 11755747c..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CurveTo.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.util.List; -import java.awt.geom.Point2D; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.2 $ - */ -public class CurveTo extends OperatorProcessor -{ - - - /** - * process : c : Append curved segment to path. - * @param operator The operator that is being executed. - * @param arguments List - */ - public void process(PDFOperator operator, List arguments) - { - PageDrawer drawer = (PageDrawer)context; - - COSNumber x1 = (COSNumber)arguments.get( 0 ); - COSNumber y1 = (COSNumber)arguments.get( 1 ); - COSNumber x2 = (COSNumber)arguments.get( 2 ); - COSNumber y2 = (COSNumber)arguments.get( 3 ); - COSNumber x3 = (COSNumber)arguments.get( 4 ); - COSNumber y3 = (COSNumber)arguments.get( 5 ); - - Point2D point1 = drawer.transformedPoint(x1.doubleValue(), y1.doubleValue()); - Point2D point2 = drawer.transformedPoint(x2.doubleValue(), y2.doubleValue()); - Point2D point3 = drawer.transformedPoint(x3.doubleValue(), y3.doubleValue()); - - drawer.getLinePath().curveTo((float)point1.getX(), (float)point1.getY(), - (float)point2.getX(), (float)point2.getY(), (float)point3.getX(), (float)point3.getY()); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateFinalPoint.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateFinalPoint.java deleted file mode 100644 index a6ac69b82..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateFinalPoint.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.util.List; -import java.awt.geom.Point2D; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.2 $ - */ -public class CurveToReplicateFinalPoint extends OperatorProcessor -{ - - - /** - * process : y : Append curved segment to path (final point replicated). - * @param operator The operator that is being executed. - * @param arguments List - */ - public void process(PDFOperator operator, List arguments) - { - PageDrawer drawer = (PageDrawer)context; - - COSNumber x1 = (COSNumber)arguments.get( 0 ); - COSNumber y1 = (COSNumber)arguments.get( 1 ); - COSNumber x3 = (COSNumber)arguments.get( 2 ); - COSNumber y3 = (COSNumber)arguments.get( 3 ); - - Point2D point1 = drawer.transformedPoint(x1.doubleValue(), y1.doubleValue()); - Point2D point3 = drawer.transformedPoint(x3.doubleValue(), y3.doubleValue()); - - drawer.getLinePath().curveTo((float)point1.getX(), (float)point1.getY(), - (float)point3.getX(), (float)point3.getY(), (float)point3.getX(), (float)point3.getY()); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateInitialPoint.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateInitialPoint.java deleted file mode 100644 index d89fca263..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateInitialPoint.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.awt.geom.GeneralPath; -import java.awt.geom.Point2D; -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.2 $ - */ -public class CurveToReplicateInitialPoint extends OperatorProcessor -{ - - - /** - * process : v : Append curved segment to path (initial point replicated). - * @param operator The operator that is being executed. - * @param arguments List - */ - public void process(PDFOperator operator, List arguments) - { - PageDrawer drawer = (PageDrawer)context; - - COSNumber x2 = (COSNumber)arguments.get( 0 ); - COSNumber y2 = (COSNumber)arguments.get( 1 ); - COSNumber x3 = (COSNumber)arguments.get( 2 ); - COSNumber y3 = (COSNumber)arguments.get( 3 ); - GeneralPath path = drawer.getLinePath(); - Point2D currentPoint = path.getCurrentPoint(); - - Point2D point2 = drawer.transformedPoint(x2.doubleValue(), y2.doubleValue()); - Point2D point3 = drawer.transformedPoint(x3.doubleValue(), y3.doubleValue()); - - drawer.getLinePath().curveTo((float)currentPoint.getX(), (float)currentPoint.getY(), - (float)point2.getX(), (float)point2.getY(), (float)point3.getX(), (float)point3.getY()); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/EndPath.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/EndPath.java deleted file mode 100644 index 1c68edd3b..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/EndPath.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.2 $ - */ -public class EndPath extends OperatorProcessor -{ - - - /** - * process : n : End path. - * @param operator The operator that is being executed. - * @param arguments List - */ - public void process(PDFOperator operator, List arguments) - { - PageDrawer drawer = (PageDrawer)context; - drawer.getLinePath().reset(); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddAndStrokePath.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddAndStrokePath.java deleted file mode 100644 index abaeb474b..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddAndStrokePath.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; - -import java.awt.geom.GeneralPath; -import java.io.IOException; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Andreas Lehmkühler - * @version $Revision: 101 $ - */ -public class FillEvenOddAndStrokePath extends org.apache.pdfbox.util.operator.OperatorProcessor -{ - - /** - * fill and stroke the path. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PageDrawer drawer = (PageDrawer)context; - GeneralPath currentPath = (GeneralPath)drawer.getLinePath().clone(); - - context.processOperator( "f*", arguments ); - drawer.setLinePath( currentPath ); - - context.processOperator( "S", arguments ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddRule.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddRule.java deleted file mode 100644 index d8f9b11ae..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddRule.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.awt.geom.GeneralPath; -import java.io.IOException; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.5 $ - */ -public class FillEvenOddRule extends OperatorProcessor -{ - - /** - * Log instance. - */ - private static final Log log = LogFactory.getLog(FillEvenOddRule.class); - - /** - * process : f* : fill path using even odd rule. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException if there is an error during execution. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - try - { - ///dwilson refactoring - PageDrawer drawer = (PageDrawer)context; - drawer.fillPath(GeneralPath.WIND_EVEN_ODD); - } - catch (Exception e) - { - log.warn(e, e); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroAndStrokePath.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroAndStrokePath.java deleted file mode 100644 index 6dbe214bd..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroAndStrokePath.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; - -import java.awt.geom.GeneralPath; -import java.io.IOException; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.1 $ - */ -public class FillNonZeroAndStrokePath extends org.apache.pdfbox.util.operator.OperatorProcessor -{ - - /** - * fill and stroke the path. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PageDrawer drawer = (PageDrawer)context; - GeneralPath currentPath = (GeneralPath)drawer.getLinePath().clone(); - - context.processOperator( "f", arguments ); - drawer.setLinePath( currentPath ); - - context.processOperator( "S", arguments ); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroRule.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroRule.java deleted file mode 100644 index ab2a3b4e5..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroRule.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.awt.geom.GeneralPath; -import java.io.IOException; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.5 $ - */ -public class FillNonZeroRule extends OperatorProcessor -{ - - /** - * Log instance. - */ - private static final Log log = LogFactory.getLog(FillNonZeroRule.class); - - /** - * process : F/f : fill path using non zero winding rule. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException If there is an error during the processing. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - - try - { - ///dwilson refactoring - PageDrawer drawer = (PageDrawer)context; - drawer.fillPath(GeneralPath.WIND_NON_ZERO); - } - catch (Exception e) - { - log.warn(e, e); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/Invoke.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/Invoke.java deleted file mode 100644 index 01fc45048..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/Invoke.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.awt.geom.AffineTransform; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSName; -import org.apache.pdfbox.cos.COSStream; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.pdmodel.PDPage; -import org.apache.pdfbox.pdmodel.PDResources; -import org.apache.pdfbox.pdmodel.graphics.PDGraphicsState; -import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObject; -import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectForm; -import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage; -import org.apache.pdfbox.util.Matrix; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.4 $ - */ -public class Invoke extends OperatorProcessor -{ - - /** - * Log instance. - */ - private static final Log log = LogFactory.getLog(Invoke.class); - - /** - * process : Do : Paint the specified XObject (section 4.7). - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If there is an error invoking the sub object. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - PageDrawer drawer = (PageDrawer)context; - PDPage page = drawer.getPage(); - COSName objectName = (COSName)arguments.get( 0 ); - Map xobjects = drawer.getResources().getXObjects(); - PDXObject xobject = (PDXObject)xobjects.get( objectName.getName() ); - if ( xobject == null ) - { - log.warn("Can't find the XObject for '"+objectName.getName()+"'"); - } - else if( xobject instanceof PDXObjectImage ) - { - PDXObjectImage image = (PDXObjectImage)xobject; - try - { - image.setGraphicsState(drawer.getGraphicsState()); - BufferedImage awtImage = image.getRGBImage(); - if (awtImage == null) - { - log.warn("getRGBImage returned NULL"); - return;//TODO PKOCH - } - int imageWidth = awtImage.getWidth(); - int imageHeight = awtImage.getHeight(); - double pageHeight = drawer.getPageSize().getHeight(); - - log.debug("imageWidth: " + imageWidth + "\t\timageHeight: " + imageHeight); - - Matrix ctm = drawer.getGraphicsState().getCurrentTransformationMatrix(); - float yScaling = ctm.getYScale(); - float angle = (float)Math.acos(ctm.getValue(0, 0)/ctm.getXScale()); - if (ctm.getValue(0, 1) < 0 && ctm.getValue(1, 0) > 0) - angle = (-1)*angle; - ctm.setValue(2, 1, (float)(pageHeight - ctm.getYPosition() - Math.cos(angle)*yScaling)); - ctm.setValue(2, 0, (float)(ctm.getXPosition() - Math.sin(angle)*yScaling)); - // because of the moved 0,0-reference, we have to shear in the opposite direction - ctm.setValue(0, 1, (-1)*ctm.getValue(0, 1)); - ctm.setValue(1, 0, (-1)*ctm.getValue(1, 0)); - AffineTransform ctmAT = ctm.createAffineTransform(); - ctmAT.scale(1f/imageWidth, 1f/imageHeight); - drawer.drawImage( awtImage, ctmAT ); - } - catch( Exception e ) - { - e.printStackTrace(); - log.error(e, e); - } - } - else if(xobject instanceof PDXObjectForm) - { - // save the graphics state - context.getGraphicsStack().push( (PDGraphicsState)context.getGraphicsState().clone() ); - - PDXObjectForm form = (PDXObjectForm)xobject; - COSStream invoke = (COSStream)form.getCOSObject(); - PDResources pdResources = form.getResources(); - if(pdResources == null) - { - pdResources = page.findResources(); - } - // if there is an optional form matrix, we have to - // map the form space to the user space - Matrix matrix = form.getMatrix(); - if (matrix != null) - { - Matrix xobjectCTM = matrix.multiply( context.getGraphicsState().getCurrentTransformationMatrix()); - context.getGraphicsState().setCurrentTransformationMatrix(xobjectCTM); - } - getContext().processSubStream( page, pdResources, invoke ); - - // restore the graphics state - context.setGraphicsState( (PDGraphicsState)context.getGraphicsStack().pop() ); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/LineTo.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/LineTo.java deleted file mode 100644 index 16a48a830..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/LineTo.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.util.List; -import java.awt.geom.Point2D; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.2 $ - */ -public class LineTo extends OperatorProcessor -{ - - - /** - * process : l : Append straight line segment to path. - * @param operator The operator that is being executed. - * @param arguments List - */ - public void process(PDFOperator operator, List arguments) - { - PageDrawer drawer = (PageDrawer)context; - - //append straight line segment from the current point to the point. - COSNumber x = (COSNumber)arguments.get( 0 ); - COSNumber y = (COSNumber)arguments.get( 1 ); - - Point2D pos = drawer.transformedPoint(x.doubleValue(), y.doubleValue()); - drawer.getLinePath().lineTo((float)pos.getX(), (float)pos.getY()); - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/MoveTo.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/MoveTo.java deleted file mode 100644 index 4d177c1ed..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/MoveTo.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.awt.geom.Point2D; -import java.util.List; -import java.io.IOException; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.2 $ - */ -public class MoveTo extends OperatorProcessor -{ - - /** - * Log instance. - */ - private static final Log log = LogFactory.getLog(MoveTo.class); - - /** - * process : m : Begin new subpath. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If there is an error processing the operator. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - try - { - PageDrawer drawer = (PageDrawer)context; - COSNumber x = (COSNumber)arguments.get( 0 ); - COSNumber y = (COSNumber)arguments.get( 1 ); - Point2D pos = drawer.transformedPoint(x.doubleValue(), y.doubleValue()); - drawer.getLinePath().moveTo((float)pos.getX(), (float)pos.getY()); - } - catch (Exception exception) - { - log.warn( exception, exception); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SHFill.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SHFill.java deleted file mode 100644 index 6c1246a11..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SHFill.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.awt.geom.GeneralPath; -import java.io.IOException; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSName; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -/** - * Implementation of sh operator for page drawer. - * See section 4.6.3 of the PDF 1.7 specification. - * - * @author Daniel Wilson - * @version $Revision: 1.0 $ - */ -public class SHFill extends OperatorProcessor -{ - - /** - * Log instance. - */ - private static final Log log = LogFactory.getLog(SHFill.class); - - /** - * process : sh : shade fill the path or clipping area. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException if there is an error during execution. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - try - { - PageDrawer drawer = (PageDrawer)context; - drawer.SHFill((COSName)(arguments.get(0))); - - } - catch (Exception e) - { - log.warn(e, e); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SetLineCapStyle.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SetLineCapStyle.java deleted file mode 100644 index bee3b1b42..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SetLineCapStyle.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; - -import java.awt.BasicStroke; -import java.awt.Graphics2D; -import java.io.IOException; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Andreas Lehmkühler - * @version $Revision: 1.0 $ - */ -public class SetLineDashPattern extends org.apache.pdfbox.util.operator.SetLineDashPattern -{ - - /** - * Set the line dash pattern. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - super.process( operator, arguments ); - PDLineDashPattern lineDashPattern = context.getGraphicsState().getLineDashPattern(); - PageDrawer drawer = (PageDrawer)context; - BasicStroke stroke = (BasicStroke)drawer.getStroke(); - if (stroke == null) - { - if (lineDashPattern.isDashPatternEmpty()) - { - drawer.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f) ); - } - else - { - drawer.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f, - lineDashPattern.getCOSDashPattern().toFloatArray(), lineDashPattern.getPhaseStart()) ); - } - } - else - { - if (lineDashPattern.isDashPatternEmpty()) - { - drawer.setStroke( new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(), - stroke.getLineJoin(), stroke.getMiterLimit()) ); - } - else - { - drawer.setStroke( new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(), stroke.getLineJoin(), - stroke.getMiterLimit(), lineDashPattern.getCOSDashPattern().toFloatArray(), - lineDashPattern.getPhaseStart()) ); - } - } - } - -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SetLineJoinStyle.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SetLineJoinStyle.java deleted file mode 100644 index ad22605ed..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SetLineJoinStyle.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; - -import java.awt.BasicStroke; -import java.awt.Graphics2D; -import java.io.IOException; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Andreas Lehmkühler - * @version $Revision: 1.0 $ - */ -public class SetLineMiterLimit extends org.apache.pdfbox.util.operator.SetLineMiterLimit -{ - - /** - * Set the line dash pattern. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - super.process(operator, arguments); - float miterLimit = (float)context.getGraphicsState().getMiterLimit(); - PageDrawer drawer = (PageDrawer)context; - BasicStroke stroke = (BasicStroke)drawer.getStroke(); - if (stroke == null) - { - drawer.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, - miterLimit, null, 0.0f)); - } - else - { - drawer.setStroke( new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(), stroke.getLineJoin(), - miterLimit, null, 0.0f)); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SetLineWidth.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SetLineWidth.java deleted file mode 100644 index a7444f97b..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/SetLineWidth.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.util.List; - -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.PDFOperator; - -import java.awt.BasicStroke; -import java.awt.Graphics2D; -import java.io.IOException; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.2 $ - */ -public class SetLineWidth extends org.apache.pdfbox.util.operator.SetLineWidth -{ - - /** - * w Set line width. - * @param operator The operator that is being executed. - * @param arguments List - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - super.process( operator, arguments ); - float lineWidth = (float)context.getGraphicsState().getLineWidth(); - if (lineWidth == 0) - { - lineWidth = 1; - } - PageDrawer drawer = (PageDrawer)context; - BasicStroke stroke = (BasicStroke)drawer.getStroke(); - if (stroke == null) - { - drawer.setStroke( new BasicStroke( lineWidth ) ); - } - else - { - drawer.setStroke( new BasicStroke(lineWidth, stroke.getEndCap(), stroke.getLineJoin(), - stroke.getMiterLimit(), stroke.getDashArray(), stroke.getDashPhase()) ); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/StrokePath.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/StrokePath.java deleted file mode 100644 index 0baeaae3b..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/StrokePath.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.pdfbox.util.operator.pagedrawer; - -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.pdfviewer.PageDrawer; -import org.apache.pdfbox.util.Matrix; -import org.apache.pdfbox.util.PDFOperator; -import org.apache.pdfbox.util.operator.OperatorProcessor; - -import java.awt.BasicStroke; -import java.awt.Graphics2D; -import java.io.IOException; - -/** - * Implementation of content stream operator for page drawer. - * - * @author Ben Litchfield - * @version $Revision: 1.3 $ - */ -public class StrokePath extends OperatorProcessor -{ - - /** - * Log instance. - */ - private static final Log log = LogFactory.getLog(StrokePath.class); - - /** - * S stroke the path. - * @param operator The operator that is being executed. - * @param arguments List - * - * @throws IOException If an error occurs while processing the font. - */ - public void process(PDFOperator operator, List arguments) throws IOException - { - ///dwilson 3/19/07 refactor - try - { - PageDrawer drawer = (PageDrawer)context; - - float lineWidth = (float)context.getGraphicsState().getLineWidth(); - Matrix ctm = context.getGraphicsState().getCurrentTransformationMatrix(); - if ( ctm != null && ctm.getXScale() > 0) - { - lineWidth = lineWidth * ctm.getXScale(); - } - - BasicStroke stroke = (BasicStroke)drawer.getStroke(); - if (stroke == null) - { - drawer.setStroke( new BasicStroke( lineWidth ) ); - } - else - { - drawer.setStroke( new BasicStroke(lineWidth, stroke.getEndCap(), stroke.getLineJoin(), - stroke.getMiterLimit(), stroke.getDashArray(), stroke.getDashPhase()) ); - } - drawer.strokePath(); - } - catch (Exception exception) - { - log.warn(exception, exception); - } - } -} diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/package.html b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/package.html deleted file mode 100644 index b3774c25e..000000000 --- a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/pagedrawer/package.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - -This package contains implementations of all of the PDF operators. - - -- 2.39.5