diff options
Diffstat (limited to 'src/java/org/apache/fop/pdf')
95 files changed, 774 insertions, 774 deletions
diff --git a/src/java/org/apache/fop/pdf/ASCII85Filter.java b/src/java/org/apache/fop/pdf/ASCII85Filter.java index 2114ea540..df82c5179 100644 --- a/src/java/org/apache/fop/pdf/ASCII85Filter.java +++ b/src/java/org/apache/fop/pdf/ASCII85Filter.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.OutputStream; @@ -46,7 +46,7 @@ public class ASCII85Filter extends PDFFilter { public boolean isASCIIFilter() { return true; } - + /** * Get the decode parameters. * diff --git a/src/java/org/apache/fop/pdf/ASCIIHexFilter.java b/src/java/org/apache/fop/pdf/ASCIIHexFilter.java index 41c428998..01dc75190 100644 --- a/src/java/org/apache/fop/pdf/ASCIIHexFilter.java +++ b/src/java/org/apache/fop/pdf/ASCIIHexFilter.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.OutputStream; @@ -29,7 +29,7 @@ import org.apache.xmlgraphics.util.io.ASCIIHexOutputStream; * This filter converts a pdf stream to ASCII hex data. */ public class ASCIIHexFilter extends PDFFilter { - + /** * Get the name of this filter. * @@ -45,7 +45,7 @@ public class ASCIIHexFilter extends PDFFilter { public boolean isASCIIFilter() { return true; } - + /** * Get the decode params. * diff --git a/src/java/org/apache/fop/pdf/AbstractPDFStream.java b/src/java/org/apache/fop/pdf/AbstractPDFStream.java index 16190da99..1e1f1f259 100644 --- a/src/java/org/apache/fop/pdf/AbstractPDFStream.java +++ b/src/java/org/apache/fop/pdf/AbstractPDFStream.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -43,13 +43,13 @@ public abstract class AbstractPDFStream extends PDFDictionary { } /** - * Sets up the default filters for this stream if they haven't been set + * Sets up the default filters for this stream if they haven't been set * from outside. */ protected void setupFilterList() { if (!getFilterList().isInitialized()) { getFilterList().addDefaultFilters( - getDocumentSafely().getFilterMap(), + getDocumentSafely().getFilterMap(), PDFFilterList.DEFAULT_FILTER); } prepareImplicitFilters(); @@ -78,18 +78,18 @@ public abstract class AbstractPDFStream extends PDFDictionary { /** * Returns a value that hints at the size of the encoded stream. This is * used to optimize buffer allocation so fewer buffer reallocations are - * necessary. + * necessary. * @return an estimated size (0 if no hint can be given) * @throws IOException in case of an I/O problem */ protected abstract int getSizeHint() throws IOException; - + /** * Sends the raw stream data to the target OutputStream. * @param out OutputStream to write to * @throws IOException In case of an I/O problem */ - protected abstract void outputRawStreamData(OutputStream out) + protected abstract void outputRawStreamData(OutputStream out) throws IOException; /** @@ -104,10 +104,10 @@ public abstract class AbstractPDFStream extends PDFDictionary { byte[] p = encode("stream\n"); out.write(p); length += p.length; - + encodedStream.outputContents(out); length += encodedStream.getSize(); - + p = encode("\nendstream"); out.write(p); length += p.length; @@ -147,7 +147,7 @@ public abstract class AbstractPDFStream extends PDFDictionary { byte[] buf = encode("stream\n"); out.write(buf); bytesWritten += buf.length; - + //Stream contents CloseBlockerOutputStream cbout = new CloseBlockerOutputStream(out); CountingOutputStream cout = new CountingOutputStream(cbout); @@ -156,12 +156,12 @@ public abstract class AbstractPDFStream extends PDFDictionary { filteredOutput.close(); refLength.setNumber(new Integer(cout.getCount())); bytesWritten += cout.getCount(); - + //Stream trailer buf = encode("\nendstream"); out.write(buf); bytesWritten += buf.length; - + return bytesWritten; } @@ -177,7 +177,7 @@ public abstract class AbstractPDFStream extends PDFDictionary { Writer writer = PDFDocument.getWriterFor(cout); writer.write(getObjectID()); //int length = 0; - + StreamCache encodedStream = null; PDFNumber refLength = null; final Object lengthEntry; @@ -189,10 +189,10 @@ public abstract class AbstractPDFStream extends PDFDictionary { encodedStream = encodeStream(); lengthEntry = new Integer(encodedStream.getSize() + 1); } - + populateStreamDict(lengthEntry); writeDictionary(cout, writer); - + //Send encoded stream to target OutputStream writer.flush(); if (encodedStream == null) { @@ -201,7 +201,7 @@ public abstract class AbstractPDFStream extends PDFDictionary { outputStreamData(encodedStream, cout); encodedStream.clear(); //Encoded stream can now be discarded } - + writer.write("\nendobj\n"); writer.flush(); return cout.getCount(); diff --git a/src/java/org/apache/fop/pdf/AlphaRasterImage.java b/src/java/org/apache/fop/pdf/AlphaRasterImage.java index 0b83cc3d6..ae39cadb7 100644 --- a/src/java/org/apache/fop/pdf/AlphaRasterImage.java +++ b/src/java/org/apache/fop/pdf/AlphaRasterImage.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.awt.image.DataBuffer; @@ -33,7 +33,7 @@ import org.apache.xmlgraphics.image.GraphicsUtil; * PDFImage implementation for alpha channel "images". */ public class AlphaRasterImage implements PDFImage { - + private int bitsPerComponent; private PDFDeviceColorSpace colorSpace; private Raster alpha; @@ -117,7 +117,7 @@ public class AlphaRasterImage implements PDFImage { public String getSoftMask() { return null; } - + /** {@inheritDoc} */ public PDFReference getSoftMaskReference() { return null; @@ -127,12 +127,12 @@ public class AlphaRasterImage implements PDFImage { public boolean isInverted() { return false; } - + /** {@inheritDoc} */ public void outputContents(OutputStream out) throws IOException { int w = getWidth(); int h = getHeight(); - + //Check Raster int nbands = alpha.getNumBands(); if (nbands != 1) { @@ -171,7 +171,7 @@ public class AlphaRasterImage implements PDFImage { } } - + /** {@inheritDoc} */ public void populateXObjectDictionary(PDFDictionary dict) { //nop diff --git a/src/java/org/apache/fop/pdf/BitmapImage.java b/src/java/org/apache/fop/pdf/BitmapImage.java index 69b51dac3..186c00986 100644 --- a/src/java/org/apache/fop/pdf/BitmapImage.java +++ b/src/java/org/apache/fop/pdf/BitmapImage.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -170,12 +170,12 @@ public class BitmapImage implements PDFImage { public boolean isInverted() { return false; } - + /** {@inheritDoc} */ public void outputContents(OutputStream out) throws IOException { out.write(bitmaps); } - + /** {@inheritDoc} */ public void populateXObjectDictionary(PDFDictionary dict) { //nop diff --git a/src/java/org/apache/fop/pdf/CCFFilter.java b/src/java/org/apache/fop/pdf/CCFFilter.java index 03561629c..117070bb1 100644 --- a/src/java/org/apache/fop/pdf/CCFFilter.java +++ b/src/java/org/apache/fop/pdf/CCFFilter.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** diff --git a/src/java/org/apache/fop/pdf/CMapBuilder.java b/src/java/org/apache/fop/pdf/CMapBuilder.java index f55c34fcf..8e30ad04a 100644 --- a/src/java/org/apache/fop/pdf/CMapBuilder.java +++ b/src/java/org/apache/fop/pdf/CMapBuilder.java @@ -5,9 +5,9 @@ * 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. @@ -16,22 +16,22 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; import java.io.Writer; public class CMapBuilder { - + protected String name; protected Writer writer; - + public CMapBuilder(Writer writer, String name) { this.writer = writer; this.name = name; } - + /** * Writes the CMap to a Writer. * @throws IOException if an I/O error occurs @@ -51,7 +51,7 @@ public class CMapBuilder { writeStreamAfterComments(); writeUseCMap(); } - + protected void writePreStream() throws IOException { // writer.write("/Type /CMap\n"); // writer.write(sysInfo.toPDFString()); @@ -86,7 +86,7 @@ public class CMapBuilder { writer.write(" def\n"); writer.write("end def\n"); } - + protected void writeCIDSystemInfo() throws IOException { writeCIDSystemInfo("Adobe", "Identity", 0); } diff --git a/src/java/org/apache/fop/pdf/DCTFilter.java b/src/java/org/apache/fop/pdf/DCTFilter.java index 92809d927..183f2a694 100644 --- a/src/java/org/apache/fop/pdf/DCTFilter.java +++ b/src/java/org/apache/fop/pdf/DCTFilter.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** diff --git a/src/java/org/apache/fop/pdf/FlateFilter.java b/src/java/org/apache/fop/pdf/FlateFilter.java index a652c4534..62b3d5769 100644 --- a/src/java/org/apache/fop/pdf/FlateFilter.java +++ b/src/java/org/apache/fop/pdf/FlateFilter.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; diff --git a/src/java/org/apache/fop/pdf/InMemoryStreamCache.java b/src/java/org/apache/fop/pdf/InMemoryStreamCache.java index 03552aa23..7e9a78aa4 100644 --- a/src/java/org/apache/fop/pdf/InMemoryStreamCache.java +++ b/src/java/org/apache/fop/pdf/InMemoryStreamCache.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.ByteArrayOutputStream; @@ -72,7 +72,7 @@ public class InMemoryStreamCache implements StreamCache { public void write(byte[] data) throws IOException { getOutputStream().write(data); } - + /** * Outputs the cached bytes to the given stream. * @param out the output stream to write to diff --git a/src/java/org/apache/fop/pdf/NullFilter.java b/src/java/org/apache/fop/pdf/NullFilter.java index 6f2e7f069..f098860c9 100644 --- a/src/java/org/apache/fop/pdf/NullFilter.java +++ b/src/java/org/apache/fop/pdf/NullFilter.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; diff --git a/src/java/org/apache/fop/pdf/PDFAMode.java b/src/java/org/apache/fop/pdf/PDFAMode.java index d27f64e83..1b433e66d 100644 --- a/src/java/org/apache/fop/pdf/PDFAMode.java +++ b/src/java/org/apache/fop/pdf/PDFAMode.java @@ -28,7 +28,7 @@ public final class PDFAMode { public static final PDFAMode PDFA_1A = new PDFAMode("PDF/A-1a"); /** PDF/A-1b enabled */ public static final PDFAMode PDFA_1B = new PDFAMode("PDF/A-1b"); - + private String name; /** @@ -43,13 +43,13 @@ public final class PDFAMode { public String getName() { return this.name; } - + /** @return true if this mode obey the restrictions established by PDF/A-1b. */ public boolean isPDFA1LevelB() { return (this != DISABLED); //PDF/A-1a is a superset of PDF/A-1b! } - + /** * Returns the mode enum object given a String. * @param s the string @@ -64,10 +64,10 @@ public final class PDFAMode { return DISABLED; } } - + /** {@inheritDoc} */ public String toString() { return name; } - + } diff --git a/src/java/org/apache/fop/pdf/PDFAction.java b/src/java/org/apache/fop/pdf/PDFAction.java index 7d10276ae..81b32b97c 100644 --- a/src/java/org/apache/fop/pdf/PDFAction.java +++ b/src/java/org/apache/fop/pdf/PDFAction.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** diff --git a/src/java/org/apache/fop/pdf/PDFAnnotList.java b/src/java/org/apache/fop/pdf/PDFAnnotList.java index 30116c0f8..0a8710627 100644 --- a/src/java/org/apache/fop/pdf/PDFAnnotList.java +++ b/src/java/org/apache/fop/pdf/PDFAnnotList.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; // Java diff --git a/src/java/org/apache/fop/pdf/PDFArray.java b/src/java/org/apache/fop/pdf/PDFArray.java index 1fe55384c..7c5f8ba9b 100644 --- a/src/java/org/apache/fop/pdf/PDFArray.java +++ b/src/java/org/apache/fop/pdf/PDFArray.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -88,10 +88,10 @@ public class PDFArray extends PDFObject { public PDFArray(PDFObject parent, Collection values) { /* generic creation of PDF object */ super(parent); - + this.values.addAll(values); } - + /** * Create the array object * @param parent the array's parent if any @@ -100,12 +100,12 @@ public class PDFArray extends PDFObject { public PDFArray(PDFObject parent, Object[] values) { /* generic creation of PDF object */ super(parent); - + for (int i = 0, c = values.length; i < c; i++) { this.values.add(values[i]); } } - + /** * Returns the length of the array * @return the length of the array @@ -113,7 +113,7 @@ public class PDFArray extends PDFObject { public int length() { return this.values.size(); } - + /** * Sets an entry at a given location. * @param index the index of the value to set @@ -122,7 +122,7 @@ public class PDFArray extends PDFObject { public void set(int index, Object obj) { this.values.set(index, obj); } - + /** * Sets an entry at a given location. * @param index the index of the value to set @@ -131,7 +131,7 @@ public class PDFArray extends PDFObject { public void set(int index, double value) { this.values.set(index, new Double(value)); } - + /** * Gets an entry at a given location. * @param index the index of the value to set @@ -140,7 +140,7 @@ public class PDFArray extends PDFObject { public Object get(int index) { return this.values.get(index); } - + /** * Adds a new value to the array. * @param obj the value @@ -154,7 +154,7 @@ public class PDFArray extends PDFObject { } this.values.add(obj); } - + /** * Adds a new value to the array. * @param value the value @@ -162,7 +162,7 @@ public class PDFArray extends PDFObject { public void add(double value) { this.values.add(new Double(value)); } - + /** {@inheritDoc} */ protected int output(OutputStream stream) throws IOException { CountingOutputStream cout = new CountingOutputStream(stream); @@ -170,7 +170,7 @@ public class PDFArray extends PDFObject { if (hasObjectNumber()) { writer.write(getObjectID()); } - + writer.write('['); for (int i = 0; i < values.size(); i++) { if (i > 0) { @@ -180,13 +180,13 @@ public class PDFArray extends PDFObject { formatObject(obj, cout, writer); } writer.write(']'); - + if (hasObjectNumber()) { writer.write("\nendobj\n"); } - + writer.flush(); return cout.getCount(); } - + } diff --git a/src/java/org/apache/fop/pdf/PDFCIDFont.java b/src/java/org/apache/fop/pdf/PDFCIDFont.java index 3fcedbbb9..3224eb567 100644 --- a/src/java/org/apache/fop/pdf/PDFCIDFont.java +++ b/src/java/org/apache/fop/pdf/PDFCIDFont.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import org.apache.fop.fonts.CIDFontType; @@ -60,8 +60,8 @@ public class PDFCIDFont extends PDFObject { int[] w, String registry, String ordering, int supplement, PDFCIDFontDescriptor descriptor) { - this(basefont, cidtype, dw, - new PDFWArray(w), + this(basefont, cidtype, dw, + new PDFWArray(w), new PDFCIDSystemInfo(registry, ordering, supplement), descriptor); } @@ -79,8 +79,8 @@ public class PDFCIDFont extends PDFObject { int[] w, PDFCIDSystemInfo systemInfo, PDFCIDFontDescriptor descriptor) { - this(basefont, cidtype, dw, - new PDFWArray(w), + this(basefont, cidtype, dw, + new PDFWArray(w), systemInfo, descriptor); } @@ -189,7 +189,7 @@ public class PDFCIDFont extends PDFObject { } else if (cidFontType == CIDFontType.CIDTYPE2) { return cidFontType.getName(); } else { - throw new IllegalArgumentException("Unsupported CID font type: " + throw new IllegalArgumentException("Unsupported CID font type: " + cidFontType.getName()); } } diff --git a/src/java/org/apache/fop/pdf/PDFCIDFontDescriptor.java b/src/java/org/apache/fop/pdf/PDFCIDFontDescriptor.java index df552d96e..726e46f23 100644 --- a/src/java/org/apache/fop/pdf/PDFCIDFontDescriptor.java +++ b/src/java/org/apache/fop/pdf/PDFCIDFontDescriptor.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; // based on work by Takayuki Takeuchi diff --git a/src/java/org/apache/fop/pdf/PDFCIDSystemInfo.java b/src/java/org/apache/fop/pdf/PDFCIDSystemInfo.java index 33d77d9e8..0228addb6 100644 --- a/src/java/org/apache/fop/pdf/PDFCIDSystemInfo.java +++ b/src/java/org/apache/fop/pdf/PDFCIDSystemInfo.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; // based on work by Takayuki Takeuchi diff --git a/src/java/org/apache/fop/pdf/PDFCMap.java b/src/java/org/apache/fop/pdf/PDFCMap.java index 1be5e9dc4..57d148fc2 100644 --- a/src/java/org/apache/fop/pdf/PDFCMap.java +++ b/src/java/org/apache/fop/pdf/PDFCMap.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -421,7 +421,7 @@ public class PDFCMap extends PDFStream { protected CMapBuilder createCMapBuilder(Writer writer) { return new CMapBuilder(writer, this.name); } - + /** {@inheritDoc} */ protected int output(OutputStream stream) throws IOException { CMapBuilder builder = createCMapBuilder(getBufferWriter()); diff --git a/src/java/org/apache/fop/pdf/PDFCharProcs.java b/src/java/org/apache/fop/pdf/PDFCharProcs.java index a9eb06fca..73fe19a5e 100644 --- a/src/java/org/apache/fop/pdf/PDFCharProcs.java +++ b/src/java/org/apache/fop/pdf/PDFCharProcs.java @@ -5,9 +5,9 @@ * 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. @@ -16,11 +16,11 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.util.Map; -import java.util.HashMap; +import java.util.HashMap; /** * class representing a /CharProcs dictionary for Type3 fonts. diff --git a/src/java/org/apache/fop/pdf/PDFColor.java b/src/java/org/apache/fop/pdf/PDFColor.java index 3cbfa2bbc..5bac9532c 100644 --- a/src/java/org/apache/fop/pdf/PDFColor.java +++ b/src/java/org/apache/fop/pdf/PDFColor.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.awt.Color; @@ -44,11 +44,11 @@ public class PDFColor extends PDFPathPaint { private double magenta = -1.0; private double yellow = -1.0; private double black = -1.0; - + // TODO - It would probably be better to reorganize PDFPathPaint/PDFColor/PDFColorSpace - // class hierarchy. However, at this early stages of my FOP understanding, I can - // not really oversee the consequences of such a switch (nor whether it would be - // appropriate). + // class hierarchy. However, at this early stages of my FOP understanding, I can + // not really oversee the consequences of such a switch (nor whether it would be + // appropriate). private ColorExt colorExt = null; /** @@ -66,24 +66,24 @@ public class PDFColor extends PDFPathPaint { this.green = theGreen; this.blue = theBlue; } - + /** * Create PDFColor for the given document and based on the java.awt.Color object - * - * In case the java.awt.Color is an instance of the ColorExt class a PDFICCStream is added to + * + * In case the java.awt.Color is an instance of the ColorExt class a PDFICCStream is added to * the PDFDocument that is being created - * + * * @param pdfDoc PDFDocument that is being created * @param col Color object from which to create this PDFColor */ public PDFColor(PDFDocument pdfDoc, Color col) { this(col); // TODO - 1) There is a potential conflict when FOP and Batik elements use the same color - // profile name for different profiles. - // 2) In case the same color profile is used with different names it will be + // profile name for different profiles. + // 2) In case the same color profile is used with different names it will be // included multiple times in the PDF // - if (colorExt != null + if (colorExt != null && pdfDoc.getResources().getColorSpace(colorExt.getIccProfileName()) == null) { PDFICCStream pdfIccStream = new PDFICCStream(); ColorSpace ceCs = colorExt.getOrigColorSpace(); @@ -98,17 +98,17 @@ public class PDFColor extends PDFPathPaint { pdfDoc.getFactory().makeICCBasedColorSpace( null, colorExt.getIccProfileName(), pdfIccStream); if (log.isInfoEnabled()) { - log.info("Adding PDFICCStream " + colorExt.getIccProfileName() + log.info("Adding PDFICCStream " + colorExt.getIccProfileName() + " for " + colorExt.getIccProfileSrc()); } } } - + /** * Create a PDF color from a java.awt.Color object. - * + * * Different Color objects are handled differently. Cases recognized are. - * + * * 1. CMYK color * 2. ColorExt color * 3. 'Normal' java.awt.Color (RGB case assumed) @@ -120,12 +120,12 @@ public class PDFColor extends PDFPathPaint { ColorExt ce = null; if (col instanceof ColorExt) { ce = (ColorExt)col; - cs = ce.getOrigColorSpace(); + cs = ce.getOrigColorSpace(); } if (cs != null && cs instanceof CMYKColorSpace) { // CMYK case this.colorSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_CMYK); - float[] cmyk = (ce == null + float[] cmyk = (ce == null ? col.getColorComponents(null) : ce.getOriginalColorComponents()); this.cyan = cmyk[0]; @@ -151,7 +151,7 @@ public class PDFColor extends PDFPathPaint { this.blue = comps[2]; } } - + /** * Create a PDF color with int values ranging from 0 to 255 * @@ -239,11 +239,11 @@ public class PDFColor extends PDFPathPaint { return (this.blue); } - /** + /** * Get the red integer component. - * - * @return the red integer value - */ + * + * @return the red integer value + */ public int red255() { return (int)(this.red * 255d); } @@ -251,7 +251,7 @@ public class PDFColor extends PDFPathPaint { /** * Get the green integer component. * - * @return the green integer value + * @return the green integer value */ public int green255() { return (int)(this.green * 255d); @@ -260,7 +260,7 @@ public class PDFColor extends PDFPathPaint { /** * Get the blue integer component. * - * @return the blue integer value + * @return the blue integer value */ public int blue255() { return (int)(this.blue * 255d); @@ -269,7 +269,7 @@ public class PDFColor extends PDFPathPaint { /** * Get the cyan component. * - * @return the cyan double value + * @return the cyan double value */ public double cyan() { return (this.cyan); @@ -278,7 +278,7 @@ public class PDFColor extends PDFPathPaint { /** * Get the magenta component. * - * @return the magenta double value + * @return the magenta double value */ public double magenta() { return (this.magenta); @@ -287,7 +287,7 @@ public class PDFColor extends PDFPathPaint { /** * Get the yellow component. * - * @return the yellow double value + * @return the yellow double value */ public double yellow() { return (this.yellow); @@ -296,7 +296,7 @@ public class PDFColor extends PDFPathPaint { /** * Get the black component. * - * @return the black double value + * @return the black double value */ public double black() { return (this.black); @@ -553,7 +553,7 @@ public class PDFColor extends PDFPathPaint { } PDFColor color = (PDFColor)obj; - if (color.red == this.red + if (color.red == this.red && color.green == this.green && color.blue == this.blue) { return true; diff --git a/src/java/org/apache/fop/pdf/PDFColorSpace.java b/src/java/org/apache/fop/pdf/PDFColorSpace.java index 4b67a8422..1d3dd8634 100644 --- a/src/java/org/apache/fop/pdf/PDFColorSpace.java +++ b/src/java/org/apache/fop/pdf/PDFColorSpace.java @@ -5,9 +5,9 @@ * 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. @@ -16,14 +16,14 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** * PDF Color space. */ public interface PDFColorSpace { - + /** * Get the number of color components for this colorspace * @return the number of components @@ -32,18 +32,18 @@ public interface PDFColorSpace { /** @return the name of the color space */ String getName(); - + /** - * @return true if the color space is a device-dependent color space (like DeviceRGB, + * @return true if the color space is a device-dependent color space (like DeviceRGB, * DeviceCMYK and DeviceGray) */ boolean isDeviceColorSpace(); - + /** @return true if the color space is an RGB color space */ boolean isRGBColorSpace(); /** @return true if the color space is an CMYK color space */ boolean isCMYKColorSpace(); /** @return true if the color space is an Gray color space */ boolean isGrayColorSpace(); - + } diff --git a/src/java/org/apache/fop/pdf/PDFConformanceException.java b/src/java/org/apache/fop/pdf/PDFConformanceException.java index 119f1f02d..083c11f21 100644 --- a/src/java/org/apache/fop/pdf/PDFConformanceException.java +++ b/src/java/org/apache/fop/pdf/PDFConformanceException.java @@ -33,7 +33,7 @@ public class PDFConformanceException extends RuntimeException { public PDFConformanceException() { super(); } - + /** * Constructs an PDFConformanceException with the specified detail * message. A detail message is a String that describes this particular @@ -43,5 +43,5 @@ public class PDFConformanceException extends RuntimeException { public PDFConformanceException(String message) { super(message); } - + } diff --git a/src/java/org/apache/fop/pdf/PDFDestination.java b/src/java/org/apache/fop/pdf/PDFDestination.java index eaf38449d..ced3ac497 100644 --- a/src/java/org/apache/fop/pdf/PDFDestination.java +++ b/src/java/org/apache/fop/pdf/PDFDestination.java @@ -55,15 +55,15 @@ public class PDFDestination extends PDFObject { protected int output(OutputStream stream) throws IOException { CountingOutputStream cout = new CountingOutputStream(stream); Writer writer = PDFDocument.getWriterFor(cout); - + formatObject(getIDRef(), cout, writer); writer.write(' '); formatObject(goToReference, cout, writer); - + writer.flush(); return cout.getCount(); } - + /** * Sets the GoToReference in the associated DestinationData object. * @@ -120,7 +120,7 @@ public class PDFDestination extends PDFObject { if (dest.getIDRef().equals(this.getIDRef())) { return true; } - + return false; } diff --git a/src/java/org/apache/fop/pdf/PDFDeviceColorSpace.java b/src/java/org/apache/fop/pdf/PDFDeviceColorSpace.java index 269b9f7b0..6ccfd39f5 100644 --- a/src/java/org/apache/fop/pdf/PDFDeviceColorSpace.java +++ b/src/java/org/apache/fop/pdf/PDFDeviceColorSpace.java @@ -5,9 +5,9 @@ * 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. @@ -16,14 +16,14 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** * Represents a device-specific color space. Used for mapping DeviceRGB, DeviceCMYK and DeviceGray. */ public class PDFDeviceColorSpace implements PDFColorSpace { - + private int numComponents; /** @@ -136,5 +136,5 @@ public class PDFDeviceColorSpace implements PDFColorSpace { public boolean isGrayColorSpace() { return getColorSpace() == DEVICE_GRAY; } - + } diff --git a/src/java/org/apache/fop/pdf/PDFDictionary.java b/src/java/org/apache/fop/pdf/PDFDictionary.java index 34fe4c389..3258423f4 100644 --- a/src/java/org/apache/fop/pdf/PDFDictionary.java +++ b/src/java/org/apache/fop/pdf/PDFDictionary.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -32,7 +32,7 @@ import org.apache.commons.io.output.CountingOutputStream; * Class representing a PDF dictionary object */ public class PDFDictionary extends PDFObject { - + /** * the entry map */ @@ -43,7 +43,7 @@ public class PDFDictionary extends PDFObject { * "entries", always make sure you adjust this list accordingly. */ protected List order = new java.util.ArrayList(); - + /** * Create a new dictionary object. */ @@ -76,7 +76,7 @@ public class PDFDictionary extends PDFObject { } this.entries.put(name, value); } - + /** * Puts a new name/value pair. * @param name the name @@ -88,7 +88,7 @@ public class PDFDictionary extends PDFObject { } this.entries.put(name, new Integer(value)); } - + /** * Returns the value given a name. * @param name the name of the value @@ -97,7 +97,7 @@ public class PDFDictionary extends PDFObject { public Object get(String name) { return this.entries.get(name); } - + /** {@inheritDoc} */ protected int output(OutputStream stream) throws IOException { CountingOutputStream cout = new CountingOutputStream(stream); @@ -105,17 +105,17 @@ public class PDFDictionary extends PDFObject { if (hasObjectNumber()) { writer.write(getObjectID()); } - + writeDictionary(cout, writer); if (hasObjectNumber()) { writer.write("\nendobj\n"); } - + writer.flush(); return cout.getCount(); } - + /** * Writes the contents of the dictionary to a StringBuffer. * @param out the OutputStream (for binary content) diff --git a/src/java/org/apache/fop/pdf/PDFDocument.java b/src/java/org/apache/fop/pdf/PDFDocument.java index 020a594b4..16ec81049 100644 --- a/src/java/org/apache/fop/pdf/PDFDocument.java +++ b/src/java/org/apache/fop/pdf/PDFDocument.java @@ -5,9 +5,9 @@ * 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. @@ -65,13 +65,13 @@ import org.apache.commons.logging.LogFactory; public class PDFDocument { private static final Integer LOCATION_PLACEHOLDER = new Integer(0); - + /** Integer constant to represent PDF 1.3 */ public static final int PDF_VERSION_1_3 = 3; /** Integer constant to represent PDF 1.4 */ public static final int PDF_VERSION_1_4 = 4; - + /** * the encoding to use when converting strings to PDF commandos. */ @@ -109,12 +109,12 @@ public class PDFDocument { /** Indicates what PDF version is active */ protected int pdfVersion = PDF_VERSION_1_4; - + /** * Indicates which PDF profiles are active (PDF/A, PDF/X etc.) */ protected PDFProfile pdfProfile = new PDFProfile(this); - + /** * the /Root object */ @@ -268,7 +268,7 @@ public class PDFDocument { public int getPDFVersion() { return this.pdfVersion; } - + /** @return the String representing the active PDF version */ public String getPDFVersionString() { switch (getPDFVersion()) { @@ -285,7 +285,7 @@ public class PDFDocument { public PDFProfile getProfile() { return this.pdfProfile; } - + /** * Returns the factory for PDF objects. * @return PDFFactory the factory @@ -332,7 +332,7 @@ public class PDFDocument { throw new Error("JVM doesn't support " + ENCODING + " encoding!"); } } - + /** * set the producer of the document * @@ -344,7 +344,7 @@ public class PDFDocument { /** * Set the creation date of the document. - * + * * @param date Date to be stored as creation date in the PDF. */ public void setCreationDate(Date date) { @@ -775,7 +775,7 @@ public class PDFDocument { } this.destinations.add(destination); } - + /** * Gets the list of named destinations. * @@ -849,7 +849,7 @@ public class PDFDocument { PDFStream cont, PDFReference formres, String key) { - + // check if already created PDFFormXObject xObject = (PDFFormXObject)xObjectsMap.get(key); if (xObject != null) { @@ -858,7 +858,7 @@ public class PDFDocument { } return xObject; } - + xObject = new PDFFormXObject( ++this.xObjectCount, cont, @@ -954,7 +954,7 @@ public class PDFDocument { this.position = 0; getProfile().verifyPDFVersion(); - + byte[] pdf = encode("%PDF-" + getPDFVersionString() + "\n"); stream.write(pdf); this.position += pdf.length; @@ -991,7 +991,7 @@ public class PDFDocument { } } } - + /** * write the trailer * diff --git a/src/java/org/apache/fop/pdf/PDFEncoding.java b/src/java/org/apache/fop/pdf/PDFEncoding.java index 6dc448b40..bf2799c70 100644 --- a/src/java/org/apache/fop/pdf/PDFEncoding.java +++ b/src/java/org/apache/fop/pdf/PDFEncoding.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; // Java @@ -48,7 +48,7 @@ public class PDFEncoding extends PDFDictionary { /** the set of predefined encodings that can be assumed present in a PDF viewer */ private static final Set PREDEFINED_ENCODINGS; - + static { Set encodings = new java.util.HashSet(); encodings.add(STANDARD_ENCODING); @@ -81,7 +81,7 @@ public class PDFEncoding extends PDFDictionary { public static boolean isPredefinedEncoding(String name) { return PREDEFINED_ENCODINGS.contains(name); } - + /** * Creates and returns a new DifferencesBuilder instance for constructing the Differences * array. @@ -98,15 +98,15 @@ public class PDFEncoding extends PDFDictionary { public void setDifferences(PDFArray differences) { put("Differences", differences); } - + /** * Builder class for constructing the Differences array. */ public class DifferencesBuilder { - + private PDFArray differences = new PDFArray(); private int currentCode = -1; - + /** * Start a new difference. * @param code the starting code index inside the encoding @@ -117,7 +117,7 @@ public class PDFEncoding extends PDFDictionary { this.differences.add(new Integer(code)); return this; } - + /** * Adds a character name to the current difference. * @param name the character name @@ -130,7 +130,7 @@ public class PDFEncoding extends PDFDictionary { this.differences.add(new PDFName(name)); return this; } - + /** * Indicates whether any differences have been recorded. * @return true if there are differences. @@ -138,7 +138,7 @@ public class PDFEncoding extends PDFDictionary { public boolean hasDifferences() { return (this.differences.length() > 0); } - + /** * Creates and returns the PDFArray representing the Differences entry. * @return the Differences entry @@ -147,7 +147,7 @@ public class PDFEncoding extends PDFDictionary { return this.differences; } } - + /* * example (p. 214) * 25 0 obj diff --git a/src/java/org/apache/fop/pdf/PDFEncryption.java b/src/java/org/apache/fop/pdf/PDFEncryption.java index 5063ffa44..5852df157 100644 --- a/src/java/org/apache/fop/pdf/PDFEncryption.java +++ b/src/java/org/apache/fop/pdf/PDFEncryption.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** @@ -39,9 +39,9 @@ public interface PDFEncryption { /** * Adds a PDFFilter to the PDFStream object * @param stream the stream to add an encryption filter to - */ + */ void applyFilter(AbstractPDFStream stream); - + /** * Encrypt an array of bytes using a reference PDFObject for calculating * the encryption key. @@ -50,7 +50,7 @@ public interface PDFEncryption { * @return byte[] the encrypted data */ byte[] encrypt(byte[] data, PDFObject refObj); - + /** * Returns the trailer entry for encryption. * @return the trailer entry diff --git a/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java b/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java index 5da37076c..43a323335 100644 --- a/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java +++ b/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; // Java @@ -40,18 +40,18 @@ import javax.crypto.spec.SecretKeySpec; * */ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { - + private class EncryptionFilter extends PDFFilter { private PDFEncryptionJCE encryption; private int number; private int generation; - /** + /** * The constructor for the internal PDFEncryptionJCE filter * @param encryption The encryption object to use * @param number The number of the object to be encrypted * @param generation The generation of the object to be encrypted - */ + */ public EncryptionFilter(PDFEncryptionJCE encryption, int number, int generation) { super(); @@ -62,7 +62,7 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { + number + " and generation " + generation); } - /** + /** * Return a PDF string representation of the filter. In this * case no filter name is passed. * @return The filter name, blank in this case @@ -71,7 +71,7 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { return ""; } - /** + /** * Return a parameter dictionary for this filter, or null * @return The parameter dictionary. In this case, null. */ @@ -79,7 +79,7 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { return null; } - /** + /** * Encode the given data with the filter * @param data The data to be encrypted * @return The encrypted data @@ -87,43 +87,43 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { public byte[] encode(byte[] data) { return encryption.encryptData(data, number, generation); } - + /** - * {@inheritDoc} + * {@inheritDoc} */ - public void encode(InputStream in, OutputStream out, int length) + public void encode(InputStream in, OutputStream out, int length) throws IOException { byte[] buffer = new byte[length]; in.read(buffer); buffer = encode(buffer); out.write(buffer); } - + /** * {@inheritDoc} */ public OutputStream applyFilter(OutputStream out) throws IOException { - return new CipherOutputStream(out, + return new CipherOutputStream(out, encryption.initCipher(number, generation)); } } - private static final char [] PAD + private static final char [] PAD = {0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, - 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, - 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, + 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, + 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A}; - - /** Value of PRINT permission */ + + /** Value of PRINT permission */ public static final int PERMISSION_PRINT = 4; - /** Value of content editting permission */ + /** Value of content editting permission */ public static final int PERMISSION_EDIT_CONTENT = 8; - /** Value of content extraction permission */ + /** Value of content extraction permission */ public static final int PERMISSION_COPY_CONTENT = 16; - /** Value of annotation editting permission */ + /** Value of annotation editting permission */ public static final int PERMISSION_EDIT_ANNOTATIONS = 32; - + // Encryption tools private MessageDigest digest = null; //private Cipher cipher = null; @@ -185,14 +185,14 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { } // Internal procedures - + private byte[] prepPassword(String password) { byte[] obuffer = new byte[32]; byte[] pbuffer = password.getBytes(); int i = 0; int j = 0; - + while (i < obuffer.length && i < pbuffer.length) { obuffer[i] = pbuffer[i]; i++; @@ -204,34 +204,34 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { return obuffer; } - /** + /** * Returns the document file ID * @return The file ID - */ + */ public byte[] getFileID() { if (fileID == null) { fileID = new byte[16]; random.nextBytes(fileID); } - + return fileID; } - - /** + + /** * This method returns the indexed file ID * @param index The index to access the file ID * @return The file ID - */ + */ public String getFileID(int index) { if (index == 1) { return PDFText.toHex(getFileID()); } - + byte[] id = new byte[16]; random.nextBytes(id); return PDFText.toHex(id); } - + private byte[] encryptWithKey(byte[] data, byte[] key) { try { final Cipher c = initCipher(key); @@ -242,7 +242,7 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { throw new IllegalStateException(e.getMessage()); } } - + private Cipher initCipher(byte[] key) { try { Cipher c = Cipher.getInstance("RC4"); @@ -257,7 +257,7 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { throw new UnsupportedOperationException(e.getMessage()); } } - + private Cipher initCipher(int number, int generation) { byte[] hash = calcHash(number, generation); int size = hash.length; @@ -265,12 +265,12 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { byte[] key = calcKey(hash, size); return initCipher(key); } - + private byte[] encryptWithHash(byte[] data, byte[] hash, int size) { hash = digest.digest(hash); - byte[] key = calcKey(hash, size); - + byte[] key = calcKey(hash, size); + return encryptWithKey(data, key); } @@ -283,19 +283,19 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { return key; } - /** + /** * This method initializes the encryption algorithms and values - */ + */ public void init() { // Generate the owner value byte[] oValue; if (params.getOwnerPassword().length() > 0) { oValue = encryptWithHash( - prepPassword(params.getUserPassword()), + prepPassword(params.getUserPassword()), prepPassword(params.getOwnerPassword()), 5); } else { oValue = encryptWithHash( - prepPassword(params.getUserPassword()), + prepPassword(params.getUserPassword()), prepPassword(params.getUserPassword()), 5); } @@ -330,12 +330,12 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { for (int i = 0; i < 5; i++) { this.encryptionKey[i] = hash[i]; } - + // Create the user value byte[] uValue = encryptWithKey(prepPassword(""), this.encryptionKey); - + // Create the dictionary - this.dictionary = getObjectID() + this.dictionary = getObjectID() + "<< /Filter /Standard\n" + "/V 1\n" + "/R 2\n" @@ -347,18 +347,18 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { + "endobj\n"; } - /** + /** * This method encrypts the passed data using the generated keys. * @param data The data to be encrypted * @param number The block number * @param generation The block generation * @return The encrypted data - */ + */ public byte[] encryptData(byte[] data, int number, int generation) { if (this.encryptionKey == null) { throw new IllegalStateException("PDF Encryption has not been initialized"); } - byte[] hash = calcHash(number, generation); + byte[] hash = calcHash(number, generation); return encryptWithHash(data, hash, hash.length); } @@ -376,26 +376,26 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { private byte[] calcHash(int number, int generation) { byte[] hash = new byte[this.encryptionKey.length + 5]; - + int i = 0; while (i < this.encryptionKey.length) { hash[i] = this.encryptionKey[i]; i++; } - + hash[i++] = (byte) (number >>> 0); hash[i++] = (byte) (number >>> 8); hash[i++] = (byte) (number >>> 16); hash[i++] = (byte) (generation >>> 0); hash[i++] = (byte) (generation >>> 8); - return hash; + return hash; } - /** + /** * Creates PDFFilter for the encryption object * @param number The object number * @param generation The objects generation * @return The resulting filter - */ + */ public PDFFilter makeFilter(int number, int generation) { return new EncryptionFilter(this, number, generation); } @@ -403,12 +403,12 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { /** * Adds a PDFFilter to the PDFStream object * @param stream the stream to add an encryption filter to - */ + */ public void applyFilter(AbstractPDFStream stream) { stream.getFilterList().addFilter( this.makeFilter(stream.getObjectNumber(), stream.getGeneration())); } - + /** * Represent the object in PDF * @@ -418,7 +418,7 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { if (this.dictionary == null) { throw new IllegalStateException("PDF Encryption has not been initialized"); } - + return encode(this.dictionary); } @@ -426,7 +426,7 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { * {@inheritDoc} */ public String getTrailerEntry() { - return "/Encrypt " + getObjectNumber() + " " + return "/Encrypt " + getObjectNumber() + " " + getGeneration() + " R\n" + "/ID[" + getFileID(1) + getFileID(2) + "]\n"; } diff --git a/src/java/org/apache/fop/pdf/PDFEncryptionManager.java b/src/java/org/apache/fop/pdf/PDFEncryptionManager.java index 6856cc37c..5d5ea8586 100644 --- a/src/java/org/apache/fop/pdf/PDFEncryptionManager.java +++ b/src/java/org/apache/fop/pdf/PDFEncryptionManager.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.lang.reflect.InvocationTargetException; @@ -48,7 +48,7 @@ public class PDFEncryptionManager { return false; } } - + /** * Checks whether the necessary algorithms are available. * @return boolean True if all necessary algorithms are present @@ -71,7 +71,7 @@ public class PDFEncryptionManager { return true; } } - + /** * Sets up PDF encryption if PDF encryption is requested by registering @@ -80,7 +80,7 @@ public class PDFEncryptionManager { * @param params the PDF encryption params or null to disable encryption * @param pdf the PDF document to setup encryption for */ - public static void setupPDFEncryption(PDFEncryptionParams params, + public static void setupPDFEncryption(PDFEncryptionParams params, PDFDocument pdf) { if (pdf == null) { throw new NullPointerException("PDF document must not be null"); @@ -101,7 +101,7 @@ public class PDFEncryptionManager { pdf.setEncryption(params); } } - + /** * Creates a new PDFEncryption instance if PDF encryption is available. * @param objnum PDF object number @@ -112,9 +112,9 @@ public class PDFEncryptionManager { public static PDFEncryption newInstance(int objnum, PDFEncryptionParams params) { try { Class clazz = Class.forName("org.apache.fop.pdf.PDFEncryptionJCE"); - Method makeMethod = clazz.getMethod("make", + Method makeMethod = clazz.getMethod("make", new Class[] {int.class, PDFEncryptionParams.class}); - Object obj = makeMethod.invoke(null, + Object obj = makeMethod.invoke(null, new Object[] {new Integer(objnum), params}); return (PDFEncryption)obj; } catch (ClassNotFoundException e) { @@ -135,5 +135,5 @@ public class PDFEncryptionManager { return null; } } - + } diff --git a/src/java/org/apache/fop/pdf/PDFEncryptionParams.java b/src/java/org/apache/fop/pdf/PDFEncryptionParams.java index d3287849d..9cc502c42 100644 --- a/src/java/org/apache/fop/pdf/PDFEncryptionParams.java +++ b/src/java/org/apache/fop/pdf/PDFEncryptionParams.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** @@ -30,7 +30,7 @@ public class PDFEncryptionParams { private boolean allowCopyContent = true; private boolean allowEditContent = true; private boolean allowEditAnnotations = true; - + /** * Creates a new instance. * @param userPassword the user password @@ -52,14 +52,14 @@ public class PDFEncryptionParams { setAllowEditContent(allowEditContent); setAllowEditAnnotations(allowEditAnnotations); } - + /** * Default constructor initializing to default values. */ public PDFEncryptionParams() { //nop } - + /** * Indicates whether copying content is allowed. * @return true if copying is allowed diff --git a/src/java/org/apache/fop/pdf/PDFFactory.java b/src/java/org/apache/fop/pdf/PDFFactory.java index 6211b5da7..fc6e6b9fa 100644 --- a/src/java/org/apache/fop/pdf/PDFFactory.java +++ b/src/java/org/apache/fop/pdf/PDFFactory.java @@ -913,8 +913,8 @@ public class PDFFactory { PDFNameTreeNode node = new PDFNameTreeNode(); getDocument().registerObject(node); return node; - } - + } + /* ========================= links ===================================== */ // Some of the "yoffset-only" functions in this part are obsolete and can // possibly be removed or deprecated. Some are still called by PDFGraphics2D @@ -1250,7 +1250,7 @@ public class PDFFactory { nonBase14.setWidthMetrics(firstChar, lastChar, new PDFArray(null, metrics.getWidths())); - + //Handle encoding SingleByteEncoding mapping = singleByteFont.getEncoding(); if (singleByteFont.isSymbolicFont()) { @@ -1265,10 +1265,10 @@ public class PDFFactory { } else { font.setEncoding((String)pdfEncoding); } - + /* JM: What I thought would be a necessity with custom encodings turned out to * be a bug in Adobe Acrobat 8. The following section just demonstrates how - * to generate a ToUnicode CMap for a Type 1 font. + * to generate a ToUnicode CMap for a Type 1 font. PDFCMap cmap = new PDFToUnicodeCMap(mapping.getUnicodeCharMap(), "fop-ucs-H", new PDFCIDSystemInfo("Adobe", "Identity", 0)); @@ -1276,7 +1276,7 @@ public class PDFFactory { nonBase14.setToUnicode(cmap); */ } - + //Handle additional encodings (characters outside the primary encoding) if (singleByteFont.hasAdditionalEncodings()) { for (int i = 0, c = singleByteFont.getAdditionalEncodingCount(); i < c; i++) { @@ -1573,7 +1573,7 @@ public class PDFFactory { /** * Create a PDFICCStream * @see PDFImageXObject - * @see org.apache.fop.pdf.PDFDeviceColorSpace + * @see org.apache.fop.pdf.PDFDeviceColorSpace * @return the new PDF ICC stream object */ public PDFICCStream makePDFICCStream() { diff --git a/src/java/org/apache/fop/pdf/PDFFileSpec.java b/src/java/org/apache/fop/pdf/PDFFileSpec.java index 2c91dac5c..a2bc6aefe 100644 --- a/src/java/org/apache/fop/pdf/PDFFileSpec.java +++ b/src/java/org/apache/fop/pdf/PDFFileSpec.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** @@ -47,9 +47,9 @@ public class PDFFileSpec extends PDFObject { * {@inheritDoc} */ public String toPDFString() { - return getObjectID() - + "<<\n/Type /FileSpec\n" - + "/F (" + this.filename + ")\n" + return getObjectID() + + "<<\n/Type /FileSpec\n" + + "/F (" + this.filename + ")\n" + ">>\nendobj\n"; } diff --git a/src/java/org/apache/fop/pdf/PDFFilter.java b/src/java/org/apache/fop/pdf/PDFFilter.java index ae99ed31c..c257f0da0 100644 --- a/src/java/org/apache/fop/pdf/PDFFilter.java +++ b/src/java/org/apache/fop/pdf/PDFFilter.java @@ -5,9 +5,9 @@ * 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. @@ -16,10 +16,10 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; -import java.io.OutputStream; +import java.io.OutputStream; import java.io.IOException; /** diff --git a/src/java/org/apache/fop/pdf/PDFFilterException.java b/src/java/org/apache/fop/pdf/PDFFilterException.java index 83fbf7c4d..4d98584cd 100644 --- a/src/java/org/apache/fop/pdf/PDFFilterException.java +++ b/src/java/org/apache/fop/pdf/PDFFilterException.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** diff --git a/src/java/org/apache/fop/pdf/PDFFilterList.java b/src/java/org/apache/fop/pdf/PDFFilterList.java index 84131707b..5eab5c81a 100644 --- a/src/java/org/apache/fop/pdf/PDFFilterList.java +++ b/src/java/org/apache/fop/pdf/PDFFilterList.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -25,7 +25,7 @@ import java.util.List; import java.util.Map; /** - * This class represents a list of PDF filters to be applied when serializing + * This class represents a list of PDF filters to be applied when serializing * the output of a PDF object. */ public class PDFFilterList { @@ -50,9 +50,9 @@ public class PDFFilterList { private List filters = new java.util.ArrayList(); private boolean ignoreASCIIFilters = false; - + private boolean disableAllFilters = false; - + /** * Default constructor. * <p> @@ -61,7 +61,7 @@ public class PDFFilterList { public PDFFilterList() { //nop } - + /** * Use this descriptor if you want to have ASCII filters (such as ASCIIHex * and ASCII85) ignored, for example, when encryption is active. @@ -78,7 +78,7 @@ public class PDFFilterList { public void setDisableAllFilters(boolean value) { this.disableAllFilters = value; } - + /** * Returns true if all filters are disabled. * @return true if all filters are disabled @@ -86,7 +86,7 @@ public class PDFFilterList { public boolean isDisableAllFilters() { return this.disableAllFilters; } - + /** * Indicates whether the filter list is already initialized. * @return true if more there are filters present @@ -111,7 +111,7 @@ public class PDFFilterList { filters.add(filter); } } - + /** * Add a filter for compression of the stream by name. * @param filterType name of the filter to add @@ -211,7 +211,7 @@ public class PDFFilterList { int nonNullParams = populateNamesAndParms(names, parms); // now build up the filter entries for the dictionary - return buildFilterEntries(names) + return buildFilterEntries(names) + (nonNullParams > 0 ? buildDecodeParms(parms) : ""); } return ""; @@ -238,7 +238,7 @@ public class PDFFilterList { putDecodeParams(dict, parms); } } - + private int populateNamesAndParms(List names, List parms) { // run the filters int nonNullParams = 0; @@ -247,7 +247,7 @@ public class PDFFilterList { // place the names in our local vector in reverse order if (filter.getName().length() > 0) { names.add(0, filter.getName()); - PDFObject param = filter.getDecodeParms(); + PDFObject param = filter.getDecodeParms(); if (param != null) { parms.add(0, param); nonNullParams++; @@ -297,7 +297,7 @@ public class PDFFilterList { } } } - + private String buildDecodeParms(List parms) { StringBuffer sb = new StringBuffer(); boolean needParmsEntry = false; @@ -346,9 +346,9 @@ public class PDFFilterList { } } } - + /** - * Applies all registered filters as necessary. The method returns an + * Applies all registered filters as necessary. The method returns an * OutputStream which will receive the filtered contents. * @param stream raw data output stream * @return OutputStream filtered output stream diff --git a/src/java/org/apache/fop/pdf/PDFFont.java b/src/java/org/apache/fop/pdf/PDFFont.java index 1f76f1e11..6ba6ab9a2 100644 --- a/src/java/org/apache/fop/pdf/PDFFont.java +++ b/src/java/org/apache/fop/pdf/PDFFont.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -37,7 +37,7 @@ public class PDFFont extends PDFDictionary { /** Internal F-number for each font (it is not written to the font dict) */ private String fontname; - + /** * create the /Font object * @@ -74,7 +74,7 @@ public class PDFFont extends PDFDictionary { put("Encoding", new PDFName(encoding)); } } - + /** * Sets the Encoding value of the font. * @param encoding the encoding @@ -84,7 +84,7 @@ public class PDFFont extends PDFDictionary { put("Encoding", encoding); } } - + /** * factory method with the basic parameters * @@ -122,7 +122,7 @@ public class PDFFont extends PDFDictionary { public String getName() { return this.fontname; } - + /** * Returns the name of the BaseFont. * @return the BaseFont @@ -158,7 +158,7 @@ public class PDFFont extends PDFDictionary { protected void validate() { if (getDocumentSafely().getProfile().isFontEmbeddingRequired()) { if (this.getClass() == PDFFont.class) { - throw new PDFConformanceException("For " + getDocumentSafely().getProfile() + throw new PDFConformanceException("For " + getDocumentSafely().getProfile() + ", all fonts, even the base 14" + " fonts, have to be embedded! Offending font: " + getBaseFont()); } @@ -170,5 +170,5 @@ public class PDFFont extends PDFDictionary { validate(); return super.output(stream); } - + } diff --git a/src/java/org/apache/fop/pdf/PDFFontDescriptor.java b/src/java/org/apache/fop/pdf/PDFFontDescriptor.java index aa40bc35b..d4b412e4c 100644 --- a/src/java/org/apache/fop/pdf/PDFFontDescriptor.java +++ b/src/java/org/apache/fop/pdf/PDFFontDescriptor.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import org.apache.fop.fonts.FontType; @@ -59,16 +59,16 @@ public class PDFFontDescriptor extends PDFDictionary { /** * Set the optional metrics. - * @param avgWidth The average width of characters in this font. + * @param avgWidth The average width of characters in this font. * The default value is 0. - * @param maxWidth The maximum width of characters in this font. + * @param maxWidth The maximum width of characters in this font. * The default value is 0. * @param missingWidth missing width - * @param leading the desired spacing between lines of text. + * @param leading the desired spacing between lines of text. * The default value is 0. - * @param stemH The vertical width of the dominant horizontal stems of + * @param stemH The vertical width of the dominant horizontal stems of * glyphs in the font. The default value is 0. - * @param xHeight The y-coordinate of the top of flat non-ascending + * @param xHeight The y-coordinate of the top of flat non-ascending * lowercase letters, measured from the baseline. The default value is 0. */ public void setMetrics(int avgWidth, int maxWidth, int missingWidth, @@ -119,7 +119,7 @@ public class PDFFontDescriptor extends PDFDictionary { } return stream; } - + /** * Sets the CIDSet stream for this font descriptor. (Optional) * @param cidSet the CIDSet stream @@ -127,19 +127,19 @@ public class PDFFontDescriptor extends PDFDictionary { public void setCIDSet(AbstractPDFStream cidSet) { put("CIDSet", cidSet); } - + /** @return the CIDSet stream or null if not applicable */ public AbstractPDFStream getCIDSet() { return (AbstractPDFStream)get("CIDSet"); } - + /** * {@inheritDoc} */ /* public String toPDFString() { StringBuffer p = new StringBuffer(128); - p.append(getObjectID() + p.append(getObjectID() + "<< /Type /FontDescriptor" + "\n/FontName /" + this.basefont); diff --git a/src/java/org/apache/fop/pdf/PDFFontNonBase14.java b/src/java/org/apache/fop/pdf/PDFFontNonBase14.java index b97d5deec..9b6cef618 100644 --- a/src/java/org/apache/fop/pdf/PDFFontNonBase14.java +++ b/src/java/org/apache/fop/pdf/PDFFontNonBase14.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import org.apache.fop.fonts.FontType; @@ -70,7 +70,7 @@ public abstract class PDFFontNonBase14 extends PDFFont { public PDFFontDescriptor getDescriptor() { return (PDFFontDescriptor)get("FontDescriptor"); } - + /** * Sets a ToUnicode CMap. * @param cmap the ToUnicode character map @@ -78,15 +78,15 @@ public abstract class PDFFontNonBase14 extends PDFFont { public void setToUnicode(PDFCMap cmap) { put("ToUnicode", cmap); } - + /** {@inheritDoc} */ protected void validate() { if (getDocumentSafely().getProfile().isFontEmbeddingRequired()) { if (this.getDescriptor().getFontFile() == null) { - throw new PDFConformanceException("For " + getDocumentSafely().getProfile() + throw new PDFConformanceException("For " + getDocumentSafely().getProfile() + ", all fonts have to be embedded!"); } } } - + } diff --git a/src/java/org/apache/fop/pdf/PDFFontTrueType.java b/src/java/org/apache/fop/pdf/PDFFontTrueType.java index a5636f951..99c9f1c1f 100644 --- a/src/java/org/apache/fop/pdf/PDFFontTrueType.java +++ b/src/java/org/apache/fop/pdf/PDFFontTrueType.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import org.apache.fop.fonts.FontType; @@ -36,7 +36,7 @@ public class PDFFontTrueType extends PDFFontNonBase14 { * @param basefont the base font name * @param encoding the character encoding schema used by the font */ - public PDFFontTrueType(String fontname, + public PDFFontTrueType(String fontname, String basefont, Object encoding) { super(fontname, FontType.TRUETYPE, basefont, encoding); diff --git a/src/java/org/apache/fop/pdf/PDFFontType0.java b/src/java/org/apache/fop/pdf/PDFFontType0.java index 29d6d1b4f..2f5e037f3 100644 --- a/src/java/org/apache/fop/pdf/PDFFontType0.java +++ b/src/java/org/apache/fop/pdf/PDFFontType0.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import org.apache.fop.fonts.FontType; @@ -35,7 +35,7 @@ public class PDFFontType0 extends PDFFont { * @param basefont the base font name * @param encoding the character encoding schema used by the font */ - public PDFFontType0(String fontname, + public PDFFontType0(String fontname, String basefont, Object encoding) { super(fontname, FontType.TYPE0, basefont, encoding); @@ -49,9 +49,9 @@ public class PDFFontType0 extends PDFFont { * @param encoding the character encoding schema used by the font * @param descendantFonts the CIDFont upon which this font is based */ - public PDFFontType0(String fontname, + public PDFFontType0(String fontname, String basefont, - Object encoding, + Object encoding, PDFCIDFont descendantFonts) { super(fontname, FontType.TYPE0, basefont, encoding); diff --git a/src/java/org/apache/fop/pdf/PDFFontType1.java b/src/java/org/apache/fop/pdf/PDFFontType1.java index 8c9a7dc4d..884cb3e30 100644 --- a/src/java/org/apache/fop/pdf/PDFFontType1.java +++ b/src/java/org/apache/fop/pdf/PDFFontType1.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import org.apache.fop.fonts.FontType; @@ -40,7 +40,7 @@ public class PDFFontType1 extends PDFFontNonBase14 { * @param basefont the base font name * @param encoding the character encoding schema used by the font */ - public PDFFontType1(String fontname, + public PDFFontType1(String fontname, String basefont, Object encoding) { diff --git a/src/java/org/apache/fop/pdf/PDFFontType3.java b/src/java/org/apache/fop/pdf/PDFFontType3.java index 96ecb6b5a..03d5469ea 100644 --- a/src/java/org/apache/fop/pdf/PDFFontType3.java +++ b/src/java/org/apache/fop/pdf/PDFFontType3.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import org.apache.fop.fonts.FontType; @@ -38,7 +38,7 @@ public class PDFFontType3 extends PDFFontNonBase14 { * @param basefont the base font name * @param encoding the character encoding schema used by the font */ - public PDFFontType3(String fontname, + public PDFFontType3(String fontname, String basefont, Object encoding) { super(fontname, FontType.TYPE3, basefont, encoding); @@ -54,7 +54,7 @@ public class PDFFontType3 extends PDFFontNonBase14 { * @param fontMatrix the font's transformation matrix * @param charProcs the glyphs' definitions */ - public PDFFontType3(String fontname, + public PDFFontType3(String fontname, String basefont, Object encoding, PDFRectangle fontBBox, PDFArray fontMatrix, diff --git a/src/java/org/apache/fop/pdf/PDFFormXObject.java b/src/java/org/apache/fop/pdf/PDFFormXObject.java index 6ccf76c6c..5ede9b487 100644 --- a/src/java/org/apache/fop/pdf/PDFFormXObject.java +++ b/src/java/org/apache/fop/pdf/PDFFormXObject.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; // Java @@ -32,7 +32,7 @@ import java.io.OutputStream; * dictionary but a stream of image data. */ public class PDFFormXObject extends PDFXObject { - + private PDFStream contents; private PDFReference resRef; @@ -49,7 +49,7 @@ public class PDFFormXObject extends PDFXObject { put("Name", new PDFName("Form" + xnumber)); this.resRef = resources; this.contents = contents; - + put("Type", new PDFName("XObject")); put("Subtype", new PDFName("Form")); put("FormType", new Integer(1)); @@ -76,7 +76,7 @@ public class PDFFormXObject extends PDFXObject { array.set(3, bbox.getHeight()); } } - + /** * Returns the bounding box. * @return the BBox value @@ -95,7 +95,7 @@ public class PDFFormXObject extends PDFXObject { return null; } } - + /** * Sets the Matrix value * @param at the AffineTransform defining the transformation matrix @@ -122,7 +122,7 @@ public class PDFFormXObject extends PDFXObject { array.set(5, m[5]); } } - + /** * Returns the Matrix value. * @return the Matrix @@ -143,7 +143,7 @@ public class PDFFormXObject extends PDFXObject { return null; } } - + /** * Used to set the contents of the PDF stream. * @param data the contents as a byte array @@ -161,7 +161,7 @@ public class PDFFormXObject extends PDFXObject { /** {@inheritDoc} */ protected int output(OutputStream stream) throws IOException { final int len = super.output(stream); - + //Now that the data has been written, it can be discarded. this.contents = null; return len; @@ -175,6 +175,6 @@ public class PDFFormXObject extends PDFXObject { put("Resources", resRef); super.populateStreamDict(lengthEntry); } - + } diff --git a/src/java/org/apache/fop/pdf/PDFFunction.java b/src/java/org/apache/fop/pdf/PDFFunction.java index fdf419a2b..14cc318ba 100644 --- a/src/java/org/apache/fop/pdf/PDFFunction.java +++ b/src/java/org/apache/fop/pdf/PDFFunction.java @@ -5,9 +5,9 @@ * 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. diff --git a/src/java/org/apache/fop/pdf/PDFGState.java b/src/java/org/apache/fop/pdf/PDFGState.java index 03608994d..93151149b 100644 --- a/src/java/org/apache/fop/pdf/PDFGState.java +++ b/src/java/org/apache/fop/pdf/PDFGState.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.util.Map; @@ -81,7 +81,7 @@ public class PDFGState extends PDFObject { public static final String GSTATE_ALPHA_SOURCE_FLAG = "AIS"; /** Text Knockout Flag (TK, PDF 1.4) */ public static final String GSTATE_TEXT_KNOCKOUT = "TK"; - + /** Default GState object */ public static final PDFGState DEFAULT; @@ -99,7 +99,7 @@ public class PDFGState extends PDFObject { vals.put(op, Boolean.FALSE); vals.put(OPM, new Integer(1)); vals.put(Font, "");*/ - + vals.put(GSTATE_ALPHA_STROKE, new Float(1.0)); vals.put(GSTATE_ALPHA_NONSTROKE, new Float(1.0)); } @@ -117,7 +117,7 @@ public class PDFGState extends PDFObject { /** * Sets the alpha value. * @param val alpha value (0.0 - 1.0) - * @param fill True if alpha should be set for non-stroking operations, + * @param fill True if alpha should be set for non-stroking operations, * False if for stroking operations */ public void setAlpha(float val, boolean fill) { diff --git a/src/java/org/apache/fop/pdf/PDFGoTo.java b/src/java/org/apache/fop/pdf/PDFGoTo.java index ae35928d2..b3ff6bcdc 100644 --- a/src/java/org/apache/fop/pdf/PDFGoTo.java +++ b/src/java/org/apache/fop/pdf/PDFGoTo.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.awt.geom.Point2D; @@ -128,7 +128,7 @@ public class PDFGoTo extends PDFAction { } else { dest = "/D [" + this.pageReference + " " + destination + "]\n"; } - return getObjectID() + return getObjectID() + "<< /Type /Action\n/S /GoTo\n" + dest + ">>\nendobj\n"; } diff --git a/src/java/org/apache/fop/pdf/PDFGoToRemote.java b/src/java/org/apache/fop/pdf/PDFGoToRemote.java index 2cd937df3..e04a1668f 100644 --- a/src/java/org/apache/fop/pdf/PDFGoToRemote.java +++ b/src/java/org/apache/fop/pdf/PDFGoToRemote.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** diff --git a/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java b/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java index e0cac0746..66753f37f 100644 --- a/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java +++ b/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java @@ -33,7 +33,7 @@ public class PDFICCBasedColorSpace extends PDFObject implements PDFColorSpace { private PDFICCStream iccStream; private String explicitName; - + /** * Constructs a the ICCBased color space with an explicit name (ex. "DefaultRGB"). * @param explicitName an explicit name or null if a name should be generated @@ -43,7 +43,7 @@ public class PDFICCBasedColorSpace extends PDFObject implements PDFColorSpace { this.explicitName = explicitName; this.iccStream = iccStream; } - + /** * Constructs a the ICCBased color space. * @param iccStream the ICC stream to associate with this color space @@ -51,12 +51,12 @@ public class PDFICCBasedColorSpace extends PDFObject implements PDFColorSpace { public PDFICCBasedColorSpace(PDFICCStream iccStream) { this(null, iccStream); } - + /** @return the ICC stream associated with this color space */ public PDFICCStream getICCStream() { return this.iccStream; } - + /** {@inheritDoc} */ public int getNumComponents() { return iccStream.getICCProfile().getNumComponents(); @@ -151,5 +151,5 @@ public class PDFICCBasedColorSpace extends PDFObject implements PDFColorSpace { sRGBProfile.setColorSpace(profile, null); return sRGBProfile; } - + } diff --git a/src/java/org/apache/fop/pdf/PDFICCStream.java b/src/java/org/apache/fop/pdf/PDFICCStream.java index f242c0cae..b70ed017a 100644 --- a/src/java/org/apache/fop/pdf/PDFICCStream.java +++ b/src/java/org/apache/fop/pdf/PDFICCStream.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.awt.color.ICC_Profile; @@ -27,7 +27,7 @@ import java.io.OutputStream; * Special PDFStream for ICC profiles (color profiles). */ public class PDFICCStream extends PDFStream { - + private ICC_Profile cp; private PDFDeviceColorSpace pdfColorSpace; @@ -53,7 +53,7 @@ public class PDFICCStream extends PDFStream { public ICC_Profile getICCProfile() { return this.cp; } - + /** * overload the base object method so we don't have to copy * byte arrays around so much @@ -65,12 +65,12 @@ public class PDFICCStream extends PDFStream { this.cp = null; //Free ICC stream when it's not used anymore return length; } - + /** {@inheritDoc} */ protected void outputRawStreamData(OutputStream out) throws IOException { cp.write(out); } - + /** {@inheritDoc} */ protected void populateStreamDict(Object lengthEntry) { put("N", cp.getNumComponents()); diff --git a/src/java/org/apache/fop/pdf/PDFImage.java b/src/java/org/apache/fop/pdf/PDFImage.java index e0aaa44fa..e2b9e521c 100644 --- a/src/java/org/apache/fop/pdf/PDFImage.java +++ b/src/java/org/apache/fop/pdf/PDFImage.java @@ -5,9 +5,9 @@ * 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. @@ -111,14 +111,14 @@ public interface PDFImage { /** @return true for CMYK images generated by Adobe Photoshop */ boolean isInverted(); - + /** * Get the PDF Filter to be applied to the image. * * @return the PDF Filter or null */ PDFFilter getPDFFilter(); - + // get the image bytes, and bytes properties /** @@ -132,11 +132,11 @@ public interface PDFImage { /** * Populates the XObject's dictionary with additional values. The values are added to the * dictionary after all the values obtained from other methods from this interface have - * been put into the dictionary. That allows to override certain values. + * been put into the dictionary. That allows to override certain values. * @param dict the dictionary to fill */ void populateXObjectDictionary(PDFDictionary dict); - + /** * Get the ICC stream for this image. * diff --git a/src/java/org/apache/fop/pdf/PDFImageXObject.java b/src/java/org/apache/fop/pdf/PDFImageXObject.java index 14fbeed4d..7104422e7 100644 --- a/src/java/org/apache/fop/pdf/PDFImageXObject.java +++ b/src/java/org/apache/fop/pdf/PDFImageXObject.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; // Java @@ -37,7 +37,7 @@ import java.io.OutputStream; * document in another place. */ public class PDFImageXObject extends PDFXObject { - + private PDFImage pdfimage; /** @@ -63,7 +63,7 @@ public class PDFImageXObject extends PDFXObject { */ protected int output(OutputStream stream) throws IOException { int length = super.output(stream); - + // let it gc // this object is retained as a reference to inserting // the same image but the image data is no longer needed @@ -80,7 +80,7 @@ public class PDFImageXObject extends PDFXObject { populateDictionaryFromImage(); } } - + private void populateDictionaryFromPS() { getDocumentSafely().getProfile().verifyPSXObjectsAllowed(); put("Subtype", new PDFName("PS")); @@ -139,7 +139,7 @@ public class PDFImageXObject extends PDFXObject { //Important: do this at the end so previous values can be overwritten. pdfimage.populateXObjectDictionary(this); } - + /** {@inheritDoc} */ protected void outputRawStreamData(OutputStream out) throws IOException { pdfimage.outputContents(out); @@ -157,7 +157,7 @@ public class PDFImageXObject extends PDFXObject { getFilterList().ensureFilterInPlace(pdfFilter); } } - + /** * This sets up the default filters for XObjects. It uses the PDFImage * instance to determine what default filters to apply. @@ -166,11 +166,11 @@ public class PDFImageXObject extends PDFXObject { protected void setupFilterList() { if (!getFilterList().isInitialized()) { getFilterList().addDefaultFilters( - getDocumentSafely().getFilterMap(), + getDocumentSafely().getFilterMap(), pdfimage.getFilterHint()); } super.setupFilterList(); } - + } diff --git a/src/java/org/apache/fop/pdf/PDFInfo.java b/src/java/org/apache/fop/pdf/PDFInfo.java index 888fdb2c6..14937bfd7 100644 --- a/src/java/org/apache/fop/pdf/PDFInfo.java +++ b/src/java/org/apache/fop/pdf/PDFInfo.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.util.Date; @@ -50,7 +50,7 @@ public class PDFInfo extends PDFObject { public String getProducer() { return this.producer; } - + /** * set the producer string * @@ -64,7 +64,7 @@ public class PDFInfo extends PDFObject { public String getCreator() { return this.creator; } - + /** * set the creator string * @@ -92,7 +92,7 @@ public class PDFInfo extends PDFObject { public String getAuthor() { return this.author; } - + /** * set the author string * @@ -106,7 +106,7 @@ public class PDFInfo extends PDFObject { public String getSubject() { return this.subject; } - + /** * set the subject string * @@ -120,7 +120,7 @@ public class PDFInfo extends PDFObject { public String getKeywords() { return this.keywords; } - + /** * set the keywords string * @@ -162,7 +162,7 @@ public class PDFInfo extends PDFObject { * {@inheritDoc} */ public byte[] toPDF() { - PDFProfile profile = getDocumentSafely().getProfile(); + PDFProfile profile = getDocumentSafely().getProfile(); ByteArrayOutputStream bout = new ByteArrayOutputStream(128); try { bout.write(encode(getObjectID())); @@ -189,17 +189,17 @@ public class PDFInfo extends PDFObject { bout.write(encodeText(this.keywords)); bout.write(encode("\n")); } - + if (creator != null) { bout.write(encode("/Creator ")); bout.write(encodeText(this.creator)); bout.write(encode("\n")); } - + bout.write(encode("/Producer ")); bout.write(encodeText(this.producer)); bout.write(encode("\n")); - + // creation date in form (D:YYYYMMDDHHmmSSOHH'mm') if (creationDate == null) { creationDate = new Date(); @@ -207,7 +207,7 @@ public class PDFInfo extends PDFObject { bout.write(encode("/CreationDate ")); bout.write(encodeString(formatDateTime(creationDate))); bout.write(encode("\n")); - + if (profile.isModDateRequired() && this.modDate == null) { this.modDate = this.creationDate; } @@ -224,7 +224,7 @@ public class PDFInfo extends PDFObject { if (profile.isTrappedEntryRequired()) { bout.write(encode("/Trapped /False\n")); } - + bout.write(encode(">>\nendobj\n")); } catch (IOException ioe) { log.error("Ignored I/O exception", ioe); diff --git a/src/java/org/apache/fop/pdf/PDFInternalLink.java b/src/java/org/apache/fop/pdf/PDFInternalLink.java index fcdc2e1bc..faa6070a1 100644 --- a/src/java/org/apache/fop/pdf/PDFInternalLink.java +++ b/src/java/org/apache/fop/pdf/PDFInternalLink.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** diff --git a/src/java/org/apache/fop/pdf/PDFLink.java b/src/java/org/apache/fop/pdf/PDFLink.java index fb8544f6b..a7c4c6548 100644 --- a/src/java/org/apache/fop/pdf/PDFLink.java +++ b/src/java/org/apache/fop/pdf/PDFLink.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; // Java diff --git a/src/java/org/apache/fop/pdf/PDFMetadata.java b/src/java/org/apache/fop/pdf/PDFMetadata.java index e0833a30f..6d15a67d4 100644 --- a/src/java/org/apache/fop/pdf/PDFMetadata.java +++ b/src/java/org/apache/fop/pdf/PDFMetadata.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -43,7 +43,7 @@ import org.apache.xmlgraphics.xmp.schemas.pdf.PDFAXMPSchema; * @since PDF 1.4 */ public class PDFMetadata extends PDFStream { - + private Metadata xmpMetadata; private boolean readOnly = true; @@ -62,7 +62,7 @@ public class PDFMetadata extends PDFStream { protected void setupFilterList() { if (!getFilterList().isInitialized()) { getFilterList().addDefaultFilters( - getDocumentSafely().getFilterMap(), + getDocumentSafely().getFilterMap(), PDFFilterList.METADATA_FILTER); } super.setupFilterList(); @@ -74,7 +74,7 @@ public class PDFMetadata extends PDFStream { public Metadata getMetadata() { return this.xmpMetadata; } - + /** * overload the base object method so we don't have to copy * byte arrays around so much @@ -86,24 +86,24 @@ public class PDFMetadata extends PDFStream { this.xmpMetadata = null; //Release DOM when it's not used anymore return length; } - + /** {@inheritDoc} */ protected void outputRawStreamData(OutputStream out) throws IOException { try { XMPSerializer.writeXMPPacket(xmpMetadata, out, this.readOnly); } catch (TransformerConfigurationException tce) { - throw new IOException("Error setting up Transformer for XMP stream serialization: " + throw new IOException("Error setting up Transformer for XMP stream serialization: " + tce.getMessage()); } catch (SAXException saxe) { - throw new IOException("Error while serializing XMP stream: " + throw new IOException("Error while serializing XMP stream: " + saxe.getMessage()); } } - + /** {@inheritDoc} */ protected void populateStreamDict(Object lengthEntry) { final String filterEntry = getFilterList().buildFilterDictEntries(); - if (getDocumentSafely().getProfile().getPDFAMode().isPDFA1LevelB() + if (getDocumentSafely().getProfile().getPDFAMode().isPDFA1LevelB() && filterEntry != null && filterEntry.length() > 0) { throw new PDFConformanceException( "The Filter key is prohibited when PDF/A-1 is active"); @@ -112,7 +112,7 @@ public class PDFMetadata extends PDFStream { put("Subtype", new PDFName("XML")); super.populateStreamDict(lengthEntry); } - + /** * Creates an XMP document based on the settings on the PDF Document. * @param pdfDoc the PDF Document @@ -120,7 +120,7 @@ public class PDFMetadata extends PDFStream { */ public static Metadata createXMPFromPDFDocument(PDFDocument pdfDoc) { Metadata meta = new Metadata(); - + PDFInfo info = pdfDoc.getInfo(); PDFRoot root = pdfDoc.getRoot(); @@ -129,7 +129,7 @@ public class PDFMetadata extends PDFStream { Date d = new Date(); info.setCreationDate(d); } - + //Important: Acrobat 7's preflight check for PDF/A-1b wants the creation date in the Info //object and in the XMP metadata to have the same timezone or else it shows a validation //error even if the times are essentially equal. @@ -153,7 +153,7 @@ public class PDFMetadata extends PDFStream { dc.addDate(info.getCreationDate()); //PDF/A identification - PDFAMode pdfaMode = pdfDoc.getProfile().getPDFAMode(); + PDFAMode pdfaMode = pdfDoc.getProfile().getPDFAMode(); if (pdfaMode.isPDFA1LevelB()) { PDFAAdapter pdfa = PDFAXMPSchema.getAdapter(meta); pdfa.setPart(1); @@ -163,7 +163,7 @@ public class PDFMetadata extends PDFStream { pdfa.setConformance("B"); //PDF/A-1b } } - + //XMP Basic Schema XMPBasicAdapter xmpBasic = XMPBasicSchema.getAdapter(meta); xmpBasic.setCreateDate(info.getCreationDate()); @@ -186,8 +186,8 @@ public class PDFMetadata extends PDFStream { adobePDF.setProducer(info.getProducer()); } adobePDF.setPDFVersion(pdfDoc.getPDFVersionString()); - - + + return meta; } @@ -206,14 +206,14 @@ public class PDFMetadata extends PDFStream { } else { info.setAuthor(null); } - + //dc:description["x-default"] maps to Subject as per ISO-19005-1:2005/Cor.1:2007 info.setSubject(dc.getDescription()); - + AdobePDFAdapter pdf = AdobePDFSchema.getAdapter(meta); info.setKeywords(pdf.getKeywords()); info.setProducer(pdf.getProducer()); - + XMPBasicAdapter xmpBasic = XMPBasicSchema.getAdapter(meta); info.setCreator(xmpBasic.getCreatorTool()); Date d; diff --git a/src/java/org/apache/fop/pdf/PDFName.java b/src/java/org/apache/fop/pdf/PDFName.java index 26d449591..6dabc3ac4 100644 --- a/src/java/org/apache/fop/pdf/PDFName.java +++ b/src/java/org/apache/fop/pdf/PDFName.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -29,9 +29,9 @@ import org.apache.commons.io.output.CountingOutputStream; * Class representing a PDF name object. */ public class PDFName extends PDFObject { - + private String name; - + /** * Creates a new PDF name object. * @param name the name value @@ -58,8 +58,8 @@ public class PDFName extends PDFObject { } return sb.toString(); } - - private static final char[] DIGITS + + private static final char[] DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; @@ -71,7 +71,7 @@ public class PDFName extends PDFObject { sb.append(DIGITS[ch >>> 4 & 0x0F]); sb.append(DIGITS[ch & 0x0F]); } - + /** {@inheritDoc} */ public String toString() { return this.name; @@ -86,15 +86,15 @@ public class PDFName extends PDFObject { } writer.write(toString()); - + if (hasObjectNumber()) { writer.write("\nendobj\n"); } - + writer.flush(); return cout.getCount(); } - + /** {@inheritDoc} */ public void outputInline(OutputStream out, Writer writer) throws IOException { if (hasObjectNumber()) { @@ -103,5 +103,5 @@ public class PDFName extends PDFObject { writer.write(toString()); } } - + } diff --git a/src/java/org/apache/fop/pdf/PDFNameTreeNode.java b/src/java/org/apache/fop/pdf/PDFNameTreeNode.java index 4dcf0e03e..4bc00ef9c 100644 --- a/src/java/org/apache/fop/pdf/PDFNameTreeNode.java +++ b/src/java/org/apache/fop/pdf/PDFNameTreeNode.java @@ -43,7 +43,7 @@ public class PDFNameTreeNode extends PDFDictionary { public void setKids(PDFArray kids) { put(KIDS, kids); } - + /** * Returns the Kids array. * @return the Kids array @@ -51,7 +51,7 @@ public class PDFNameTreeNode extends PDFDictionary { public PDFArray getKids() { return (PDFArray)get(KIDS); } - + /** * Sets the Names array. * @param names the Names array @@ -59,7 +59,7 @@ public class PDFNameTreeNode extends PDFDictionary { public void setNames(PDFArray names) { put(NAMES, names); } - + /** * Returns the Names array. * @return the Names array @@ -67,7 +67,7 @@ public class PDFNameTreeNode extends PDFDictionary { public PDFArray getNames() { return (PDFArray)get(NAMES); } - + /** * Sets the lower limit value of the Limits array. * @param key the lower limit value @@ -116,6 +116,6 @@ public class PDFNameTreeNode extends PDFDictionary { } return limits; } - + } diff --git a/src/java/org/apache/fop/pdf/PDFNames.java b/src/java/org/apache/fop/pdf/PDFNames.java index d2d895771..4253dd6d1 100644 --- a/src/java/org/apache/fop/pdf/PDFNames.java +++ b/src/java/org/apache/fop/pdf/PDFNames.java @@ -5,9 +5,9 @@ * 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. @@ -16,14 +16,14 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** * Class representing a PDF Names object */ public class PDFNames extends PDFDictionary { - + /** * Create the Names object */ @@ -39,7 +39,7 @@ public class PDFNames extends PDFDictionary { public PDFDests getDests() { return (PDFDests)get("Dests"); } - + /** * Set the Dests object * @param dests the Dests object @@ -47,5 +47,5 @@ public class PDFNames extends PDFDictionary { public void setDests(PDFDests dests) { put("Dests", dests); } - + } diff --git a/src/java/org/apache/fop/pdf/PDFNull.java b/src/java/org/apache/fop/pdf/PDFNull.java index b1af30dc0..01ec7898c 100644 --- a/src/java/org/apache/fop/pdf/PDFNull.java +++ b/src/java/org/apache/fop/pdf/PDFNull.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -27,10 +27,10 @@ import java.io.Writer; * Class representing a PDF name object. */ public final class PDFNull implements PDFWritable { - + /** Instance for the "null" object. */ public static final PDFNull INSTANCE = new PDFNull(); - + /** * Creates a new PDF name object. * @param name the name value @@ -42,10 +42,10 @@ public final class PDFNull implements PDFWritable { public String toString() { return "null"; } - + /** {@inheritDoc} */ public void outputInline(OutputStream out, Writer writer) throws IOException { writer.write(toString()); } - + } diff --git a/src/java/org/apache/fop/pdf/PDFNumber.java b/src/java/org/apache/fop/pdf/PDFNumber.java index 2a8d6c472..55834f529 100644 --- a/src/java/org/apache/fop/pdf/PDFNumber.java +++ b/src/java/org/apache/fop/pdf/PDFNumber.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.text.DecimalFormat; @@ -24,7 +24,7 @@ import java.text.DecimalFormatSymbols; import java.util.Locale; /** - * This class represents a simple number object. It also contains contains some + * This class represents a simple number object. It also contains contains some * utility methods for outputing numbers to PDF. */ public class PDFNumber extends PDFObject { @@ -38,7 +38,7 @@ public class PDFNumber extends PDFObject { public Number getNumber() { return this.number; } - + /** * Sets the number. * @param number the number @@ -69,9 +69,9 @@ public class PDFNumber extends PDFObject { // Static cache. Possible concurrency implications. See comment in doubleOut(double, int). private static DecimalFormat[] decimalFormatCache = new DecimalFormat[17]; - + private static final String BASE_FORMAT = "0.################"; - + /** * Output a double value to a string suitable for PDF. * In this method it is possible to set the maximum @@ -83,7 +83,7 @@ public class PDFNumber extends PDFObject { */ public static String doubleOut(double doubleDown, int dec) { if (dec < 0 || dec >= decimalFormatCache.length) { - throw new IllegalArgumentException("Parameter dec must be between 1 and " + throw new IllegalArgumentException("Parameter dec must be between 1 and " + (decimalFormatCache.length + 1)); } if (decimalFormatCache[dec] == null) { diff --git a/src/java/org/apache/fop/pdf/PDFNumberTreeNode.java b/src/java/org/apache/fop/pdf/PDFNumberTreeNode.java index ef1ccb452..72fbcd1c6 100644 --- a/src/java/org/apache/fop/pdf/PDFNumberTreeNode.java +++ b/src/java/org/apache/fop/pdf/PDFNumberTreeNode.java @@ -43,7 +43,7 @@ public class PDFNumberTreeNode extends PDFDictionary { public void setKids(PDFArray kids) { put(KIDS, kids); } - + /** * Returns the Kids array. * @return the Kids array @@ -51,7 +51,7 @@ public class PDFNumberTreeNode extends PDFDictionary { public PDFArray getKids() { return (PDFArray)get(KIDS); } - + /** * Sets the Nums array. * @param nums the Nums array @@ -59,7 +59,7 @@ public class PDFNumberTreeNode extends PDFDictionary { public void setNums(PDFNumsArray nums) { put(NUMS, nums); } - + /** * Returns the Nums array. * @return the Nums array @@ -67,7 +67,7 @@ public class PDFNumberTreeNode extends PDFDictionary { public PDFNumsArray getNums() { return (PDFNumsArray)get(NUMS); } - + /** * Sets the lower limit value of the Limits array. * @param key the lower limit value @@ -116,6 +116,6 @@ public class PDFNumberTreeNode extends PDFDictionary { } return limits; } - + } diff --git a/src/java/org/apache/fop/pdf/PDFNumsArray.java b/src/java/org/apache/fop/pdf/PDFNumsArray.java index 0a86754e8..e1c38dd48 100644 --- a/src/java/org/apache/fop/pdf/PDFNumsArray.java +++ b/src/java/org/apache/fop/pdf/PDFNumsArray.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -32,7 +32,7 @@ import org.apache.commons.io.output.CountingOutputStream; * Class representing an "Nums" array object (for Number Trees). */ public class PDFNumsArray extends PDFObject { - + /** Sorted Map holding the values of this array. */ protected SortedMap map = new java.util.TreeMap(); @@ -51,7 +51,7 @@ public class PDFNumsArray extends PDFObject { public int length() { return this.map.size(); } - + /** * Sets an entry. * @param key the key of the value to set @@ -60,7 +60,7 @@ public class PDFNumsArray extends PDFObject { public void put(int key, Object obj) { this.map.put(new Integer(key), obj); } - + /** * Gets an entry. * @param key the key of requested value @@ -69,7 +69,7 @@ public class PDFNumsArray extends PDFObject { public Object get(int key) { return this.map.get(new Integer(key)); } - + /** {@inheritDoc} */ protected int output(OutputStream stream) throws IOException { CountingOutputStream cout = new CountingOutputStream(stream); @@ -77,7 +77,7 @@ public class PDFNumsArray extends PDFObject { if (hasObjectNumber()) { writer.write(getObjectID()); } - + writer.write('['); boolean first = true; Iterator iter = this.map.entrySet().iterator(); @@ -92,13 +92,13 @@ public class PDFNumsArray extends PDFObject { formatObject(entry.getValue(), cout, writer); } writer.write(']'); - + if (hasObjectNumber()) { writer.write("\nendobj\n"); } - + writer.flush(); return cout.getCount(); } - + } diff --git a/src/java/org/apache/fop/pdf/PDFObject.java b/src/java/org/apache/fop/pdf/PDFObject.java index 8dc4d8794..97e9f4976 100644 --- a/src/java/org/apache/fop/pdf/PDFObject.java +++ b/src/java/org/apache/fop/pdf/PDFObject.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; // Java @@ -61,7 +61,7 @@ public abstract class PDFObject implements PDFWritable { /** the parent PDFObject (may be null and may not always be set, needed for encryption) */ private PDFObject parent; - + /** * Returns the object's number. * @return the PDF Object number @@ -72,14 +72,14 @@ public abstract class PDFObject implements PDFWritable { } return this.objnum; } - + /** * Default constructor. */ public PDFObject() { //nop } - + /** * Constructor for direct objects. * @param parent the containing PDFObject instance @@ -87,9 +87,9 @@ public abstract class PDFObject implements PDFWritable { public PDFObject(PDFObject parent) { setParent(parent); } - + /** - * Indicates whether this PDFObject has already been assigned an + * Indicates whether this PDFObject has already been assigned an * object number. * @return True if it has an object number */ @@ -164,7 +164,7 @@ public abstract class PDFObject implements PDFWritable { public PDFObject getParent() { return this.parent; } - + /** * Sets the direct parent object. * @param parent the direct parent @@ -201,7 +201,7 @@ public abstract class PDFObject implements PDFWritable { public PDFReference makeReference() { return new PDFReference(this); } - + /** * Write the PDF represention of this object * @@ -224,7 +224,7 @@ public abstract class PDFObject implements PDFWritable { output(out); } } - + /** * Encodes the object as a byte array for output to a PDF file. * @@ -233,12 +233,12 @@ public abstract class PDFObject implements PDFWritable { protected byte[] toPDF() { return encode(toPDFString()); } - - + + /** * This method returns a String representation of the PDF object. The result - * is normally converted/encoded to a byte array by toPDF(). Only use - * this method to implement the serialization if the object can be fully + * is normally converted/encoded to a byte array by toPDF(). Only use + * this method to implement the serialization if the object can be fully * represented as text. If the PDF representation of the object contains * binary content use toPDF() or output(OutputStream) instead. This applies * to any object potentially containing a string object because string object @@ -249,7 +249,7 @@ public abstract class PDFObject implements PDFWritable { throw new UnsupportedOperationException("Not implemented. " + "Use output(OutputStream) instead."); } - + /** * Converts text to a byte array for writing to a PDF file. * @param text text to convert/encode @@ -258,7 +258,7 @@ public abstract class PDFObject implements PDFWritable { public static final byte[] encode(String text) { return PDFDocument.encode(text); } - + /** * Encodes a Text String (3.8.1 in PDF 1.4 specs) * @param text the text to encode @@ -273,7 +273,7 @@ public abstract class PDFObject implements PDFWritable { return encode(PDFText.escapeText(text, false)); } } - + /** * Encodes a String (3.2.3 in PDF 1.4 specs) * @param string the string to encode @@ -282,7 +282,7 @@ public abstract class PDFObject implements PDFWritable { protected byte[] encodeString(String string) { return encodeText(string); } - + /** * Encodes binary data as hexadecimal string object. * @param data the binary data @@ -299,7 +299,7 @@ public abstract class PDFObject implements PDFWritable { out.write(encoded); out.write('>'); } - + /** * Formats an object for serialization to PDF. * @param obj the object @@ -329,7 +329,7 @@ public abstract class PDFObject implements PDFWritable { out.write(encodeText(obj.toString())); } } - + /** Formatting pattern for PDF date */ protected static final SimpleDateFormat DATE_FORMAT; @@ -337,9 +337,9 @@ public abstract class PDFObject implements PDFWritable { DATE_FORMAT = new SimpleDateFormat("'D:'yyyyMMddHHmmss", Locale.ENGLISH); DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT")); } - + /** - * Formats a date/time according to the PDF specification + * Formats a date/time according to the PDF specification * (D:YYYYMMDDHHmmSSOHH'mm'). * @param time date/time value to format * @param tz the time zone @@ -348,17 +348,17 @@ public abstract class PDFObject implements PDFWritable { protected String formatDateTime(Date time, TimeZone tz) { Calendar cal = Calendar.getInstance(tz, Locale.ENGLISH); cal.setTime(time); - + int offset = cal.get(Calendar.ZONE_OFFSET); offset += cal.get(Calendar.DST_OFFSET); - + //DateFormat is operating on GMT so adjust for time zone offset Date dt1 = new Date(time.getTime() + offset); StringBuffer sb = new StringBuffer(); sb.append(DATE_FORMAT.format(dt1)); - + offset /= (1000 * 60); //Convert to minutes - + if (offset == 0) { sb.append('Z'); } else { @@ -392,5 +392,5 @@ public abstract class PDFObject implements PDFWritable { protected String formatDateTime(Date time) { return formatDateTime(time, TimeZone.getDefault()); } - + } diff --git a/src/java/org/apache/fop/pdf/PDFOutline.java b/src/java/org/apache/fop/pdf/PDFOutline.java index b4b7cb6be..57e210a7a 100644 --- a/src/java/org/apache/fop/pdf/PDFOutline.java +++ b/src/java/org/apache/fop/pdf/PDFOutline.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.ByteArrayOutputStream; @@ -50,10 +50,10 @@ public class PDFOutline extends PDFObject { private PDFOutline last; private int count; - + // whether to show this outline item's child outline items private boolean openItem = false; - + /** * title to display for the bookmark entry */ @@ -158,7 +158,7 @@ public class PDFOutline extends PDFObject { bout.write(encode(" /Last " + last.referencePDF() + "\n")); } if (count > 0) { - bout.write(encode(" /Count " + (openItem ? "" : "-") + bout.write(encode(" /Count " + (openItem ? "" : "-") + count + "\n")); } if (actionRef != null) { diff --git a/src/java/org/apache/fop/pdf/PDFOutputIntent.java b/src/java/org/apache/fop/pdf/PDFOutputIntent.java index 17badfd5a..ea073829b 100644 --- a/src/java/org/apache/fop/pdf/PDFOutputIntent.java +++ b/src/java/org/apache/fop/pdf/PDFOutputIntent.java @@ -33,14 +33,14 @@ public class PDFOutputIntent extends PDFObject { public static final String GTS_PDFX = "GTS_PDFX"; /** Subtype for PDF/A-1 output intents */ public static final String GTS_PDFA1 = "GTS_PDFA1"; - + private String subtype; //S in the PDF spec private String outputCondition; private String outputConditionIdentifier; private String registryName; private String info; private PDFICCStream destOutputProfile; - + /** @return the output intent subtype. */ public String getSubtype() { @@ -119,7 +119,7 @@ public class PDFOutputIntent extends PDFObject { /** * Sets the destination ICC profile. - * @param destOutputProfile An ICC profile stream defining the transformation from the PDF + * @param destOutputProfile An ICC profile stream defining the transformation from the PDF * document's source colors to output device colorants. */ public void setDestOutputProfile(PDFICCStream destOutputProfile) { @@ -137,33 +137,33 @@ public class PDFOutputIntent extends PDFObject { bout.write(encode("/S /")); bout.write(encode(this.subtype)); bout.write(encode("\n")); - + if (outputCondition != null) { bout.write(encode("/OutputCondition ")); bout.write(encodeText(this.outputCondition)); bout.write(encode("\n")); } - + bout.write(encode("/OutputConditionIdentifier ")); bout.write(encodeText(this.outputConditionIdentifier)); bout.write(encode("\n")); - + if (registryName != null) { bout.write(encode("/RegistryName ")); bout.write(encodeText(this.registryName)); bout.write(encode("\n")); } - + if (info != null) { bout.write(encode("/Info ")); bout.write(encodeText(this.info)); bout.write(encode("\n")); } - + if (destOutputProfile != null) { bout.write(encode("/DestOutputProfile " + destOutputProfile.referencePDF() + "\n")); } - + bout.write(encode(">>\nendobj\n")); } catch (IOException ioe) { log.error("Ignored I/O exception", ioe); @@ -171,5 +171,5 @@ public class PDFOutputIntent extends PDFObject { return bout.toByteArray(); } - + } diff --git a/src/java/org/apache/fop/pdf/PDFPage.java b/src/java/org/apache/fop/pdf/PDFPage.java index ee105f39b..d1472e154 100644 --- a/src/java/org/apache/fop/pdf/PDFPage.java +++ b/src/java/org/apache/fop/pdf/PDFPage.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.awt.geom.Rectangle2D; @@ -33,7 +33,7 @@ public class PDFPage extends PDFResourceContext { /** the page index (zero-based) */ protected int pageIndex; - + /** * Create a /Page object * @@ -75,12 +75,12 @@ public class PDFPage extends PDFResourceContext { setBleedBox(box); //Recommended by PDF/X setTrimBox(box); //Needed for PDF/X } - + private PDFArray toPDFArray(Rectangle2D box) { return new PDFArray(this, new double[] { box.getX(), box.getY(), box.getMaxX(), box.getMaxY()}); } - + /** * Sets the "MediaBox" entry * @param box the media rectangle @@ -88,7 +88,7 @@ public class PDFPage extends PDFResourceContext { public void setMediaBox(Rectangle2D box) { put("MediaBox", toPDFArray(box)); } - + /** * Sets the "TrimBox" entry * @param box the trim rectangle @@ -96,7 +96,7 @@ public class PDFPage extends PDFResourceContext { public void setTrimBox(Rectangle2D box) { put("TrimBox", toPDFArray(box)); } - + /** * Sets the "BleedBox" entry * @param box the bleed rectangle @@ -104,7 +104,7 @@ public class PDFPage extends PDFResourceContext { public void setBleedBox(Rectangle2D box) { put("BleedBox", toPDFArray(box)); } - + /** * set this page contents * diff --git a/src/java/org/apache/fop/pdf/PDFPageLabels.java b/src/java/org/apache/fop/pdf/PDFPageLabels.java index 1a51c4155..2c1a977b4 100644 --- a/src/java/org/apache/fop/pdf/PDFPageLabels.java +++ b/src/java/org/apache/fop/pdf/PDFPageLabels.java @@ -5,9 +5,9 @@ * 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. @@ -16,14 +16,14 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** * Class representing a PDF /PageLabels dictionary. */ public class PDFPageLabels extends PDFNumberTreeNode { - + /** * Create the /PageLabels dictionary */ @@ -44,5 +44,5 @@ public class PDFPageLabels extends PDFNumberTreeNode { } return nums; } - + } diff --git a/src/java/org/apache/fop/pdf/PDFPages.java b/src/java/org/apache/fop/pdf/PDFPages.java index 37a2394db..bef4bdbc4 100644 --- a/src/java/org/apache/fop/pdf/PDFPages.java +++ b/src/java/org/apache/fop/pdf/PDFPages.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; // Java @@ -67,7 +67,7 @@ public class PDFPages extends PDFObject { page.setParent(this); this.incrementCount(); } - + /** * Use this method to notify the PDFPages object that a child page * @param page the child page @@ -79,7 +79,7 @@ public class PDFPages extends PDFObject { this.kids.add(null); } if (this.kids.get(idx) != null) { - throw new IllegalStateException("A page already exists at index " + throw new IllegalStateException("A page already exists at index " + idx + " (zero-based)."); } this.kids.set(idx, page.referencePDF()); diff --git a/src/java/org/apache/fop/pdf/PDFPathPaint.java b/src/java/org/apache/fop/pdf/PDFPathPaint.java index 0bcb19a7e..5133e54a4 100644 --- a/src/java/org/apache/fop/pdf/PDFPathPaint.java +++ b/src/java/org/apache/fop/pdf/PDFPathPaint.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** diff --git a/src/java/org/apache/fop/pdf/PDFPattern.java b/src/java/org/apache/fop/pdf/PDFPattern.java index 3bb190c48..4e862c3f2 100644 --- a/src/java/org/apache/fop/pdf/PDFPattern.java +++ b/src/java/org/apache/fop/pdf/PDFPattern.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; // Java @@ -118,8 +118,8 @@ public class PDFPattern extends PDFPathPaint { * @param thePatternDataStream The stream of pattern data to be tiled. */ public PDFPattern(PDFResources theResources, int thePatternType, // 1 - int thePaintType, int theTilingType, List theBBox, - double theXStep, double theYStep, + int thePaintType, int theTilingType, List theBBox, + double theXStep, double theYStep, List theMatrix, List theXUID, StringBuffer thePatternDataStream) { super(); @@ -272,9 +272,9 @@ public class PDFPattern extends PDFPathPaint { pdfStream.setDocument(getDocumentSafely()); pdfStream.add(this.patternDataStream.toString()); pdfStream.getFilterList().addDefaultFilters( - getDocument().getFilterMap(), + getDocument().getFilterMap(), PDFFilterList.CONTENT_FILTER); - encodedStream = pdfStream.encodeStream(); + encodedStream = pdfStream.encodeStream(); p.append(pdfStream.getFilterList().buildFilterDictEntries()); p.append("/Length " + (encodedStream.getSize() + 1) + " \n"); diff --git a/src/java/org/apache/fop/pdf/PDFProfile.java b/src/java/org/apache/fop/pdf/PDFProfile.java index 3264e1f44..20af4e212 100644 --- a/src/java/org/apache/fop/pdf/PDFProfile.java +++ b/src/java/org/apache/fop/pdf/PDFProfile.java @@ -26,25 +26,25 @@ import java.text.MessageFormat; * the libarary and its users to enable the generation of PDFs conforming to the enabled PDF * profiles. * <p> - * Some profile from PDF/X and PDF/A can be active simultaneously (example: PDF/A-1 and + * Some profile from PDF/X and PDF/A can be active simultaneously (example: PDF/A-1 and * PDF/X-3:2003). */ public class PDFProfile { /** - * Indicates the PDF/A mode currently active. Defaults to "no restrictions", i.e. + * Indicates the PDF/A mode currently active. Defaults to "no restrictions", i.e. * PDF/A not active. */ protected PDFAMode pdfAMode = PDFAMode.DISABLED; - + /** - * Indicates the PDF/X mode currently active. Defaults to "no restrictions", i.e. + * Indicates the PDF/X mode currently active. Defaults to "no restrictions", i.e. * PDF/X not active. */ protected PDFXMode pdfXMode = PDFXMode.DISABLED; - + private PDFDocument doc; - + /** * Main constructor * @param doc the PDF document @@ -52,7 +52,7 @@ public class PDFProfile { public PDFProfile(PDFDocument doc) { this.doc = doc; } - + /** * Validates if the requested profile combination is compatible. */ @@ -69,22 +69,22 @@ public class PDFProfile { } } } - + /** @return the PDFDocument this profile is attached to */ public PDFDocument getDocument() { return this.doc; } - + /** @return the PDF/A mode */ public PDFAMode getPDFAMode() { return this.pdfAMode; } - + /** @return true if any PDF/A mode is active */ public boolean isPDFAActive() { return getPDFAMode() != PDFAMode.DISABLED; } - + /** * Sets the PDF/A mode * @param mode the PDF/A mode @@ -96,17 +96,17 @@ public class PDFProfile { this.pdfAMode = mode; validateProfileCombination(); } - + /** @return the PDF/X mode */ public PDFXMode getPDFXMode() { return this.pdfXMode; } - + /** @return true if any PDF/X mode is active */ public boolean isPDFXActive() { return getPDFXMode() != PDFXMode.DISABLED; } - + /** * Sets the PDF/X mode * @param mode the PDF/X mode @@ -133,13 +133,13 @@ public class PDFProfile { } return sb.toString(); } - + //---------=== Info and validation methods ===--------- - + private String format(String pattern, Object arg) { return MessageFormat.format(pattern, new Object[] {arg}); } - + /** Checks if encryption is allowed. */ public void verifyEncryptionAllowed() { final String err = "{0} doesn't allow encrypted PDFs"; @@ -170,11 +170,11 @@ public class PDFProfile { public void verifyTransparencyAllowed(String context) { final String err = "{0} does not allow the use of transparency. ({1})"; if (isPDFAActive()) { - throw new PDFConformanceException(MessageFormat.format(err, + throw new PDFConformanceException(MessageFormat.format(err, new Object[] {getPDFAMode(), context})); } if (isPDFXActive()) { - throw new PDFConformanceException(MessageFormat.format(err, + throw new PDFConformanceException(MessageFormat.format(err, new Object[] {getPDFXMode(), context})); } } @@ -182,16 +182,16 @@ public class PDFProfile { /** Checks if the right PDF version is set. */ public void verifyPDFVersion() { final String err = "PDF version must be 1.4 for {0}"; - if (getPDFAMode().isPDFA1LevelB() + if (getPDFAMode().isPDFA1LevelB() && getDocument().getPDFVersion() != PDFDocument.PDF_VERSION_1_4) { throw new PDFConformanceException(format(err, getPDFAMode())); } - if (getPDFXMode() == PDFXMode.PDFX_3_2003 + if (getPDFXMode() == PDFXMode.PDFX_3_2003 && getDocument().getPDFVersion() != PDFDocument.PDF_VERSION_1_4) { throw new PDFConformanceException(format(err, getPDFXMode())); } } - + /** @return true if the ID entry must be present in the trailer. */ public boolean isIDEntryRequired() { return isPDFAActive() || isPDFXActive(); @@ -224,7 +224,7 @@ public class PDFProfile { public boolean isAnnotationAllowed() { return !isPDFXActive(); } - + /** Checks if annotations are allowed. */ public void verifyAnnotAllowed() { if (!isAnnotationAllowed()) { diff --git a/src/java/org/apache/fop/pdf/PDFRectangle.java b/src/java/org/apache/fop/pdf/PDFRectangle.java index ca97c2474..ce5b46440 100644 --- a/src/java/org/apache/fop/pdf/PDFRectangle.java +++ b/src/java/org/apache/fop/pdf/PDFRectangle.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; diff --git a/src/java/org/apache/fop/pdf/PDFReference.java b/src/java/org/apache/fop/pdf/PDFReference.java index da388d368..5c3bdf3dc 100644 --- a/src/java/org/apache/fop/pdf/PDFReference.java +++ b/src/java/org/apache/fop/pdf/PDFReference.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -32,11 +32,11 @@ import java.lang.ref.SoftReference; * PDF file. */ public class PDFReference implements PDFWritable { - + private String indirectReference; - + private Reference objReference; - + /** * Creates a new PDF reference. * @param obj the object to be referenced @@ -45,7 +45,7 @@ public class PDFReference implements PDFWritable { this.indirectReference = obj.referencePDF(); this.objReference = new SoftReference(obj); } - + /** * Creates a new PDF reference, but without a reference to the original object. * @param ref an object reference @@ -72,15 +72,15 @@ public class PDFReference implements PDFWritable { return null; } } - + /** {@inheritDoc} */ public String toString() { return this.indirectReference; } - + /** {@inheritDoc} */ public void outputInline(OutputStream out, Writer writer) throws IOException { writer.write(toString()); } - + } diff --git a/src/java/org/apache/fop/pdf/PDFResourceContext.java b/src/java/org/apache/fop/pdf/PDFResourceContext.java index 6be18ce9d..16c1976db 100644 --- a/src/java/org/apache/fop/pdf/PDFResourceContext.java +++ b/src/java/org/apache/fop/pdf/PDFResourceContext.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** diff --git a/src/java/org/apache/fop/pdf/PDFResources.java b/src/java/org/apache/fop/pdf/PDFResources.java index da213bb87..cbfc9d53a 100644 --- a/src/java/org/apache/fop/pdf/PDFResources.java +++ b/src/java/org/apache/fop/pdf/PDFResources.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.util.HashMap; @@ -67,10 +67,10 @@ public class PDFResources extends PDFObject { /** Map of color spaces (key: color space name) */ protected Map colorSpaces = new HashMap(); - + /** Map of ICC color spaces (key: ICC profile description) */ protected Map iccColorSpaces = new HashMap(); - + /** * create a /Resources object. * @@ -93,7 +93,7 @@ public class PDFResources extends PDFObject { /** * Add the fonts in the font info to this PDF document's Font Resources. - * + * * @param doc PDF document to add fonts to * @param fontInfo font info object to get font information from */ @@ -103,7 +103,7 @@ public class PDFResources extends PDFObject { while (e.hasNext()) { String f = (String)e.next(); Typeface font = (Typeface)usedFonts.get(f); - + //Check if the font actually had any mapping operations. If not, it is an indication //that it has never actually been used and therefore doesn't have to be embedded. if (font.hadMappingOperations()) { @@ -159,7 +159,7 @@ public class PDFResources extends PDFObject { /** * Add a ColorSpace dictionary to the resources. - * @param colorSpace the color space + * @param colorSpace the color space */ public void addColorSpace(PDFICCBasedColorSpace colorSpace) { this.colorSpaces.put(colorSpace.getName(), colorSpace); diff --git a/src/java/org/apache/fop/pdf/PDFRoot.java b/src/java/org/apache/fop/pdf/PDFRoot.java index 0dd9b890c..1ea316390 100644 --- a/src/java/org/apache/fop/pdf/PDFRoot.java +++ b/src/java/org/apache/fop/pdf/PDFRoot.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** @@ -50,7 +50,7 @@ public class PDFRoot extends PDFDictionary { new PDFName("UseThumbs"), new PDFName("FullScreen"), }; - + /** * create a Root (/Catalog) object. NOTE: The PDFRoot * object must be created before the PDF document is @@ -94,7 +94,7 @@ public class PDFRoot extends PDFDictionary { return PAGEMODE_USENONE; } } - + /** * add a /Page object to the root /Pages object * @@ -123,7 +123,7 @@ public class PDFRoot extends PDFDictionary { PDFReference ref = (PDFReference)get("Pages"); return (ref != null ? (PDFPages)ref.getObject() : null); } - + /** * Sets the /PageLabels object. * @param pageLabels the /PageLabels object @@ -131,7 +131,7 @@ public class PDFRoot extends PDFDictionary { public void setPageLabels(PDFPageLabels pageLabels) { put("PageLabels", pageLabels.makeReference()); } - + /** * Returns the /PageLabels object. * @return the /PageLabels object if set, null otherwise. @@ -141,7 +141,7 @@ public class PDFRoot extends PDFDictionary { PDFReference ref = (PDFReference)get("PageLabels"); return (ref != null ? (PDFPageLabels)ref.getObject() : null); } - + /** * Set the root outline for the PDF document. * @@ -149,7 +149,7 @@ public class PDFRoot extends PDFDictionary { */ public void setRootOutline(PDFOutline out) { put("Outlines", out.makeReference()); - + //Set /PageMode to /UseOutlines by default if no other mode has been set PDFName mode = (PDFName)get("PageMode"); if (mode == null) { @@ -166,7 +166,7 @@ public class PDFRoot extends PDFDictionary { PDFReference ref = (PDFReference)get("Outlines"); return (ref != null ? (PDFOutline)ref.getObject() : null); } - + /** * Set the /Names object. * @param names the Names object @@ -175,7 +175,7 @@ public class PDFRoot extends PDFDictionary { public void setNames(PDFNames names) { put("Names", names.makeReference()); } - + /** * Returns the /Names object. * @return the Names object if set, null otherwise. @@ -185,7 +185,7 @@ public class PDFRoot extends PDFDictionary { PDFReference ref = (PDFReference)get("Names"); return (ref != null ? (PDFNames)ref.getObject() : null); } - + /** * Set the optional Metadata object. * @param meta the Metadata object @@ -196,7 +196,7 @@ public class PDFRoot extends PDFDictionary { put("Metadata", meta.makeReference()); } } - + /** * Returns the /Metadata object * @return the /Metadata object if set, null otherwise. @@ -215,7 +215,7 @@ public class PDFRoot extends PDFDictionary { public PDFArray getOutputIntents() { return (PDFArray)get("OutputIntents"); } - + /** * Adds an OutputIntent to the PDF * @param outputIntent the OutputIntent dictionary @@ -223,7 +223,7 @@ public class PDFRoot extends PDFDictionary { */ public void addOutputIntent(PDFOutputIntent outputIntent) { if (getDocumentSafely().getPDFVersion() >= PDFDocument.PDF_VERSION_1_4) { - PDFArray outputIntents = getOutputIntents(); + PDFArray outputIntents = getOutputIntents(); if (outputIntents == null) { outputIntents = new PDFArray(this); put("OutputIntents", outputIntents); @@ -231,7 +231,7 @@ public class PDFRoot extends PDFDictionary { outputIntents.add(outputIntent); } } - + /** * Returns the language identifier of the document. * @return the language identifier of the document (or null if not set or undefined) @@ -240,7 +240,7 @@ public class PDFRoot extends PDFDictionary { public String getLanguage() { return (String)get("Lang"); } - + /** * Sets the language identifier of the document. * @param lang the language identifier of the document. @@ -251,5 +251,5 @@ public class PDFRoot extends PDFDictionary { } put("Lang", lang); } - + } diff --git a/src/java/org/apache/fop/pdf/PDFShading.java b/src/java/org/apache/fop/pdf/PDFShading.java index a782eaf36..5ac7245c9 100644 --- a/src/java/org/apache/fop/pdf/PDFShading.java +++ b/src/java/org/apache/fop/pdf/PDFShading.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; // Java... @@ -338,7 +338,7 @@ public class PDFShading extends PDFObject { int vectorSize; int tempInt; StringBuffer p = new StringBuffer(128); - p.append(getObjectID() + p.append(getObjectID() + "<< \n/ShadingType " + this.shadingType + " \n"); if (this.colorSpace != null) { p.append("/ColorSpace /" diff --git a/src/java/org/apache/fop/pdf/PDFState.java b/src/java/org/apache/fop/pdf/PDFState.java index e453d7b51..2e9bd6074 100644 --- a/src/java/org/apache/fop/pdf/PDFState.java +++ b/src/java/org/apache/fop/pdf/PDFState.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.Serializable; @@ -50,7 +50,7 @@ import java.awt.geom.GeneralPath; public class PDFState { private Data data = new Data(); - + private List stateStack = new java.util.ArrayList(); /** @@ -82,7 +82,7 @@ public class PDFState { public Data getData() { return data; } - + /** * Pop the state from the stack and set current values to popped state. * This should be called when a Q operator is used so @@ -154,7 +154,7 @@ public class PDFState { return false; } } - + /** * Set the current color. * Check if the new color is a change and then set the current color. @@ -272,7 +272,7 @@ public class PDFState { public void setTransform(AffineTransform tf) { concatenate(tf); } - + /** * Concatenates the given AffineTransform to the current one. * @param tf the transform to concatenate to the current level transform @@ -343,9 +343,9 @@ public class PDFState { return newstate; } - + public class Data implements Cloneable, Serializable { - + public Color color = Color.black; public Color backcolor = Color.black; public Paint paint = null; @@ -363,7 +363,7 @@ public class PDFState { public Shape clip = null; public PDFGState gstate = null; - + /** {@inheritDoc} */ public Object clone() throws CloneNotSupportedException { Data obj = new Data(); @@ -385,7 +385,7 @@ public class PDFState { obj.gstate = this.gstate; return obj; } - + /** * Get the current Transform. */ @@ -407,7 +407,7 @@ public class PDFState { public void concatenate(AffineTransform at) { transform.concatenate(at); } - + /** {@inheritDoc} */ public String toString() { return super.toString() + ", " + this.transform; diff --git a/src/java/org/apache/fop/pdf/PDFStream.java b/src/java/org/apache/fop/pdf/PDFStream.java index a213340e3..5f74a2613 100644 --- a/src/java/org/apache/fop/pdf/PDFStream.java +++ b/src/java/org/apache/fop/pdf/PDFStream.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -32,14 +32,14 @@ import java.io.Writer; * length. */ public class PDFStream extends AbstractPDFStream { - + /** * The stream of PDF commands */ protected StreamCache data; private transient Writer streamWriter; - + /** * Create an empty stream object */ @@ -70,11 +70,11 @@ public class PDFStream extends AbstractPDFStream { ex.printStackTrace(); } } - + private void flush() throws IOException { this.streamWriter.flush(); } - + /** * Returns a Writer that writes to the OutputStream of the buffer. * @return the Writer @@ -95,7 +95,7 @@ public class PDFStream extends AbstractPDFStream { } return this.data.getOutputStream(); } - + /** * Used to set the contents of the PDF stream. * @param data the contents as a byte array @@ -138,7 +138,7 @@ public class PDFStream extends AbstractPDFStream { */ protected int output(OutputStream stream) throws IOException { final int len = super.output(stream); - + //Now that the data has been written, it can be discarded. this.data = null; return len; diff --git a/src/java/org/apache/fop/pdf/PDFT1Stream.java b/src/java/org/apache/fop/pdf/PDFT1Stream.java index d122743b0..8181287b5 100644 --- a/src/java/org/apache/fop/pdf/PDFT1Stream.java +++ b/src/java/org/apache/fop/pdf/PDFT1Stream.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; // Java @@ -29,7 +29,7 @@ import org.apache.fop.fonts.type1.PFBData; * Special PDFStream for embedding Type 1 fonts. */ public class PDFT1Stream extends AbstractPDFStream { - + private PFBData pfb; /** @@ -76,9 +76,9 @@ public class PDFT1Stream extends AbstractPDFStream { protected void outputRawStreamData(OutputStream out) throws IOException { this.pfb.outputAllParts(out); } - + /** - * Used to set the PFBData object that represents the embeddable Type 1 + * Used to set the PFBData object that represents the embeddable Type 1 * font. * @param pfb The PFB file * @throws IOException in case of an I/O problem diff --git a/src/java/org/apache/fop/pdf/PDFTTFStream.java b/src/java/org/apache/fop/pdf/PDFTTFStream.java index 5570c62f3..6c68ea8bf 100644 --- a/src/java/org/apache/fop/pdf/PDFTTFStream.java +++ b/src/java/org/apache/fop/pdf/PDFTTFStream.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -25,7 +25,7 @@ import java.io.IOException; * Special PDFStream for embeddable TrueType fonts. */ public class PDFTTFStream extends PDFStream { - + private int origLength; /** @@ -58,7 +58,7 @@ public class PDFTTFStream extends PDFStream { put("Length1", origLength); super.populateStreamDict(lengthEntry); } - + /** * Sets the TrueType font data. * @param data the font payload diff --git a/src/java/org/apache/fop/pdf/PDFText.java b/src/java/org/apache/fop/pdf/PDFText.java index d380ac8dd..02f845266 100644 --- a/src/java/org/apache/fop/pdf/PDFText.java +++ b/src/java/org/apache/fop/pdf/PDFText.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.ByteArrayOutputStream; @@ -24,15 +24,15 @@ import java.io.ByteArrayOutputStream; import org.apache.avalon.framework.CascadingRuntimeException; /** - * This class represents a simple number object. It also contains contains some + * This class represents a simple number object. It also contains contains some * utility methods for outputting numbers to PDF. */ public class PDFText extends PDFObject { - private static final char[] DIGITS + private static final char[] DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; - + private String text; /** @@ -42,7 +42,7 @@ public class PDFText extends PDFObject { public String getText() { return this.text; } - + /** * Sets the text. * @param text the text @@ -97,7 +97,7 @@ public class PDFText extends PDFObject { } } } - + if (hexMode) { final byte[] uniBytes; try { @@ -114,7 +114,7 @@ public class PDFText extends PDFObject { if (unicode) { // byte order marker (0xfeff) result.append("\\376\\377"); - + for (int i = 0; i < l; i++) { final char ch = text.charAt(i); final int high = (ch & 0xff00) >>> 8; @@ -162,7 +162,7 @@ public class PDFText extends PDFObject { } return sb.toString(); } - + /** * Converts a byte array to a Hexadecimal String (3.2.3 in PDF 1.4 specs) * @param data the data to encode @@ -171,7 +171,7 @@ public class PDFText extends PDFObject { public static final String toHex(byte[] data) { return toHex(data, true); } - + /** * Converts a String to UTF-16 (big endian). * @param text text to convert @@ -206,7 +206,7 @@ public class PDFText extends PDFObject { } return buf.toString(); } - + /** * Escaped a String as described in section 4.4 in the PDF 1.3 specs. * @param s String to escape diff --git a/src/java/org/apache/fop/pdf/PDFTextUtil.java b/src/java/org/apache/fop/pdf/PDFTextUtil.java index 224bb6a1d..735a7894d 100644 --- a/src/java/org/apache/fop/pdf/PDFTextUtil.java +++ b/src/java/org/apache/fop/pdf/PDFTextUtil.java @@ -5,9 +5,9 @@ * 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. @@ -27,9 +27,9 @@ import java.awt.geom.AffineTransform; */ public abstract class PDFTextUtil { - /** The number of decimal places. */ + /** The number of decimal places. */ private static final int DEC = 8; - + /** PDF text rendering mode: Fill text */ public static final int TR_FILL = 0; /** PDF text rendering mode: Stroke text */ @@ -46,30 +46,30 @@ public abstract class PDFTextUtil { public static final int TR_FILL_STROKE_CLIP = 6; /** PDF text rendering mode: Add text to path for clipping */ public static final int TR_CLIP = 7; - + private boolean inTextObject = false; private String startText; private String endText; private boolean useMultiByte; private StringBuffer bufTJ; private int textRenderingMode = TR_FILL; - + private String currentFontName; private double currentFontSize; - + /** * Main constructor. */ public PDFTextUtil() { //nop } - + /** * Writes PDF code. * @param code the PDF code to write */ protected abstract void write(String code); - + private void writeAffineTransform(AffineTransform at, StringBuffer sb) { double[] lt = new double[6]; at.getMatrix(lt); @@ -100,13 +100,13 @@ public abstract class PDFTextUtil { sb.append(PDFText.toUnicodeHex(ch)); } } - + private void checkInTextObject() { if (!inTextObject) { throw new IllegalStateException("Not in text object"); } } - + /** * Indicates whether we are in a text object or not. * @return true if we are in a text object @@ -114,7 +114,7 @@ public abstract class PDFTextUtil { public boolean isInTextObject() { return inTextObject; } - + /** * Called when a new text object should be started. Be sure to call setFont() before * issuing any text painting commands. @@ -126,7 +126,7 @@ public abstract class PDFTextUtil { write("BT\n"); this.inTextObject = true; } - + /** * Called when a text object should be ended. */ @@ -136,7 +136,7 @@ public abstract class PDFTextUtil { this.inTextObject = false; initValues(); } - + /** * Resets the state fields. */ @@ -145,14 +145,14 @@ public abstract class PDFTextUtil { this.currentFontSize = 0.0; this.textRenderingMode = TR_FILL; } - + /** * Creates a "q" command, pushing a copy of the entire graphics state onto the stack. */ public void saveGraphicsState() { write("q\n"); } - + /** * Creates a "Q" command, restoring the entire graphics state to its former value by popping * it from the stack. @@ -160,7 +160,7 @@ public abstract class PDFTextUtil { public void restoreGraphicsState() { write("Q\n"); } - + /** * Creates a "cm" command. * @param at the transformation matrix @@ -174,7 +174,7 @@ public abstract class PDFTextUtil { write(sb.toString()); } } - + /** * Writes a "Tf" command, setting a new current font. * @param fontName the name of the font to select @@ -183,7 +183,7 @@ public abstract class PDFTextUtil { public void writeTf(String fontName, double fontSize) { checkInTextObject(); write("/" + fontName + " " + PDFNumber.doubleOut(fontSize) + " Tf\n"); - + this.startText = useMultiByte ? "<" : "("; this.endText = useMultiByte ? ">" : ")"; } @@ -220,7 +220,7 @@ public abstract class PDFTextUtil { write(this.textRenderingMode + " Tr\n"); } } - + /** * Sets the text rendering mode. * @param fill true if the text should be filled @@ -239,7 +239,7 @@ public abstract class PDFTextUtil { } setTextRenderingMode(mode); } - + /** * Writes a "Tm" command, setting a new text transformation matrix. * @param localTransform the new text transformation matrix diff --git a/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java b/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java index 3d25e28cb..b70430af4 100644 --- a/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java +++ b/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -61,9 +61,9 @@ public class PDFToUnicodeCMap extends PDFCMap { protected CMapBuilder createCMapBuilder(Writer writer) { return new ToUnicodeCMapBuilder(writer); } - + class ToUnicodeCMapBuilder extends CMapBuilder { - + public ToUnicodeCMapBuilder(Writer writer) { super(writer, null); } @@ -82,7 +82,7 @@ public class PDFToUnicodeCMap extends PDFCMap { writeBFEntries(); writeWrapUp(); } - + /** * Writes the character mappings for this font. * @param p StingBuffer to write to @@ -99,7 +99,7 @@ public class PDFToUnicodeCMap extends PDFCMap { * expressed as part of a character range). * @param p StringBuffer to write to * @param charArray all the characters to map - * @throws IOException + * @throws IOException */ protected void writeBFCharEntries(char[] charArray) throws IOException { int totalEntries = 0; @@ -136,7 +136,7 @@ public class PDFToUnicodeCMap extends PDFCMap { * Writes the entries for character ranges for a base font. * @param p StringBuffer to write to * @param charArray all the characters to map - * @throws IOException + * @throws IOException */ protected void writeBFRangeEntries(char[] charArray) throws IOException { int totalEntries = 0; @@ -283,6 +283,6 @@ public class PDFToUnicodeCMap extends PDFCMap { return returnString.toString(); } - } - + } + } diff --git a/src/java/org/apache/fop/pdf/PDFUri.java b/src/java/org/apache/fop/pdf/PDFUri.java index 19617e368..296e38945 100644 --- a/src/java/org/apache/fop/pdf/PDFUri.java +++ b/src/java/org/apache/fop/pdf/PDFUri.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** diff --git a/src/java/org/apache/fop/pdf/PDFWArray.java b/src/java/org/apache/fop/pdf/PDFWArray.java index 04351c77d..ad6d2ac29 100644 --- a/src/java/org/apache/fop/pdf/PDFWArray.java +++ b/src/java/org/apache/fop/pdf/PDFWArray.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.util.List; @@ -31,12 +31,12 @@ public class PDFWArray { */ private List entries = new java.util.ArrayList(); - /** - * Default constructor + /** + * Default constructor */ public PDFWArray() { } - + /** * Convenience constructor * @param metrics the metrics array to initially add diff --git a/src/java/org/apache/fop/pdf/PDFWritable.java b/src/java/org/apache/fop/pdf/PDFWritable.java index 4f024fb92..6e71dc7d8 100644 --- a/src/java/org/apache/fop/pdf/PDFWritable.java +++ b/src/java/org/apache/fop/pdf/PDFWritable.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -28,7 +28,7 @@ import java.io.Writer; * serializing the object or by writing a indirect reference to the actual object. */ public interface PDFWritable { - + /** * Writes a "direct object" (inline object) representation to the stream. A Writer is given * for optimized encoding of text content. Since the Writer is buffered, make sure @@ -38,5 +38,5 @@ public interface PDFWritable { * @throws IOException if an I/O error occurs */ void outputInline(OutputStream out, Writer writer) throws IOException; - + } diff --git a/src/java/org/apache/fop/pdf/PDFXMode.java b/src/java/org/apache/fop/pdf/PDFXMode.java index 05df3e32a..03813273b 100644 --- a/src/java/org/apache/fop/pdf/PDFXMode.java +++ b/src/java/org/apache/fop/pdf/PDFXMode.java @@ -26,7 +26,7 @@ public final class PDFXMode { public static final PDFXMode DISABLED = new PDFXMode("PDF/X disabled"); /** PDF/X-3:2003 enabled */ public static final PDFXMode PDFX_3_2003 = new PDFXMode("PDF/X-3:2003"); - + private String name; /** @@ -41,7 +41,7 @@ public final class PDFXMode { public String getName() { return this.name; } - + /** * Returns the mode enum object given a String. * @param s the string @@ -54,10 +54,10 @@ public final class PDFXMode { return DISABLED; } } - + /** {@inheritDoc} */ public String toString() { return name; } - + } diff --git a/src/java/org/apache/fop/pdf/PDFXObject.java b/src/java/org/apache/fop/pdf/PDFXObject.java index d0115fe66..d1ce6d75e 100644 --- a/src/java/org/apache/fop/pdf/PDFXObject.java +++ b/src/java/org/apache/fop/pdf/PDFXObject.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; // Java @@ -33,7 +33,7 @@ import java.io.IOException; * document in another place. */ public abstract class PDFXObject extends AbstractPDFStream { - + /** * Create an XObject with the given number. */ @@ -48,13 +48,13 @@ public abstract class PDFXObject extends AbstractPDFStream { public PDFName getName() { return (PDFName)get("Name"); } - + /** {@inheritDoc} */ protected void populateStreamDict(Object lengthEntry) { put("Type", new PDFName("XObject")); super.populateStreamDict(lengthEntry); } - + /** {@inheritDoc} */ protected int getSizeHint() throws IOException { return 0; diff --git a/src/java/org/apache/fop/pdf/StreamCache.java b/src/java/org/apache/fop/pdf/StreamCache.java index 8ac6e13e1..95d21ab80 100644 --- a/src/java/org/apache/fop/pdf/StreamCache.java +++ b/src/java/org/apache/fop/pdf/StreamCache.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.OutputStream; diff --git a/src/java/org/apache/fop/pdf/StreamCacheFactory.java b/src/java/org/apache/fop/pdf/StreamCacheFactory.java index 00cfe933e..4e2d12eb2 100644 --- a/src/java/org/apache/fop/pdf/StreamCacheFactory.java +++ b/src/java/org/apache/fop/pdf/StreamCacheFactory.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; import java.io.IOException; @@ -31,7 +31,7 @@ public class StreamCacheFactory { private static StreamCacheFactory memoryInstance = null; private boolean cacheToFile = false; - + /** * Returns an instance of a StreamCacheFactory with the requested features. * @param cacheToFile True if file shall be cached using a temporary file @@ -50,7 +50,7 @@ public class StreamCacheFactory { return memoryInstance; } } - + /** * Returns an instance of a StreamCacheFactory depending on the default * setting for cacheToFile. @@ -59,7 +59,7 @@ public class StreamCacheFactory { public static StreamCacheFactory getInstance() { return getInstance(defaultCacheToFile); } - + /** * Sets the global default for cacheToFile * @param cacheToFile True if stream caches should be held in files. @@ -75,7 +75,7 @@ public class StreamCacheFactory { public StreamCacheFactory(boolean cacheToFile) { this.cacheToFile = cacheToFile; } - + /** * Get the correct implementation (based on cacheToFile) of * StreamCache. @@ -89,7 +89,7 @@ public class StreamCacheFactory { return new InMemoryStreamCache(); } } - + /** * Get the correct implementation (based on cacheToFile) of * StreamCache. @@ -104,7 +104,7 @@ public class StreamCacheFactory { return new InMemoryStreamCache(hintSize); } } - + /** * Get the value of the global cacheToFile flag. * @return the current cache to file flag @@ -112,6 +112,6 @@ public class StreamCacheFactory { public boolean getCacheToFile() { return this.cacheToFile; } - + } diff --git a/src/java/org/apache/fop/pdf/TempFileStreamCache.java b/src/java/org/apache/fop/pdf/TempFileStreamCache.java index e29595989..9920a334d 100644 --- a/src/java/org/apache/fop/pdf/TempFileStreamCache.java +++ b/src/java/org/apache/fop/pdf/TempFileStreamCache.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; // Java @@ -75,7 +75,7 @@ public class TempFileStreamCache implements StreamCache { public void write(byte[] data) throws IOException { getOutputStream().write(data); } - + /** * Outputs the cached bytes to the given stream. * diff --git a/src/java/org/apache/fop/pdf/TransitionDictionary.java b/src/java/org/apache/fop/pdf/TransitionDictionary.java index 5c779d8fe..6711c9508 100644 --- a/src/java/org/apache/fop/pdf/TransitionDictionary.java +++ b/src/java/org/apache/fop/pdf/TransitionDictionary.java @@ -5,9 +5,9 @@ * 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. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.pdf; /** |