You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2008/07/25 12:56:32 UTC
svn commit: r679758 [21/34] - in
/xmlgraphics/fop/branches/Temp_AFPGOCAResources: ./
examples/embedding/java/embedding/ examples/embedding/java/embedding/events/
examples/embedding/java/embedding/intermediate/
examples/embedding/java/embedding/model/ e...
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFDocument.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFDocument.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFDocument.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFDocument.java Fri Jul 25 03:55:49 2008
@@ -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 @@
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 @@
/** 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 int getPDFVersion() {
return this.pdfVersion;
}
-
+
/** @return the String representing the active PDF version */
public String getPDFVersionString() {
switch (getPDFVersion()) {
@@ -285,7 +285,7 @@
public PDFProfile getProfile() {
return this.pdfProfile;
}
-
+
/**
* Returns the factory for PDF objects.
* @return PDFFactory the factory
@@ -332,7 +332,7 @@
throw new Error("JVM doesn't support " + ENCODING + " encoding!");
}
}
-
+
/**
* set the producer of the document
*
@@ -344,7 +344,7 @@
/**
* 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 @@
}
this.destinations.add(destination);
}
-
+
/**
* Gets the list of named destinations.
*
@@ -849,7 +849,7 @@
PDFStream cont,
PDFReference formres,
String key) {
-
+
// check if already created
PDFFormXObject xObject = (PDFFormXObject)xObjectsMap.get(key);
if (xObject != null) {
@@ -858,7 +858,7 @@
}
return xObject;
}
-
+
xObject = new PDFFormXObject(
++this.xObjectCount,
cont,
@@ -954,7 +954,7 @@
this.position = 0;
getProfile().verifyPDFVersion();
-
+
byte[] pdf = encode("%PDF-" + getPDFVersionString() + "\n");
stream.write(pdf);
this.position += pdf.length;
@@ -991,7 +991,7 @@
}
}
}
-
+
/**
* write the trailer
*
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncoding.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncoding.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncoding.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncoding.java Fri Jul 25 03:55:49 2008
@@ -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 @@
/** 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 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 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 @@
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 @@
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 boolean hasDifferences() {
return (this.differences.length() > 0);
}
-
+
/**
* Creates and returns the PDFArray representing the Differences entry.
* @return the Differences entry
@@ -147,7 +147,7 @@
return this.differences;
}
}
-
+
/*
* example (p. 214)
* 25 0 obj
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryption.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryption.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryption.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryption.java Fri Jul 25 03:55:49 2008
@@ -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 @@
/**
* 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 @@
* @return byte[] the encrypted data
*/
byte[] encrypt(byte[] data, PDFObject refObj);
-
+
/**
* Returns the trailer entry for encryption.
* @return the trailer entry
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java Fri Jul 25 03:55:49 2008
@@ -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 @@
*
*/
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 @@
+ 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 @@
return "";
}
- /**
+ /**
* Return a parameter dictionary for this filter, or null
* @return The parameter dictionary. In this case, null.
*/
@@ -79,7 +79,7 @@
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 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 @@
}
// 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 @@
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 @@
throw new IllegalStateException(e.getMessage());
}
}
-
+
private Cipher initCipher(byte[] key) {
try {
Cipher c = Cipher.getInstance("RC4");
@@ -257,7 +257,7 @@
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 @@
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 @@
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 @@
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 @@
+ "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 @@
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 @@
/**
* 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 @@
if (this.dictionary == null) {
throw new IllegalStateException("PDF Encryption has not been initialized");
}
-
+
return encode(this.dictionary);
}
@@ -426,7 +426,7 @@
* {@inheritDoc}
*/
public String getTrailerEntry() {
- return "/Encrypt " + getObjectNumber() + " "
+ return "/Encrypt " + getObjectNumber() + " "
+ getGeneration() + " R\n"
+ "/ID[" + getFileID(1) + getFileID(2) + "]\n";
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryptionManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryptionManager.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryptionManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryptionManager.java Fri Jul 25 03:55:49 2008
@@ -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 @@
return false;
}
}
-
+
/**
* Checks whether the necessary algorithms are available.
* @return boolean True if all necessary algorithms are present
@@ -71,7 +71,7 @@
return true;
}
}
-
+
/**
* Sets up PDF encryption if PDF encryption is requested by registering
@@ -80,7 +80,7 @@
* @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 @@
pdf.setEncryption(params);
}
}
-
+
/**
* Creates a new PDFEncryption instance if PDF encryption is available.
* @param objnum PDF object number
@@ -112,9 +112,9 @@
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 @@
return null;
}
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryptionParams.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryptionParams.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryptionParams.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFEncryptionParams.java Fri Jul 25 03:55:49 2008
@@ -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 @@
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 @@
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
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFactory.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFactory.java Fri Jul 25 03:55:49 2008
@@ -913,8 +913,8 @@
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 @@
nonBase14.setWidthMetrics(firstChar,
lastChar,
new PDFArray(null, metrics.getWidths()));
-
+
//Handle encoding
SingleByteEncoding mapping = singleByteFont.getEncoding();
if (singleByteFont.isSymbolicFont()) {
@@ -1265,10 +1265,10 @@
} 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 @@
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 @@
/**
* 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() {
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFileSpec.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFileSpec.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFileSpec.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFileSpec.java Fri Jul 25 03:55:49 2008
@@ -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 @@
* {@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";
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFilter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFilter.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFilter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFilter.java Fri Jul 25 03:55:49 2008
@@ -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;
/**
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFilterException.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFilterException.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFilterException.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFilterException.java Fri Jul 25 03:55:49 2008
@@ -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;
/**
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFilterList.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFilterList.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFilterList.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFilterList.java Fri Jul 25 03:55:49 2008
@@ -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.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 @@
private List filters = new java.util.ArrayList();
private boolean ignoreASCIIFilters = false;
-
+
private boolean disableAllFilters = false;
-
+
/**
* Default constructor.
* <p>
@@ -61,7 +61,7 @@
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 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 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 @@
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 @@
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 @@
putDecodeParams(dict, parms);
}
}
-
+
private int populateNamesAndParms(List names, List parms) {
// run the filters
int nonNullParams = 0;
@@ -247,7 +247,7 @@
// 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 @@
}
}
}
-
+
private String buildDecodeParms(List parms) {
StringBuffer sb = new StringBuffer();
boolean needParmsEntry = false;
@@ -346,9 +346,9 @@
}
}
}
-
+
/**
- * 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
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFont.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFont.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFont.java Fri Jul 25 03:55:49 2008
@@ -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 @@
/** 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 @@
put("Encoding", new PDFName(encoding));
}
}
-
+
/**
* Sets the Encoding value of the font.
* @param encoding the encoding
@@ -84,7 +84,7 @@
put("Encoding", encoding);
}
}
-
+
/**
* factory method with the basic parameters
*
@@ -122,7 +122,7 @@
public String getName() {
return this.fontname;
}
-
+
/**
* Returns the name of the BaseFont.
* @return the BaseFont
@@ -158,7 +158,7 @@
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 @@
validate();
return super.output(stream);
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontDescriptor.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontDescriptor.java Fri Jul 25 03:55:49 2008
@@ -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 @@
/**
* 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 @@
}
return stream;
}
-
+
/**
* Sets the CIDSet stream for this font descriptor. (Optional)
* @param cidSet the CIDSet stream
@@ -127,19 +127,19 @@
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);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontNonBase14.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontNonBase14.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontNonBase14.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontNonBase14.java Fri Jul 25 03:55:49 2008
@@ -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 PDFFontDescriptor getDescriptor() {
return (PDFFontDescriptor)get("FontDescriptor");
}
-
+
/**
* Sets a ToUnicode CMap.
* @param cmap the ToUnicode character map
@@ -78,15 +78,15 @@
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!");
}
}
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontTrueType.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontTrueType.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontTrueType.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontTrueType.java Fri Jul 25 03:55:49 2008
@@ -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 @@
* @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);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontType0.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontType0.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontType0.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontType0.java Fri Jul 25 03:55:49 2008
@@ -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 @@
* @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 @@
* @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);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontType1.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontType1.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontType1.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontType1.java Fri Jul 25 03:55:49 2008
@@ -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 @@
* @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) {
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontType3.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontType3.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontType3.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFontType3.java Fri Jul 25 03:55:49 2008
@@ -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 @@
* @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 @@
* @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,
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFormXObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFormXObject.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFormXObject.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFormXObject.java Fri Jul 25 03:55:49 2008
@@ -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 @@
* dictionary but a stream of image data.
*/
public class PDFFormXObject extends PDFXObject {
-
+
private PDFStream contents;
private PDFReference resRef;
@@ -49,7 +49,7 @@
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 @@
array.set(3, bbox.getHeight());
}
}
-
+
/**
* Returns the bounding box.
* @return the BBox value
@@ -95,7 +95,7 @@
return null;
}
}
-
+
/**
* Sets the Matrix value
* @param at the AffineTransform defining the transformation matrix
@@ -122,7 +122,7 @@
array.set(5, m[5]);
}
}
-
+
/**
* Returns the Matrix value.
* @return the Matrix
@@ -143,7 +143,7 @@
return null;
}
}
-
+
/**
* Used to set the contents of the PDF stream.
* @param data the contents as a byte array
@@ -161,7 +161,7 @@
/** {@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 @@
put("Resources", resRef);
super.populateStreamDict(lengthEntry);
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFunction.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFFunction.java Fri Jul 25 03:55:49 2008
@@ -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.
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFGState.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFGState.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFGState.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFGState.java Fri Jul 25 03:55:49 2008
@@ -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 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 @@
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 @@
/**
* 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) {
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFGoTo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFGoTo.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFGoTo.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFGoTo.java Fri Jul 25 03:55:49 2008
@@ -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 @@
} else {
dest = "/D [" + this.pageReference + " " + destination + "]\n";
}
- return getObjectID()
+ return getObjectID()
+ "<< /Type /Action\n/S /GoTo\n" + dest
+ ">>\nendobj\n";
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFGoToRemote.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFGoToRemote.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFGoToRemote.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFGoToRemote.java Fri Jul 25 03:55:49 2008
@@ -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;
/**
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java Fri Jul 25 03:55:49 2008
@@ -33,7 +33,7 @@
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 @@
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 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 @@
sRGBProfile.setColorSpace(profile, null);
return sRGBProfile;
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFICCStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFICCStream.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFICCStream.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFICCStream.java Fri Jul 25 03:55:49 2008
@@ -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 @@
* Special PDFStream for ICC profiles (color profiles).
*/
public class PDFICCStream extends PDFStream {
-
+
private ICC_Profile cp;
private PDFDeviceColorSpace pdfColorSpace;
@@ -53,7 +53,7 @@
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 @@
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());
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFImage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFImage.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFImage.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFImage.java Fri Jul 25 03:55:49 2008
@@ -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 @@
/** @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 @@
/**
* 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.
*
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFImageXObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFImageXObject.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFImageXObject.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFImageXObject.java Fri Jul 25 03:55:49 2008
@@ -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 @@
* document in another place.
*/
public class PDFImageXObject extends PDFXObject {
-
+
private PDFImage pdfimage;
/**
@@ -63,7 +63,7 @@
*/
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 @@
populateDictionaryFromImage();
}
}
-
+
private void populateDictionaryFromPS() {
getDocumentSafely().getProfile().verifyPSXObjectsAllowed();
put("Subtype", new PDFName("PS"));
@@ -139,7 +139,7 @@
//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 @@
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 @@
protected void setupFilterList() {
if (!getFilterList().isInitialized()) {
getFilterList().addDefaultFilters(
- getDocumentSafely().getFilterMap(),
+ getDocumentSafely().getFilterMap(),
pdfimage.getFilterHint());
}
super.setupFilterList();
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFInfo.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFInfo.java Fri Jul 25 03:55:49 2008
@@ -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 String getProducer() {
return this.producer;
}
-
+
/**
* set the producer string
*
@@ -64,7 +64,7 @@
public String getCreator() {
return this.creator;
}
-
+
/**
* set the creator string
*
@@ -92,7 +92,7 @@
public String getAuthor() {
return this.author;
}
-
+
/**
* set the author string
*
@@ -106,7 +106,7 @@
public String getSubject() {
return this.subject;
}
-
+
/**
* set the subject string
*
@@ -120,7 +120,7 @@
public String getKeywords() {
return this.keywords;
}
-
+
/**
* set the keywords string
*
@@ -162,7 +162,7 @@
* {@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 @@
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 @@
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 @@
if (profile.isTrappedEntryRequired()) {
bout.write(encode("/Trapped /False\n"));
}
-
+
bout.write(encode(">>\nendobj\n"));
} catch (IOException ioe) {
log.error("Ignored I/O exception", ioe);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFInternalLink.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFInternalLink.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFInternalLink.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFInternalLink.java Fri Jul 25 03:55:49 2008
@@ -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;
/**
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFLink.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFLink.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFLink.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFLink.java Fri Jul 25 03:55:49 2008
@@ -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
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFMetadata.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFMetadata.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFMetadata.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFMetadata.java Fri Jul 25 03:55:49 2008
@@ -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 @@
* @since PDF 1.4
*/
public class PDFMetadata extends PDFStream {
-
+
private Metadata xmpMetadata;
private boolean readOnly = true;
@@ -62,7 +62,7 @@
protected void setupFilterList() {
if (!getFilterList().isInitialized()) {
getFilterList().addDefaultFilters(
- getDocumentSafely().getFilterMap(),
+ getDocumentSafely().getFilterMap(),
PDFFilterList.METADATA_FILTER);
}
super.setupFilterList();
@@ -74,7 +74,7 @@
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 @@
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 @@
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 static Metadata createXMPFromPDFDocument(PDFDocument pdfDoc) {
Metadata meta = new Metadata();
-
+
PDFInfo info = pdfDoc.getInfo();
PDFRoot root = pdfDoc.getRoot();
@@ -129,7 +129,7 @@
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 @@
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 @@
pdfa.setConformance("B"); //PDF/A-1b
}
}
-
+
//XMP Basic Schema
XMPBasicAdapter xmpBasic = XMPBasicSchema.getAdapter(meta);
xmpBasic.setCreateDate(info.getCreationDate());
@@ -186,8 +186,8 @@
adobePDF.setProducer(info.getProducer());
}
adobePDF.setPDFVersion(pdfDoc.getPDFVersionString());
-
-
+
+
return meta;
}
@@ -206,14 +206,14 @@
} 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;
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFName.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFName.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFName.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFName.java Fri Jul 25 03:55:49 2008
@@ -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 @@
* 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 @@
}
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 @@
sb.append(DIGITS[ch >>> 4 & 0x0F]);
sb.append(DIGITS[ch & 0x0F]);
}
-
+
/** {@inheritDoc} */
public String toString() {
return this.name;
@@ -86,15 +86,15 @@
}
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 @@
writer.write(toString());
}
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNameTreeNode.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNameTreeNode.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNameTreeNode.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNameTreeNode.java Fri Jul 25 03:55:49 2008
@@ -43,7 +43,7 @@
public void setKids(PDFArray kids) {
put(KIDS, kids);
}
-
+
/**
* Returns the Kids array.
* @return the Kids array
@@ -51,7 +51,7 @@
public PDFArray getKids() {
return (PDFArray)get(KIDS);
}
-
+
/**
* Sets the Names array.
* @param names the Names array
@@ -59,7 +59,7 @@
public void setNames(PDFArray names) {
put(NAMES, names);
}
-
+
/**
* Returns the Names array.
* @return the Names array
@@ -67,7 +67,7 @@
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 @@
}
return limits;
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNames.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNames.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNames.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNames.java Fri Jul 25 03:55:49 2008
@@ -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 PDFDests getDests() {
return (PDFDests)get("Dests");
}
-
+
/**
* Set the Dests object
* @param dests the Dests object
@@ -47,5 +47,5 @@
public void setDests(PDFDests dests) {
put("Dests", dests);
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNull.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNull.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNull.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNull.java Fri Jul 25 03:55:49 2008
@@ -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 @@
* 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 String toString() {
return "null";
}
-
+
/** {@inheritDoc} */
public void outputInline(OutputStream out, Writer writer) throws IOException {
writer.write(toString());
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNumber.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNumber.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNumber.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNumber.java Fri Jul 25 03:55:49 2008
@@ -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.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 Number getNumber() {
return this.number;
}
-
+
/**
* Sets the number.
* @param number the number
@@ -69,9 +69,9 @@
// 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 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) {
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNumberTreeNode.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNumberTreeNode.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNumberTreeNode.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFNumberTreeNode.java Fri Jul 25 03:55:49 2008
@@ -43,7 +43,7 @@
public void setKids(PDFArray kids) {
put(KIDS, kids);
}
-
+
/**
* Returns the Kids array.
* @return the Kids array
@@ -51,7 +51,7 @@
public PDFArray getKids() {
return (PDFArray)get(KIDS);
}
-
+
/**
* Sets the Nums array.
* @param nums the Nums array
@@ -59,7 +59,7 @@
public void setNums(PDFNumsArray nums) {
put(NUMS, nums);
}
-
+
/**
* Returns the Nums array.
* @return the Nums array
@@ -67,7 +67,7 @@
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 @@
}
return limits;
}
-
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org