Class RMPDFWriter
- java.lang.Object
-
- com.inductiveautomation.rm.base.RMListenerList
-
- com.inductiveautomation.rm.base.RMObject
-
- com.inductiveautomation.rm.pdf.writer.PDFFile
-
- com.inductiveautomation.rm.pdf.writer.RMPDFWriter
-
- All Implemented Interfaces:
RMPropertyChanger
,java.lang.Cloneable
public class RMPDFWriter extends PDFFile
PDF Writer.
-
-
Constructor Summary
Constructors Constructor Description RMPDFWriter()
Creates a writer which holds all bytes in memory via aPDFBuffer
.RMPDFWriter(RMDocument document, java.io.OutputStream writeTo)
Writes the supplied document to the output stream, closing it once complete.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description byte[]
getBytes(RMDocument aDoc)
Returns a PDF byte array for a given RMDocument.byte[]
getBytesPDF(RMDocument aDoc)
Deprecated.boolean
getCompress()
Returns whether to compress or not.java.util.zip.Deflater
getDeflater()
Returns a shared deflater.PDFEncryptor
getEncryptor()
Returns the current PDF encryptor.boolean
getIncludeNewlines()
Returns whether to include newline and tab characters characters.static boolean
getIncludeNewlinesDefault()
Returns whether to include newline and tab characters characters.PDFOutput
getPdfOutput()
PDFPage
getPDFPage()
Returns the current PDF page.static java.util.Map<java.lang.String,java.lang.String>
getViewerPreferencesDefault()
Returns default viewer preferences map.void
setAccessPermissions(java.lang.String ownerPwd, java.lang.String userPwd, int accessFlags)
Sets pdf user access restrictions.void
setCompress(boolean aValue)
Sets whether to compress or not.void
setIncludeNewlines(boolean aValue)
Sets whether to include newline and tab characters.static void
setIncludeNewlinesDefault(boolean aValue)
Sets whether to include newline and tab characters.void
setUnmodifiable(java.lang.String ownerPwd)
Set the access permissions on the file such that the document can be opened by anyone, but the user cannot modify the document in any way.static void
setViewerPreferencesDefault(java.util.Map<java.lang.String,java.lang.String> aMap)
Sets default viewer preferences map.void
writeXRefEntry(java.lang.Object anObj)
Writes any kind of object to the PDF buffer.-
Methods inherited from class com.inductiveautomation.rm.pdf.writer.PDFFile
addImageData, getFileID, getFileIDString, getFontEntry, getFontEntry, getFonts, getImages, getInfoDict, getPagesTree, getUniqueImageData, getVersion, getXRefTable, setAuthor, setCreator, setFontEntry, setVersion, setViewerPreferences, writeXRefTable
-
Methods inherited from class com.inductiveautomation.rm.base.RMObject
addPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChange, toString
-
Methods inherited from class com.inductiveautomation.rm.base.RMListenerList
addListener, clone, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
-
-
-
-
Constructor Detail
-
RMPDFWriter
public RMPDFWriter()
Creates a writer which holds all bytes in memory via aPDFBuffer
. Useful for calls togetBytes(RMDocument)
If possible, useRMPDFWriter(RMDocument, OutputStream)
which will write data directly to the output stream instead of holding it in memory until the very end.
-
RMPDFWriter
public RMPDFWriter(RMDocument document, java.io.OutputStream writeTo) throws java.io.IOException
Writes the supplied document to the output stream, closing it once complete. NOTE: calls togetBytes(RMDocument)
will throw anIllegalStateException
as it is expected that the data is written directly to the output stream and not held in memory.- Throws:
java.io.IOException
-
-
Method Detail
-
getBytes
public byte[] getBytes(RMDocument aDoc)
Returns a PDF byte array for a given RMDocument. Note: this can only be successfully called ifRMPDFWriter()
is used to instantiate the writer, which will hold all bytes for the PDF in memory. Instead of calling this function, it is preferable to useRMPDFWriter(RMDocument, OutputStream)
which will write directly to the output stream.
-
getPDFPage
public PDFPage getPDFPage()
Returns the current PDF page.
-
getPdfOutput
public PDFOutput getPdfOutput()
-
getCompress
public boolean getCompress()
Returns whether to compress or not.
-
setCompress
public void setCompress(boolean aValue)
Sets whether to compress or not.
-
getDeflater
public java.util.zip.Deflater getDeflater()
Returns a shared deflater.
-
getEncryptor
public PDFEncryptor getEncryptor()
Returns the current PDF encryptor.
-
setUnmodifiable
public void setUnmodifiable(java.lang.String ownerPwd)
Set the access permissions on the file such that the document can be opened by anyone, but the user cannot modify the document in any way. To modify these settings in Acrobat, the owner password would have to be provided.
-
setAccessPermissions
public void setAccessPermissions(java.lang.String ownerPwd, java.lang.String userPwd, int accessFlags)
Sets pdf user access restrictions.The user password is the password that will be required to open the file. The owner password is the password that will be required to make future changes to the security settings, such as the passwords. Either of the passwords may be null. If both passwords are null, the file will not be password protected, but it will still be encrypted. Fine-grained access can be limited by setting accessFlags, to limit such things as printing or editing the file. See com.ribs.pdf.PDFSecurityHandler for a list of the access flag constants. (or the pdf spec v1.6, pp. 99-100)
-
getViewerPreferencesDefault
public static java.util.Map<java.lang.String,java.lang.String> getViewerPreferencesDefault()
Returns default viewer preferences map.
-
setViewerPreferencesDefault
public static void setViewerPreferencesDefault(java.util.Map<java.lang.String,java.lang.String> aMap)
Sets default viewer preferences map.
-
getIncludeNewlines
public boolean getIncludeNewlines()
Returns whether to include newline and tab characters characters.
-
setIncludeNewlines
public void setIncludeNewlines(boolean aValue)
Sets whether to include newline and tab characters.
-
getIncludeNewlinesDefault
public static boolean getIncludeNewlinesDefault()
Returns whether to include newline and tab characters characters.
-
setIncludeNewlinesDefault
public static void setIncludeNewlinesDefault(boolean aValue)
Sets whether to include newline and tab characters.
-
writeXRefEntry
public void writeXRefEntry(java.lang.Object anObj)
Writes any kind of object to the PDF buffer.
-
getBytesPDF
@Deprecated public byte[] getBytesPDF(RMDocument aDoc)
Deprecated.Obsolete
-
-