Classes | |
| class | IAnnotInitializator |
| class | UniversalAnnotInitializer |
| class | TextAnnotInitializer |
| class | LinkAnnotInitializer |
| class | PropertyEquals |
| class | IdCollector |
| class | IndComparator |
| class | Delinearizator |
| class | Flattener |
| struct | OperationStep |
| struct | OperationScope |
| class | IProgressBar |
| class | ProgressObserver |
| class | FilterStreamWriter |
| class | NullFilterStreamWriter |
| class | ZlibFilterStreamWriter |
| class | IPdfWriter |
| class | OldStylePdfWriter |
| struct | FileStreamData |
| class | FileStreamDataDeleter |
| class | PdfDocumentWriter |
Typedefs | |
| typedef unsigned char *(* | stream_data_extractor )(const Object &obj, size_t &size) |
| typedef observer::IObserver < OperationStep > | PdfWriterObserver |
Enumerations | |
| enum | PageTreeNodeType { ErrorNode, UnknownNode, LeafNode, InterNode, RootNode } |
Functions | |
| CAnnotation::AnnotType | annotTypeMapping (const std::string &typeName) |
| template<PropertyType Tp, typename T > | |
| void | complexValueFromXpdfObj (IProperty &ip, const ::Object &obj, T val) |
| template<typename T > | |
| void | complexValueToString (const typename T::Value &val, std::string &str) |
| template<typename SimpleValueType , typename ItemType , PropertyType ItemPType> | |
| SimpleValueType | getSimpleValueFromArray (const boost::shared_ptr< CArray > &array, size_t position) DEPRECATED |
| template<typename ItemType > | |
| ItemType::Value | getSimpleValueFromArray (const boost::shared_ptr< CArray > &array, size_t position) |
| template<typename SimpleValueType , typename ItemType , PropertyType ItemPType> | |
| SimpleValueType | getSimpleValueFromArray (const boost::shared_ptr< IProperty > &array, size_t position) DEPRECATED |
| template<typename ItemType > | |
| ItemType::Value | getSimpleValueFromArray (const boost::shared_ptr< IProperty > &ip, size_t position) |
| template<typename IP > | |
| CInt::Value | getIntFromArray (const IP &ip, size_t position) |
| template<typename IP > | |
| CReal::Value | getDoubleFromArray (const IP &ip, size_t position) |
| template<typename IP > | |
| CString::Value | getStringFromArray (const IP &ip, size_t position) |
| template<typename IP > | |
| CRef::Value | getRefFromArray (const IP &ip, size_t position) |
| template<typename Value , typename ItemType , PropertyType ItemPType> | |
| void | setSimpleValueInArray (const CArray &array, size_t position, const Value &val) DEPRECATED |
| template<typename ItemType > | |
| void | setSimpleValueInArray (const CArray &array, size_t position, const typename ItemType::Value &val) |
| template<typename Value , typename ItemType , PropertyType ItemPType> | |
| void | setSimpleValueInArray (const IProperty &array, size_t position, const Value &val) DEPRECATED |
| template<typename ItemType > | |
| void | setSimpleValueInArray (const IProperty &ip, size_t position, const typename ItemType::Value &val) |
| template<typename IP > | |
| void | setIntInArray (const IP &ip, size_t position, int val) |
| template<typename IP > | |
| void | setDoubleInArray (const IP &ip, size_t position, double val) |
| template<typename ItemType , PropertyType ItemPType> | |
| boost::shared_ptr< ItemType > | getTypeFromArray (const boost::shared_ptr< CArray > &array, size_t pos) DEPRECATED |
| template<typename ItemType > | |
| boost::shared_ptr< ItemType > | getTypeFromArray (const boost::shared_ptr< CArray > &array, size_t pos) |
| template<typename ItemType , PropertyType ItemPType> | |
| boost::shared_ptr< ItemType > | getTypeFromArray (const boost::shared_ptr< IProperty > &array, size_t pos) DEPRECATED |
| template<typename ItemType > | |
| boost::shared_ptr< ItemType > | getTypeFromArray (const boost::shared_ptr< IProperty > &ip, size_t pos) |
| void | dictFromXpdfObj (CDict &resultDict,::Object &dict) |
| size_t | stringToCharBuffer (Object &stringObject, CharBuffer &outputBuf) |
| unsigned char * | bufferFromStream (Stream &str, size_t dictLength, size_t &size) |
| unsigned char * | convertStreamToDecodedData (const Object &obj, size_t &size) |
| size_t | streamToCharBuffer (const Object &streamObject, Ref *ref, CharBuffer &outputBuf, stream_data_extractor extractor) |
| void | xpdfObjToString (Object &obj, std::string &str) |
| void | getStringFromXpdfStream (std::string &str,::Object &obj) |
| void | createIndirectObjectStringFromString (const IndiRef &rf, const std::string &val, std::string &output) |
| template<typename SimpleValueType , typename ItemType , PropertyType ItemPType> | |
| SimpleValueType | getSimpleValueFromDict (const boost::shared_ptr< CDict > &dict, const std::string &id) DONOTUSE |
| template<typename ItemType > | |
| ItemType::Value | getSimpleValueFromDict (const boost::shared_ptr< CDict > &dict, CDict::PropertyId id) |
| template<typename SimpleValueType , typename ItemType , PropertyType ItemPType> | |
| SimpleValueType | getSimpleValueFromDict (const CDict &dict, const std::string &id) DONOTUSE |
| template<typename ItemType > | |
| ItemType::Value | getSimpleValueFromDict (const CDict &dict, const std::string &id) |
| template<typename SimpleValueType , typename ItemType , PropertyType ItemPType> | |
| SimpleValueType | getSimpleValueFromDict (const boost::shared_ptr< IProperty > &dict, const std::string &id) DONOTUSE |
| template<typename ItemType > | |
| ItemType::Value | getSimpleValueFromDict (const boost::shared_ptr< IProperty > &ip, const std::string &id) |
| template<typename IP > | |
| int | getIntFromDict (const IP &ip, const std::string &id) |
| template<typename IP > | |
| double | getDoubleFromDict (const IP &ip, const std::string &id) |
| template<typename IP > | |
| std::string | getStringFromDict (const IP &ip, const std::string &id) |
| template<typename IP > | |
| std::string | getNameFromDict (const IP &ip, const std::string &id) |
| template<typename Value , typename ItemType , PropertyType ItemPType> | |
| void | setSimpleValueInDict (const CDict &dict, const std::string &name, const Value &val) DONOTUSE |
| template<typename ItemType > | |
| void | setSimpleValueInDict (const CDict &dict, CDict::PropertyId name, const typename ItemType::Value &val) |
| template<typename Value , typename ItemType , PropertyType ItemPType> | |
| void | setSimpleValueInDict (const IProperty &dict, const std::string &name, const Value &val) DONOTUSE |
| template<typename ItemType > | |
| void | setSimpleValueInDict (const IProperty &ip, CDict::PropertyId name, const typename ItemType::Value &val) |
| template<typename IP > | |
| void | setIntInDict (const IP &ip, const std::string &name, int val) |
| template<typename IP > | |
| void | setDoubleInDict (const IP &ip, const std::string &name, double val) |
| template<typename ItemType , PropertyType ItemPType> | |
| boost::shared_ptr< ItemType > | getTypeFromDictionary (const boost::shared_ptr< CDict > &dict, const std::string &key) DONOTUSE |
| template<typename ItemType > | |
| boost::shared_ptr< ItemType > | getTypeFromDictionary (const boost::shared_ptr< CDict > &dict, CDict::PropertyId key) |
| template<typename ItemType , PropertyType ItemPType> | |
| boost::shared_ptr< ItemType > | getTypeFromDictionary (const boost::shared_ptr< IProperty > &dict, const std::string &key) DONOTUSE |
| template<typename ItemType > | |
| boost::shared_ptr< ItemType > | getTypeFromDictionary (const boost::shared_ptr< IProperty > &ip, CDict::PropertyId key) |
| template<typename IP > | |
| boost::shared_ptr< CDict > | getCDictFromDict (IP &ip, const std::string &key) |
| template<typename IP > | |
| boost::shared_ptr< CArray > | getCArrayFromDict (IP &ip, const std::string &key) |
| boost::shared_ptr< CDict > | getCDictFromDict (boost::shared_ptr< CDict > dict, const std::string &key) |
| bool | objHasParent (const IProperty &ip, boost::shared_ptr< IProperty > &indiObj) |
| bool | objHasParent (const IProperty &ip) |
| template<typename T > | |
| void | parseStreamToContainer (T &container, const ::Object &obj) |
| template void | parseStreamToContainer< CStream::Buffer > (CStream::Buffer &container, const ::Object &obj) |
| template<typename ITERATOR , typename OUTITERATOR > | |
| void | streamToString (const std::string &strDict, ITERATOR begin, ITERATOR end, OUTITERATOR out) |
| template void | streamToString< CStream::Buffer::const_iterator, std::back_insert_iterator< std::string > > (const std::string &strDict, CStream::Buffer::const_iterator begin, CStream::Buffer::const_iterator end, std::back_insert_iterator< std::string > out) |
| void | simpleValueFromString (const std::string &str, bool &val) |
| void | simpleValueFromString (const std::string &str, int &val) |
| void | simpleValueFromString (const std::string &str, double &val) |
| void | simpleValueFromString (const std::string &str, std::string &val) |
| void | simpleValueFromString (const std::string &str, IndiRef &val) |
| template<> | |
| void | simpleValueToString< pBool > (bool val, string &str) |
| template<> | |
| void | simpleValueToString< pInt > (int val, string &str) |
| void | trim_trailing_zero (char *number_str) |
| template<> | |
| void | simpleValueToString< pReal > (double val, string &str) |
| template<> | |
| void | simpleValueToString< pNull > (const NullType &, string &str) |
| template<> | |
| void | simpleValueToString< pRef > (const IndiRef &ref, string &str) |
| bool | isBinaryString (const std::string &val) |
| template<typename Iter > | |
| std::string | makeHexString (Iter it, Iter end) |
| template<PropertyType Tp> | |
| void | simpleValueToString (const std::string &val, std::string &str) |
| template void | simpleValueToString< pString > (const string &val, string &str) |
| template void | simpleValueToString< pName > (const string &val, string &str) |
| template<> | |
| void | complexValueToString< CArray > (const CArray::Value &val, string &str) |
| template<> | |
| void | complexValueToString< CDict > (const CDict::Value &val, string &str) |
| void | xpdfObjToString (Object &obj, string &str) |
| IProperty * | createObjFromXpdfObj (boost::shared_ptr< CPdf > pdf, const Object &obj, const IndiRef &ref) |
| IProperty * | createObjFromXpdfObj (const Object &obj) |
| template<PropertyType Tp, typename T > | |
| Object * | simpleValueToXpdfObj (T val) |
| template Object * | simpleValueToXpdfObj< pBool, const bool & > (const bool &val) |
| template Object * | simpleValueToXpdfObj< pInt, const int & > (const int &val) |
| template Object * | simpleValueToXpdfObj< pReal, const double & > (const double &val) |
| template Object * | simpleValueToXpdfObj< pString, const string & > (const string &val) |
| template Object * | simpleValueToXpdfObj< pName, const string & > (const string &val) |
| template Object * | simpleValueToXpdfObj< pNull, const NullType & > (const NullType &val) |
| template Object * | simpleValueToXpdfObj< pRef, const IndiRef & > (const IndiRef &val) |
| template<PropertyType Tp, typename T > | |
| void | simpleValueFromXpdfObj (const Object &obj, T val) |
| template<> | |
| void | simpleValueFromXpdfObj< pNull, NullType & > (const Object &, NullType &) |
| template<PropertyType Tp, typename T > | |
| void | complexValueFromXpdfObj (IProperty &ip, const Object &obj, T val) |
| template void | complexValueFromXpdfObj< pArray, CArray::Value & > (IProperty &ip, const Object &obj, CArray::Value &val) |
| template void | complexValueFromXpdfObj< pDict, CDict::Value & > (IProperty &ip, const Object &obj, CDict::Value &val) |
| ::Object * | xpdfObjFromString (const std::string &str, XRef *xref) |
| ::Object * | xpdfStreamObjFromBuffer (const CStream::Buffer &buffer, const CDict &dict) |
| int | getIntFromDict (std::string name, boost::shared_ptr< CDict > dict) |
| IndiRef | getRefFromDict (std::string name, boost::shared_ptr< CDict > dict) |
| std::string | getStringFromDict (std::string name, boost::shared_ptr< CDict > dict) |
| std::string | getNameFromDict (std::string name, boost::shared_ptr< CDict > dict) |
| std::string | getDictType (boost::shared_ptr< CDict > dict) |
| boost::shared_ptr< CDict > | getDictFromRef (boost::shared_ptr< IProperty > refProp) |
| boost::shared_ptr< CDict > | getDictFromRef (CPdf &pdf, IndiRef ref) |
| void | printProperty (boost::shared_ptr< IProperty > ip, std::ostream &out) |
| template<typename SimpleClass , PropertyType SimpleType> | |
| bool | simpleEquals (const boost::shared_ptr< IProperty > &val1, const boost::shared_ptr< IProperty > &val2) throw () |
| boost::shared_ptr< IProperty > | getReferencedObject (boost::shared_ptr< IProperty > ip) |
| boost::shared_ptr< IProperty > | getIPropertyFromRectangle (const libs::Rectangle &rect) |
| void | getRectangleFromProperty (const shared_ptr< IProperty > prop, libs::Rectangle &rect) |
| boost::shared_ptr< IProperty > | getIPropertyFromDate (const tm *time) |
| bool | checkAndReplace (boost::shared_ptr< CDict > annotDict, std::string fieldName, IProperty &fieldValue) |
| ::XRef * | getXRef (shared_ptr< IProperty > ip) |
| template<typename Complex , typename Container > | |
| void | getPropertyId (const boost::shared_ptr< Complex > &parent, const boost::shared_ptr< IProperty > &child, Container &container) throw () |
| void | getRectangleFromProperty (const boost::shared_ptr< IProperty > prop, libs::Rectangle &rect) |
| template<typename Container > | |
| void | getAllChildrenOfPdfObject (boost::shared_ptr< CDict > topdict, Container &cont) |
| ::XRef * | getXRef (boost::shared_ptr< IProperty > ip) |
| template<typename Iter > | |
| std::string | makeNamePdfValid (Iter it, Iter end) |
| std::string | makeNamePdfValid (const char *str) |
| template<typename Iter > | |
| std::string | makeStringPdfValid (Iter it, Iter end) |
| std::string | makeStringPdfValid (GString *str) |
| IProperty * | createObjFromXpdfObj (boost::shared_ptr< CPdf > pdf, const ::Object &obj, const IndiRef &ref) |
| IProperty * | createObjFromXpdfObj (const ::Object &obj) |
| template<PropertyType Tp, typename T > | |
| void | simpleValueFromXpdfObj (const ::Object &obj, T val) |
| ::Object * | xpdfObjFromString (const std::string &str,::XRef *xref=NULL) |
| template<PropertyType Tp> | |
| void | simpleValueToString (bool val, std::string &str) |
| template<PropertyType Tp> | |
| void | simpleValueToString (int val, std::string &str) |
| template<PropertyType Tp> | |
| void | simpleValueToString (double val, std::string &str) |
| template<PropertyType Tp> | |
| void | simpleValueToString (const NullType &val, std::string &str) |
| template<PropertyType Tp> | |
| void | simpleValueToString (const IndiRef &val, std::string &str) |
| template<typename ItemType , PropertyType ItemPType, typename Value > | |
| Value | getValueFromSimple (const boost::shared_ptr< IProperty > &ip) DEPRECATED |
| template<typename ItemType > | |
| ItemType::Value | getValueFromSimple (const boost::shared_ptr< IProperty > &ip) |
| int | getIntFromIProperty (const boost::shared_ptr< IProperty > &ip) |
| double | getDoubleFromIProperty (const boost::shared_ptr< IProperty > &ip) |
| std::string | getStringFromIProperty (const boost::shared_ptr< IProperty > &ip) |
| std::string | getNameFromIProperty (const boost::shared_ptr< IProperty > &ip) |
| template<typename ItemType , PropertyType ItemPType, typename Value > | |
| void | setValueToSimple (const boost::shared_ptr< IProperty > &ip, const Value &val) |
| ostream & | operator<< (ostream &stream, PageTreeNodeType nodeType) |
| shared_ptr< CDict > | getPageTreeRoot (const boost::shared_ptr< CPdf > &pdf) |
| PageTreeNodeType | getNodeType (const boost::shared_ptr< IProperty > &nodeProp) throw () |
| template<typename Container > | |
| void | getKidsFromInterNode (const boost::shared_ptr< CDict > &interNodeDict, Container &container) throw () |
| size_t | getKidsCount (const boost::shared_ptr< IProperty > &interNodeProp, PageTreeNodeCountCache *cache) throw () |
| boost::shared_ptr< CDict > | findPageDict (const boost::shared_ptr< CPdf > &pdf, const boost::shared_ptr< IProperty > &pagesDict, size_t startPos, size_t pos, PageTreeNodeCountCache *cache) |
| size_t | searchTreeNode (shared_ptr< const CPdf > pdf, shared_ptr< CDict > superNode, shared_ptr< CDict > node, size_t startValue, PageTreeNodeCountCache *cache) |
| size_t | getNodePosition (const shared_ptr< CPdf > &pdf, const shared_ptr< IProperty > &node, PageTreeNodeCountCache *cache) |
| bool | isNodeDescendant (const boost::shared_ptr< CPdf > &pdf, const IndiRef &parent, const shared_ptr< CDict > &child) |
| bool | isEncrypted (const boost::shared_ptr< CPdf > &pdf) |
| size_t | getNodePosition (const boost::shared_ptr< CPdf > &pdf, const boost::shared_ptr< IProperty > &node, PageTreeNodeCountCache *cache) |
| bool | isNodeDescendant (const boost::shared_ptr< CPdf > &pdf, const IndiRef &parent, const boost::shared_ptr< CDict > &child) |
| template<typename CType > | |
| boost::shared_ptr< CType > | getCObjectFromRef (const boost::shared_ptr< IProperty > &refProp) |
| template<typename CType > | |
| boost::shared_ptr< CType > | getCObjectFromRef (const IndiRef &ref, const boost::shared_ptr< CPdf > &pdf) |
| template<typename Iter > | |
| void | makeStreamPdfValid (Iter it, Iter end, std::string &out) |
| template<typename IP > | |
| boost::shared_ptr< CStream > | getCStreamFromDict (IP &ip, const std::string &key) |
| template<typename IP > | |
| boost::shared_ptr< CStream > | getCStreamFromArray (IP &ip, size_t pos) |
| int | getFiltersFromStream (const Object &obj, std::vector< std::string > &filters) |
| boost::shared_ptr < FilterStreamWriter > | lookupFilterStreamWriter (const Object &obj, FilterStreamWriter::WritersList &filters) |
| void | writeObject (const ::Object &obj, StreamWriter &stream,::Ref *ref, bool indirect) |
| void | stripXRefStreamFields (const Object &trailer) |
| bool | checkLinearized (StreamWriter &stream, CXref *xref, Ref *ref) |
| bool | isLatestRevision (const XRefWriter &xref) |
| bool | canChangeTrailerEntry (const char *name) |
| bool | typeSafeTrailerEntry (const char *name,::Object &value, XRef &xref) |
Namespace includes all helper functions and classes.
Type for pdf writer observers.
Uses OperationStep as value keeper.
| typedef unsigned char*(* pdfobjects::utils::stream_data_extractor)(const Object &obj, size_t &size) |
Function to be used for data extracting from the given stream object. Note that implementation can apply additional filters to the stream data currently stored in the obj.stream and update object accordingly (change Filter and associated entry). Length entry doesn't have to be changed by the implementation as it is supposed to be updated by caller (because we want to prevent useless object updating when a chain of this function is called for multiple filters).
Function is called from the streamToCharBuffer function to have transparent access to the stream data without any knowledge about filters. bufferFromStreamData is the referencial implementation which provides encoded data without any filters applied (all other implementations can use this function as the base and convert returned buffer into their represenation).
| Stream | object. | |
| size | Number of bytes written to the returned buffer. |
Type enumeration for page tree nodes. Type of dictionary in page tree. Possible values are:
Implementation node:
Note that order is significant, because we assume that everything lower than LeafNode is kind of error (problem) and also that greater or equal than InterNode is intermediate node.
| CAnnotation::AnnotType pdfobjects::utils::annotTypeMapping | ( | const std::string & | typeName | ) |
Returns CAnnotation enumeration type for given name.
| typeName | String representation of type (value of Subtype field from annotation dictionary). |
Maps given string to CAnnotation::AnnotType.
References pdfobjects::CAnnotation::_3D, pdfobjects::CAnnotation::Caret, pdfobjects::CAnnotation::Circle, pdfobjects::CAnnotation::Fileattachement, pdfobjects::CAnnotation::FreeText, pdfobjects::CAnnotation::Highlight, pdfobjects::CAnnotation::Ink, pdfobjects::CAnnotation::Line, pdfobjects::CAnnotation::Link, pdfobjects::CAnnotation::Movie, pdfobjects::CAnnotation::Polygon, pdfobjects::CAnnotation::PolyLine, pdfobjects::CAnnotation::Popup, pdfobjects::CAnnotation::Printermark, pdfobjects::CAnnotation::Screen, pdfobjects::CAnnotation::Sound, pdfobjects::CAnnotation::Square, pdfobjects::CAnnotation::Squiggly, pdfobjects::CAnnotation::Stamp, pdfobjects::CAnnotation::StrikeOut, pdfobjects::CAnnotation::Text, pdfobjects::CAnnotation::Trapnet, pdfobjects::CAnnotation::Underline, pdfobjects::CAnnotation::Unknown, pdfobjects::CAnnotation::Watermark, and pdfobjects::CAnnotation::Widget.
Referenced by pdfobjects::CAnnotation::getType().
| unsigned char * pdfobjects::utils::bufferFromStream | ( | Stream & | str, | |
| size_t | dictLength, | |||
| size_t & | size | |||
| ) |
Helper function which returns data from given stream.
| str | Stream to read (until it returns EOF). | |
| dictLength | Initial size reported by the stream dictionary. | |
| size | Output size of the buffer. |
This is low-level function which simply reads given stream from its beginning until EOF. It can be used to retrieve data from whatever Stream filter stack layer. E.g. if we want to get encoded data we can simply give stream->getBaseStream() as parameter and this function will return buffer as it is written in the file.
References debug::DBG_CRIT, debug::DBG_DBG, and utilsPrintDbg.
Referenced by convertStreamToDecodedData(), and pdfobjects::utils::NullFilterStreamWriter::null_extractor().
| bool pdfobjects::utils::canChangeTrailerEntry | ( | const char * | name | ) |
Checks whether trailer entry with the following name can be changed.
| name | Name of the field (must be non NULL). |
Referenced by pdfobjects::XRefWriter::changeTrailer().
| bool pdfobjects::utils::checkAndReplace | ( | boost::shared_ptr< CDict > | annotDict, | |
| std::string | fieldName, | |||
| IProperty & | fieldValue | |||
| ) |
Checks and replaces mapping in given dictionary.
| annotDict | Dictionary to check. | |
| fieldName | Field name to search. | |
| fieldValue | New value for this fieldName. |
Sets new value of given fieldName field and returns true if this property was replaced, false if it was added.
Referenced by pdfobjects::CPageAnnots::add(), pdfobjects::utils::LinkAnnotInitializer::operator()(), and pdfobjects::utils::TextAnnotInitializer::operator()().
| bool pdfobjects::utils::checkLinearized | ( | StreamWriter & | stream, | |
| CXref * | xref, | |||
| Ref * | ref | |||
| ) |
Checks whether given stream is linearized.
| stream | Pdf stream to read (from the file begin). | |
| xref | XRef instance. | |
| ref | Pointer to reference where to set object and generation number. |
Searches first indirect object in the stream from the begining and if it is dictionary, checks whether it contains Linearized version entry. If so returns true and if given ref is not NULL, sets object and generation number. Otherwise just returns false and doesn't care for ref parameter.
This method doesn't check whether credentials are set properly. You have to do it before it is called.
Referenced by pdfobjects::utils::Delinearizator::Delinearizator(), and pdfobjects::XRefWriter::XRefWriter().
| void pdfobjects::utils::complexValueFromXpdfObj | ( | IProperty & | ip, | |
| const Object & | obj, | |||
| T | val | |||
| ) | [inline] |
| void pdfobjects::utils::complexValueFromXpdfObj | ( | IProperty & | ip, | |
| const ::Object & | obj, | |||
| T | val | |||
| ) | [inline] |
Save real xpdf object value to val.
| ip | IProperty that will be initialized by obj. | |
| obj | Xpdf object which holds the value. | |
| val | Variable where the value will be stored. |
| template void pdfobjects::utils::complexValueFromXpdfObj< pArray, CArray::Value & > | ( | IProperty & | ip, | |
| const Object & | obj, | |||
| CArray::Value & | val | |||
| ) |
| template void pdfobjects::utils::complexValueFromXpdfObj< pDict, CDict::Value & > | ( | IProperty & | ip, | |
| const Object & | obj, | |||
| CDict::Value & | val | |||
| ) |
| void pdfobjects::utils::complexValueToString | ( | const typename T::Value & | val, | |
| std::string & | str | |||
| ) | [inline] |
Return complex xpdf object (null,number,string...) in string representation.
REMARK: It is a template function because I think stream won't be converted to string as easily as a dictionary. So we specialize these function for pArray and pDict.
| val | that will be converted to string. | |
| str | string |
| void pdfobjects::utils::complexValueToString< CArray > | ( | const CArray::Value & | val, | |
| string & | str | |||
| ) | [inline] |
| void pdfobjects::utils::complexValueToString< CDict > | ( | const CDict::Value & | val, | |
| string & | str | |||
| ) | [inline] |
| unsigned char * pdfobjects::utils::convertStreamToDecodedData | ( | const Object & | obj, | |
| size_t & | size | |||
| ) |
Helper function for removing filters from the given stream object.
| obj | Stream object. | |
| size | Size of returned buffer. |
If the given obj used some filters, they are all decoded to get orignal data and the stream dictionary is updated so that it doesn't contain any filters.
Stream object stored in the given obj is not touched (because it doesn't give much sense - it returns decoded data anyway, it doesn't use dictionary to find out how to decode). Nevertheless this operation may be considered harmfull for later usage of given the object in the xpdf code paths!
References bufferFromStream(), debug::DBG_DBG, xpdf::freeXpdfObject(), and utilsPrintDbg.
Referenced by pdfobjects::utils::ZlibFilterStreamWriter::deflate().
| void pdfobjects::utils::createIndirectObjectStringFromString | ( | const IndiRef & | rf, | |
| const std::string & | val, | |||
| std::string & | output | |||
| ) |
Create text representation of an indirect object from string and IndiRef.
| rf | IndiRef. | |
| val | Value of an object. | |
| output | Output string. |
References pdfobjects::Specification::INDIRECT_FOOTER, and pdfobjects::Specification::INDIRECT_HEADER.
Referenced by writeObject().
| IProperty* pdfobjects::utils::createObjFromXpdfObj | ( | const ::Object & | obj | ) |
Creates CObject* from xpdf object.
| obj | Xpdf object from which the object will be created. Parameter to CObject* constructor. |
| IProperty* pdfobjects::utils::createObjFromXpdfObj | ( | boost::shared_ptr< CPdf > | pdf, | |
| const ::Object & | obj, | |||
| const IndiRef & | ref | |||
| ) |
Creates CObject* from xpdf object.
| Pdf in which the created object will live. Parameter to CObject* constructor. | ||
| obj | Xpdf object from which the object will be created. Parameter to CObject* constructor. | |
| ref | Indirect reference number of this object (or its parent). |
| IProperty* pdfobjects::utils::createObjFromXpdfObj | ( | const Object & | obj | ) |
| IProperty* pdfobjects::utils::createObjFromXpdfObj | ( | boost::shared_ptr< CPdf > | pdf, | |
| const Object & | obj, | |||
| const IndiRef & | ref | |||
| ) |
| void pdfobjects::utils::dictFromXpdfObj | ( | CDict & | resultDict, | |
| ::Object & | dict | |||
| ) |
This function is a slower equivalent to complexValueFromXpdfObj. But on the other hand, complexValueFromXpdfObj() needs inner dictionary container that we do not have always access to.
| resultDict | Dictionary. | |
| dict | Xpdf object from which we init dictionary. |
References pdfobjects::CDict::addProperty(), createObjFromXpdfObj(), debug::DBG_DBG, pdfobjects::XPdfObjectFactory::getInstance(), pdfobjects::CDict::getPropertyCount(), and utilsPrintDbg.
Referenced by pdfobjects::CInlineImage::CInlineImage().
| boost::shared_ptr< CDict > pdfobjects::utils::findPageDict | ( | const boost::shared_ptr< CPdf > & | pdf, | |
| const boost::shared_ptr< IProperty > & | pagesDict, | |||
| size_t | startPos, | |||
| size_t | pos, | |||
| PageTreeNodeCountCache * | cache | |||
| ) |
Helper method to find page at certain position.
| Pdf instance where to search. | ||
| pagesDict | Reference to or Page or Pages dictionary representing page node (see Pdf standard notes). | |
| startPos | Starting position for searching (see note below). | |
| pos | Page position (starting from 1) to find. | |
| cache | Cache for reference to page count mapping. |
Method recursively goes through page subtree starting with given page tree node until given page position is found or no such position can be found. If position can't be found under given page node, exception is thrown.
If given pagesDict is reference, uses CPdf::getIndirectProperty to get target indirect object, which should be a dictionary (otherwise throws ElementBadTypeException).
Note that this function is not able to handle cycles in page tree and if any occures, endless loop will happen.
startPos stands for position of pagesDict in whole page tree. In fact it is position of first leaf node in subtree.
Pdf standard notes:
Pdf tree structure contains of two types of page dictionaries.
This structure is rather complex but enables effective way to access arbitrary page in short time (some applications provide balanced tree form to enable very effective access).
Implementation notes:
Function tries to find page also in page tree structure which doesn't follow pdf specification. All wierd page tree elements are ignored and just those which may stand for intermediate or leaf nodes are condidered. Also doesn't use Count or Parent field information during searching. Uses getKidsCount function to get intermediate leaf nodes count. getKidsCount method requieres also cache which stores already known nodes to their counts mapping. This function just delegates given cache parameter to getPageCount and doesn't care for it much more. If it is NULL, it is not used.
Usage notes:
If searching from begining, page tree root should be used as pagesDict parameter and startPos set to 1.
Example: shared_ptr<CDict> pageTreeRoot=getPageTreeRoot(pdf); if(pageTreeRoot.get()) findPageDict(pdf, pageTreeRoot, 1, posToSearch, NULL);
Searching can start also from different intermediate node than root, but startPos has to be correct position of this node in the tree (same value as returned by getNodePosition method applied on such node). This usage can be used for searching optimization when just part of the tree is searched.
| PageNotFoundException | if given position couldn't be found under subtree defined by pagesDict. | |
| ElementBadTypeException | if pagesDict is not dictionary or reference to dictionary. |
Referenced by pdfobjects::CPdf::getPage(), pdfobjects::CPdf::insertPage(), and pdfobjects::CPdf::removePage().
| void pdfobjects::utils::getAllChildrenOfPdfObject | ( | boost::shared_ptr< CDict > | topdict, | |
| Container & | cont | |||
| ) | [inline] |
Get all children of a tree like structre of pdf objects with, "Prev", Next", "First" dictionary entries. This function can be used e.g. for getting all outlines.
| topdict | Top level dictionary (it won't be included in the cont). | |
| cont | Output container of all children. |
Referenced by pdfobjects::CPdf::getOutlines().
| boost::shared_ptr<CArray> pdfobjects::utils::getCArrayFromDict | ( | IP & | ip, | |
| const std::string & | key | |||
| ) | [inline] |
Get array from dictionary. If it is an indirect object, fetch the object.
| boost::shared_ptr<CDict> pdfobjects::utils::getCDictFromDict | ( | boost::shared_ptr< CDict > | dict, | |
| const std::string & | key | |||
| ) | [inline] |
Get dictionary from dictionary. If it is an indirect object, fetch the object.
| boost::shared_ptr<CDict> pdfobjects::utils::getCDictFromDict | ( | IP & | ip, | |
| const std::string & | key | |||
| ) | [inline] |
Get dictionary from dictionary. If it is an indirect object, fetch the object.
Referenced by pdfobjects::CPageFonts::addSystemType1Font(), pdfobjects::CPageFonts::getFontIdsAndNames(), and pdfobjects::CPdf::getOutlines().
| boost::shared_ptr<CType> pdfobjects::utils::getCObjectFromRef | ( | const IndiRef & | ref, | |
| const boost::shared_ptr< CPdf > & | ||||
| ) | [inline] |
Returns cobjects from given reference and pdf.
| ref | Indirect reference. | |
| CPdf instance where to fetch. |
Calls getIndirectProperty on given pdf and cast returned indirect object to given CType (if it has correct type CType::type).
| ElementBadTypeException | if indirect object is not CType instance. |
| boost::shared_ptr<CType> pdfobjects::utils::getCObjectFromRef | ( | const boost::shared_ptr< IProperty > & | refProp | ) | [inline] |
Returns cobjects from given reference property.
| refProp | Reference property (must be pRef typed). |
Gets reference value from property and dereferences indirect object from it. Uses refProp's pdf for dereference (so it has to be valid). Checks target object type and if it is correct (CType::type), casts it to given CType (uses IProperty::getSmartCObjectPtr).
| ElementBadTypeException | if refProp is not CRef instance or indirect object is not CType instance. |
References pdfobjects::isRef().
| boost::shared_ptr<CStream> pdfobjects::utils::getCStreamFromArray | ( | IP & | ip, | |
| size_t | pos | |||
| ) | [inline] |
Get stream from array. If it is CRef fetch the object pointed at.
Referenced by pdfobjects::CPageContents::parse().
| boost::shared_ptr<CStream> pdfobjects::utils::getCStreamFromDict | ( | IP & | ip, | |
| const std::string & | key | |||
| ) | [inline] |
Get stream from dictionary. If it is CRef fetch the object pointed at.
| boost::shared_ptr< CDict > pdfobjects::utils::getDictFromRef | ( | CPdf & | pdf, | |
| IndiRef | ref | |||
| ) |
Gets dictionary from reference and pdf instance.
| Pdf istance. | ||
| ref | Indirect reference. |
Uses CPdf::getIndirectProperty to get dereferenced object from given reference on given pdf instance. Checks object type and if it is CDict, returns it, otherwise throws an axception.
| ElementBadTypeException | if indirect object is not CDict instance. |
| boost::shared_ptr< CDict > pdfobjects::utils::getDictFromRef | ( | boost::shared_ptr< IProperty > | refProp | ) |
Gets dictionary from reference property.
| refProp | Reference property (must be pRef typed). |
Gets reference value from property and dereferences indirect object from it. Uses refProp's pdf for dereference. Finaly casts (if indirect is dictionary) to CDict and returns.
| ElementBadTypeException | if refProp is not CRef instance or indirect object is not CDict instance. |
| std::string pdfobjects::utils::getDictType | ( | boost::shared_ptr< CDict > | dict | ) |
Gets type of the dictionary.
| dict | Dictionary wrapped in smart pointer. |
Tries to get Type field from dictionary and returns its string value. If not present, returns an empty string.
| CReal::Value pdfobjects::utils::getDoubleFromArray | ( | const IP & | ip, | |
| size_t | position | |||
| ) | [inline] |
Get double from array.
References getIntFromArray().
Referenced by pdfobjects::CPageDisplay::getMediabox(), getRectangleFromProperty(), and gui::PageViewMode_Annotations::getRectOfAnnotation().
| double pdfobjects::utils::getDoubleFromDict | ( | const IP & | ip, | |
| const std::string & | id | |||
| ) | [inline] |
Get double from dictionary.
References getIntFromDict().
| double pdfobjects::utils::getDoubleFromIProperty | ( | const boost::shared_ptr< IProperty > & | ip | ) | [inline] |
Get double from ip.
References pdfobjects::isInt().
Referenced by pdfobjects::CPageContents::Tm::operator=().
| int pdfobjects::utils::getFiltersFromStream | ( | const Object & | obj, | |
| std::vector< std::string > & | filters | |||
| ) |
Helper function to get all filters from the stream object.
| obj | Stream object. | |
| filters | Container for filter names. |
Referenced by pdfobjects::utils::ZlibFilterStreamWriter::supportObject().
| CInt::Value pdfobjects::utils::getIntFromArray | ( | const IP & | ip, | |
| size_t | position | |||
| ) | [inline] |
Get int from array.
Referenced by getDoubleFromArray().
| int pdfobjects::utils::getIntFromDict | ( | std::string | name, | |
| boost::shared_ptr< CDict > | dict | |||
| ) |
Helper method for getting int property value from dictionary.
| name | Name of the property in the dictionary. | |
| dict | Dictionary where to search. |
Gets property according name. Checks property type and if it is realy pInt, gets its int value which is returned.
| ElementNotFoundException | if property is not found. | |
| ElementBadTypeException | if property is found but doesn't contain integer value. |
| int pdfobjects::utils::getIntFromDict | ( | const IP & | ip, | |
| const std::string & | id | |||
| ) | [inline] |
Get int from dictionary.
Referenced by getDoubleFromDict().
| int pdfobjects::utils::getIntFromIProperty | ( | const boost::shared_ptr< IProperty > & | ip | ) | [inline] |
Get int from ip.
| boost::shared_ptr< IProperty > pdfobjects::utils::getIPropertyFromDate | ( | const tm * | time | ) |
Creates property with correct pdf time representation.
| time | Time to convert. |
Created property is an string with ASN.1 defined in ISO/IEC 8824 format used in pdf (see PDF specification page 133 for more information).
| boost::shared_ptr< IProperty > pdfobjects::utils::getIPropertyFromRectangle | ( | const libs::Rectangle & | rect | ) |
Creates property with correct pdf Rectangle representation.
| rect | Rectangle to convert. |
Created property is an array with four elements (see PDF specification page 134 for more information).
| size_t pdfobjects::utils::getKidsCount | ( | const boost::shared_ptr< IProperty > & | interNodeProp, | |
| PageTreeNodeCountCache * | cache | |||
| ) | throw () |
Calculates number of direct pages under given node property.
| interNodeProp | Page tree node property (must be dictionary or reference to dictionary). | |
| cache | Cache with node reference to leaf page count (if NULL. it is not used). |
Checks whether given node is LeafNode and if so, immediatelly returns with 1 (leaf contains one direct page). Otherwise tries to get node dictionary from given property. If not able to do so, returns 0, because this node is probably invalid and so it can't contain any direct page node. Then checks whether given cache parameter is non NULL and if so checks cached value for given node (uses getCachedValue function). If cache entry exists for this node, uses cached value. Otherwise collects all Kids elements from dictionary (uses getKidsFromInterNode function) and calls this function recursively on each reference element. Collected number is returned and if cache is non NULL also caches value (uses updateCache function).
Note that this function never throws.
Referenced by pdfobjects::CPdf::consolidatePageTree(), pdfobjects::CPdf::getPageCount(), and searchTreeNode().
| void pdfobjects::utils::getKidsFromInterNode | ( | const boost::shared_ptr< CDict > & | interNodeDict, | |
| Container & | container | |||
| ) | throw () [inline] |
Collects all kids elements from internode dictionary.
| interNodeDict | Intermediate node dictionary. | |
| container | Container where to store kids. |
Clears given container at first. Gets Kids array from given dictionary and adds all its elements to given container. If not able to do so, immediatelly returns. Given container is empty if no kid is found (or any other problem occures).
Container template type must store shared_ptr<IProperty> types and support clear and push_back methods.
Note that this function never throws.
Referenced by pdfobjects::CPdf::consolidatePageTree(), and searchTreeNode().
| std::string pdfobjects::utils::getNameFromDict | ( | std::string | name, | |
| boost::shared_ptr< CDict > | dict | |||
| ) |
Helper method for getting name property value from dictionary.
| name | Name of the property in the dictionary. | |
| dict | Dictionary where to search. |
Gets property according name. Checks property type and if it is realy pName, gets its string value which is returned.
| ElementNotFoundException | if property is not found. | |
| ElementBadTypeException | if property is found but doesn't contain string value. |
| std::string pdfobjects::utils::getNameFromDict | ( | const IP & | ip, | |
| const std::string & | id | |||
| ) | [inline] |
Get name from dictionary.
Referenced by pdfobjects::CPageFonts::getFontIdsAndNames().
| std::string pdfobjects::utils::getNameFromIProperty | ( | const boost::shared_ptr< IProperty > & | ip | ) | [inline] |
Get name from ip.
| size_t pdfobjects::utils::getNodePosition | ( | const boost::shared_ptr< CPdf > & | pdf, | |
| const boost::shared_ptr< IProperty > & | node, | |||
| PageTreeNodeCountCache * | cache | |||
| ) |
Gets position of given node.
| Pdf where to examine. | ||
| node | Node to find (CRef or CDict instances). | |
| cache | Cache for reference to page count mapping. |
Starts searching for given node from root of the page tree (returned from getPageTreeRoot function). Uses recursive searchTreeNode function for searching and provides just error handling wrapper to this function. searchTreeNode reqieres also cache which stores already known nodes to their counts mapping. This function just delegates given cache parameter to getPageCount and doesn't care for it much more. If it is NULL, it is not used.
Prefer to use this function instead of searchTreeNode if you are not sure you know what you are doing.
| PageNotFoundException | If node can't be found. | |
| ElementBadTypeException | If given node is not dictionary or reference to dictionary. | |
| AmbiguousPageTreeException | if node position can't be determined bacause of page tree ambiguity (see searchTreeNode for more information). |
| size_t pdfobjects::utils::getNodePosition | ( | const shared_ptr< CPdf > & | pdf, | |
| const shared_ptr< IProperty > & | node, | |||
| PageTreeNodeCountCache * | cache | |||
| ) |
References debug::DBG_DBG, debug::DBG_ERR, getPageTreeRoot(), pdfobjects::isRef(), pdfobjects::pDict, pdfobjects::pRef, searchTreeNode(), and utilsPrintDbg.
Referenced by pdfobjects::CPdf::unregisterPageTreeObservers().
| PageTreeNodeType pdfobjects::utils::getNodeType | ( | const boost::shared_ptr< IProperty > & | nodeProp | ) | throw () |
Checks given node for its page tree type.
| nodeProp | Node property (must be dictionary or reference to dictionary). |
Gets node dictionary in first step (either directly from parameter or dereference). If not able to get it, returns ErrorNode type. Then checks whether node dictionary is same as Page tree root node and if so, returns RootNode type. If not able to get root node, returns UnknownNode.
In first step compares dictionary with pageTreeRoot dictionary. If they are same (uses == operator), returns RootNode. Otherwise checks for Type field in node dictionary and if present, checks its value. It must be name object. If so and value is Page, returns LeafNode, or if value is Pages, returns InterNode. Otherwise returns (also if Type field type is not name), returns UnknownNode.
Finally tries to determine node type from existing fields. If dictionary contains Kids array, it is considered to be InterNode. Otherwise returns UnknownNode.
Note that this function never throws.
Referenced by pdfobjects::CPdf::consolidatePageTree(), and searchTreeNode().
| boost::shared_ptr< CDict > pdfobjects::utils::getPageTreeRoot | ( | const boost::shared_ptr< CPdf > & | ) |
Gets page tree root node dictionary.
| Pdf where to search. |
Gets Pages field from pdf dictionary and dereference it to dictionary. If it is not reference or target object is not a dictionary, returns NULL dictionary.
Note that this function never throws.
Referenced by getNodePosition(), pdfobjects::CPdf::getPage(), pdfobjects::CPdf::getPageCount(), pdfobjects::CPdf::initRevisionSpecific(), pdfobjects::CPdf::insertPage(), pdfobjects::CPdf::removePage(), and pdfobjects::CPdf::unregisterPageObservers().
| void pdfobjects::utils::getPropertyId | ( | const boost::shared_ptr< Complex > & | parent, | |
| const boost::shared_ptr< IProperty > & | child, | |||
| Container & | container | |||
| ) | throw () [inline] |
Gets all identificators of property in parent complex type.
| parent | Complex value where to search. | |
| child | Property to search. | |
| container | Container, where to place all identificators (array indexes). |
Uses CObjectComplex::forEach method with IdCollector functor to collect all ids to given container.
Complex template parameter stands for type of CObjectComplex where to search. This type has to provide typedef for propertyId and getAllPropertyNames, getProperty methods.
Container template parameter stands for type of storage where to place found indexes. This has to provide clear and push_back methods. Given container is cleared at start.
References debug::DBG_DBG, and utilsPrintDbg.
| void pdfobjects::utils::getRectangleFromProperty | ( | const boost::shared_ptr< IProperty > | prop, | |
| libs::Rectangle & | rect | |||
| ) |
Gets rectangle value from given property.
| prop | Array property with exactly 4 elements. | |
| rect | Rectangle which will be filled with values stored in given property. |
Array property is transformed into the given rect object.
| CObjBadValue | if given property has not valid rectangle representation. |
| void pdfobjects::utils::getRectangleFromProperty | ( | const shared_ptr< IProperty > | prop, | |
| libs::Rectangle & | rect | |||
| ) |
References getDoubleFromArray(), and pdfobjects::isArray().
| boost::shared_ptr< IProperty > pdfobjects::utils::getReferencedObject | ( | boost::shared_ptr< IProperty > | ip | ) |
If the object is a reference, fetch the "real" object
| ip | IProperty. |
Referenced by pdfobjects::CStream::getLength(), getSimpleValueFromDict(), getTypeFromArray(), getTypeFromDictionary(), pdfobjects::CPageContents::parse(), pdfobjects::CPageContents::remove(), setSimpleValueInArray(), and setSimpleValueInDict().
| CRef::Value pdfobjects::utils::getRefFromArray | ( | const IP & | ip, | |
| size_t | position | |||
| ) | [inline] |
Get ref from array.
Referenced by pdfobjects::CPageContents::remove().
| IndiRef pdfobjects::utils::getRefFromDict | ( | std::string | name, | |
| boost::shared_ptr< CDict > | dict | |||
| ) |
Helper method for getting reference property value from dictionary.
| name | Name of the property in the dictionary. | |
| dict | Dictionary where to search. |
Gets property according name. Checks property type and if it is realy pRef, gets its IndiRef value which is returned.
| ElementNotFoundException | if property is not found. | |
| ElementBadTypeException | if property is found but doesn't contain reference value. |
| ItemType::Value pdfobjects::utils::getSimpleValueFromArray | ( | const boost::shared_ptr< IProperty > & | ip, | |
| size_t | position | |||
| ) | [inline] |
Gets simple value from array. Checks type of given ip and if it is array, casts it to CArray and gets value of property with given position (uses getSimpleValueFromArray with CArray parameter).
| ip | Array property. | |
| position | Array index. |
| ElementBadTypeException | if given property is not CArray or property with given index is not ItemType. |
References pdfobjects::isArray().
| SimpleValueType pdfobjects::utils::getSimpleValueFromArray | ( | const boost::shared_ptr< IProperty > & | array, | |
| size_t | position | |||
| ) | [inline] |
Get simple value from array.
| array | Array. | |
| position | Position in the array. |
References pdfobjects::isArray().
| ItemType::Value pdfobjects::utils::getSimpleValueFromArray | ( | const boost::shared_ptr< CArray > & | array, | |
| size_t | position | |||
| ) | [inline] |
Gets simple value from array. Gets property from given position and uses getValueFromSimple to get its simple value.
| array | Array property. | |
| position | Index in array of property. |
References debug::DBG_DBG, and utilsPrintDbg.
| SimpleValueType pdfobjects::utils::getSimpleValueFromArray | ( | const boost::shared_ptr< CArray > & | array, | |
| size_t | position | |||
| ) | [inline] |
Get simple value from array.
| array | Array. | |
| position | Position in the array. |
References debug::DBG_DBG, and utilsPrintDbg.
| ItemType::Value pdfobjects::utils::getSimpleValueFromDict | ( | const boost::shared_ptr< IProperty > & | ip, | |
| const std::string & | id | |||
| ) | [inline] |
Get simple value from dictionary.
| dict | Dictionary. | |
| id | Position in the dictionary. |
References pdfobjects::isDict().
| SimpleValueType pdfobjects::utils::getSimpleValueFromDict | ( | const boost::shared_ptr< IProperty > & | dict, | |
| const std::string & | id | |||
| ) | [inline] |
Get simple value from dictionary.
| dict | Dictionary. | |
| id | Position in the dictionary. |
References pdfobjects::isDict().
| ItemType::Value pdfobjects::utils::getSimpleValueFromDict | ( | const CDict & | dict, | |
| const std::string & | id | |||
| ) | [inline] |
Get simple value from dictionary.
| dict | Dictionary. | |
| id | Position in the dictionary. |
References debug::DBG_DBG, pdfobjects::CDict::getProperty(), getReferencedObject(), and utilsPrintDbg.
| SimpleValueType pdfobjects::utils::getSimpleValueFromDict | ( | const CDict & | dict, | |
| const std::string & | id | |||
| ) | [inline] |
Get simple value from dictionary.
| dict | Dictionary. | |
| id | Position in the dictionary. |
References pdfobjects::CDict::getProperty(), and getReferencedObject().
| ItemType::Value pdfobjects::utils::getSimpleValueFromDict | ( | const boost::shared_ptr< CDict > & | dict, | |
| CDict::PropertyId | id | |||
| ) | [inline] |
Get simple value from dictionary.
Uses getReferencedObject to property with given id to get target property (if it is reference) and getValueFromSimple with target property.
| dict | Dictionary. | |
| id | Position in the dictionary. |
References debug::DBG_DBG, getReferencedObject(), and utilsPrintDbg.
| SimpleValueType pdfobjects::utils::getSimpleValueFromDict | ( | const boost::shared_ptr< CDict > & | dict, | |
| const std::string & | id | |||
| ) | [inline] |
Get simple value from dictionary.
| dict | Dictionary. | |
| id | Position in the dictionary. |
Get simple value from dictionary.
| dict | Dictionary. | |
| id | Position in the dictionary. |
References getReferencedObject().
| CString::Value pdfobjects::utils::getStringFromArray | ( | const IP & | ip, | |
| size_t | position | |||
| ) | [inline] |
Get string from array.
| std::string pdfobjects::utils::getStringFromDict | ( | std::string | name, | |
| boost::shared_ptr< CDict > | dict | |||
| ) |
Helper method for getting string property value from dictionary.
| name | Name of the property in the dictionary. | |
| dict | Dictionary where to search. |
Gets property according name. Checks property type and if it is realy pString, gets its string value which is returned.
| ElementNotFoundException | if property is not found. | |
| ElementBadTypeException | if property is found but doesn't contain string value. |
| std::string pdfobjects::utils::getStringFromDict | ( | const IP & | ip, | |
| const std::string & | id | |||
| ) | [inline] |
Get string from dictionary.
| std::string pdfobjects::utils::getStringFromIProperty | ( | const boost::shared_ptr< IProperty > & | ip | ) | [inline] |
Get string from ip.
Referenced by pdfobjects::TextSimpleOperator::getRawText().
| void pdfobjects::utils::getStringFromXpdfStream | ( | std::string & | str, | |
| ::Object & | obj | |||
| ) |
Get string from xpdf stream object.
| str | Output string. | |
| obj | Xpdf stream object. |
| boost::shared_ptr<ItemType> pdfobjects::utils::getTypeFromArray | ( | const boost::shared_ptr< IProperty > & | ip, | |
| size_t | pos | |||
| ) | [inline] |
Get iproperty casted to specific type from array.
Checks type of given property and if it pArray, casts it to CArray and uses getTypeFromArray with CArray parameter.
| array | Array. | |
| id | Position in the array. |
| ElementBadTypeException | if given property is not an array or property at given position doesn't have ItemType type. |
References pdfobjects::isArray().
| boost::shared_ptr< ItemType > pdfobjects::utils::getTypeFromArray | ( | const boost::shared_ptr< IProperty > & | array, | |
| size_t | pos | |||
| ) | [inline] |
Get iproperty casted to specific type from array.
| array | Array. | |
| pos | Position in the array. |
References pdfobjects::isArray().
| boost::shared_ptr<ItemType> pdfobjects::utils::getTypeFromArray | ( | const boost::shared_ptr< CArray > & | array, | |
| size_t | pos | |||
| ) | [inline] |
Get iproperty casted to specific type from array.
| array | Array. | |
| id | Position in the array. |
| ElementBadTypeException | if property doesn't have ItemType type. |
References debug::DBG_DBG, getReferencedObject(), and utilsPrintDbg.
| boost::shared_ptr< ItemType > pdfobjects::utils::getTypeFromArray | ( | const boost::shared_ptr< CArray > & | array, | |
| size_t | pos | |||
| ) | [inline] |
Get iproperty casted to specific type from array.
| array | Array. | |
| pos | Position in the array. |
References debug::DBG_DBG, getReferencedObject(), and utilsPrintDbg.
| boost::shared_ptr<ItemType> pdfobjects::utils::getTypeFromDictionary | ( | const boost::shared_ptr< IProperty > & | ip, | |
| CDict::PropertyId | key | |||
| ) | [inline] |
Gets property from dictionary.
Checks type of given ip. If it is CDict instance, casts it and calls getTypeFromDictionary with CDict parameter.
| ip | Dictionary property. | |
| key | Property name. |
| ElementBadTypeException | if given ip is not CDict instance or target property has not ItemType. |
References pdfobjects::isDict().
| boost::shared_ptr< ItemType > pdfobjects::utils::getTypeFromDictionary | ( | const boost::shared_ptr< IProperty > & | dict, | |
| const std::string & | key | |||
| ) | [inline] |
Get iproperty casted to specific type from dictionary.
| dict | Dictionary. | |
| key | Position in the dictionary. |
References pdfobjects::isDict().
| boost::shared_ptr<ItemType> pdfobjects::utils::getTypeFromDictionary | ( | const boost::shared_ptr< CDict > & | dict, | |
| CDict::PropertyId | key | |||
| ) | [inline] |
Get property from dictionary.
If property is reference, dereferences it (uses getReferencedObject function).
| dict | Dictionary property. | |
| key | Property name. |
| ElementBadTypeException | if found (dereferenced) property has different type than given. |
References debug::DBG_DBG, getReferencedObject(), and utilsPrintDbg.
| boost::shared_ptr< ItemType > pdfobjects::utils::getTypeFromDictionary | ( | const boost::shared_ptr< CDict > & | dict, | |
| const std::string & | key | |||
| ) | [inline] |
Get iproperty casted to specific type from dictionary.
| dict | Dictionary. | |
| key | Position in the dictionary. |
References debug::DBG_DBG, getReferencedObject(), and utilsPrintDbg.
| ItemType::Value pdfobjects::utils::getValueFromSimple | ( | const boost::shared_ptr< IProperty > & | ip | ) | [inline] |
Get simple value from simple cobject.
Given property must have correct type (ItemType::type).
| ip | IProperty. |
References debug::DBG_DBG, and utilsPrintDbg.
| Value pdfobjects::utils::getValueFromSimple | ( | const boost::shared_ptr< IProperty > & | ip | ) | [inline] |
Get simple value from simple cobject.
| ip | IProperty. |
References debug::DBG_DBG, and utilsPrintDbg.
| ::XRef* pdfobjects::utils::getXRef | ( | boost::shared_ptr< IProperty > | ip | ) |
Get xref from an object.
| ::XRef* pdfobjects::utils::getXRef | ( | shared_ptr< IProperty > | ip | ) |
Referenced by pdfobjects::CStreamsXpdfReader< Container >::open().
| bool pdfobjects::utils::isBinaryString | ( | const std::string & | val | ) |
| bool pdfobjects::utils::isEncrypted | ( | const boost::shared_ptr< CPdf > & | ) |
Checks whether file content is encrypted.
| Pdf instance to check. |
Simple helper which asks its cross reference table.
Referenced by pdfobjects::CPdf::changeIndirectProperty(), pdfobjects::XRefWriter::changeObject(), pdfobjects::XRefWriter::changeTrailer(), pdfobjects::XRefWriter::cloneRevision(), pdfobjects::XRefWriter::createObject(), and pdfobjects::utils::PdfDocumentWriter::writeDocument().
| bool pdfobjects::utils::isLatestRevision | ( | const XRefWriter & | xref | ) |
Checks whether the current revision is the most recent one.
| xref | Xref. |
Referenced by pdfobjects::CPdf::canChange(), pdfobjects::XRefWriter::changeObject(), pdfobjects::XRefWriter::changeTrailer(), pdfobjects::XRefWriter::createObject(), pdfobjects::XRefWriter::fetch(), pdfobjects::CPdf::getMode(), pdfobjects::XRefWriter::getTrailerDict(), pdfobjects::XRefWriter::knowsRef(), pdfobjects::XRefWriter::reserveRef(), and pdfobjects::CPdf::save().
| bool pdfobjects::utils::isNodeDescendant | ( | const boost::shared_ptr< CPdf > & | pdf, | |
| const IndiRef & | parent, | |||
| const boost::shared_ptr< CDict > & | child | |||
| ) |
Checks if given child is descendant of node with given reference.
| Pdf where to resolv referencies. | ||
| parent | Reference of the parent. | |
| child | Dictionary of page(s) node. |
Checks if child's Parent field has same reference as given one as parent parameter. If yes then child dictionary is descendant of node with parent reference. If not, dereference child's parent and continues in recursion using dereferenced parent dictionary as new child for recursion call.
NOTE: this method doesn't perform any checking of parameters and doesn't work if Parent property has not valid value (according page tree state).
| bool pdfobjects::utils::isNodeDescendant | ( | const boost::shared_ptr< CPdf > & | pdf, | |
| const IndiRef & | parent, | |||
| const shared_ptr< CDict > & | child | |||
| ) |
References pdfobjects::isRef().
| boost::shared_ptr<FilterStreamWriter> pdfobjects::utils::lookupFilterStreamWriter | ( | const Object & | obj, | |
| FilterStreamWriter::WritersList & | filters | |||
| ) |
Helper function to find the first filter writer which supports given object.
| obj | Stream object to write. | |
| filters | Container of supported filter writers. |
Referenced by pdfobjects::utils::FilterStreamWriter::getInstance().
| std::string pdfobjects::utils::makeHexString | ( | Iter | it, | |
| Iter | end | |||
| ) | [inline] |
| std::string pdfobjects::utils::makeNamePdfValid | ( | const char * | str | ) | [inline] |
Make name valid.
Beginning with PDF 1.2, any character except null (character code 0) may be included in a name by writing its 2-digit hexadecimal code, preceded by the number sign character (#); see implementation notes 3 and 4 in Appendix H. This syntax is required to represent any of the delimiter or white-space characters or the number sign character itself; it is recommended but not required for characters whose codes are outside the range 33 (!) to 126 (~). The examples shown in Table 3.3 are valid literal names in PDF 1.2 and later.
| str | Character string. |
References makeNamePdfValid().
| std::string pdfobjects::utils::makeNamePdfValid | ( | Iter | it, | |
| Iter | end | |||
| ) | [inline] |
Make name valid.
Beginning with PDF 1.2, any character except null (character code 0) may be included in a name by writing its 2-digit hexadecimal code, preceded by the number sign character (#); see implementation notes 3 and 4 in Appendix H. This syntax is required to represent any of the delimiter or white-space characters or the number sign character itself; it is recommended but not required for characters whose codes are outside the range 33 (!) to 126 (~). The examples shown in Table 3.3 are valid literal names in PDF 1.2 and later.
| it | Start iterator. | |
| end | End iterator. |
Referenced by makeNamePdfValid().
| void pdfobjects::utils::makeStreamPdfValid | ( | Iter | it, | |
| Iter | end, | |||
| std::string & | out | |||
| ) | [inline] |
Make stream pdf valid.
Not needed now.
| it | Start insert iterator. | |
| end | End iterator. | |
| out | Output valid string. |
Referenced by pdfobjects::CStream::setBuffer().
| std::string pdfobjects::utils::makeStringPdfValid | ( | GString * | str | ) | [inline] |
Make string pdf valid.
Any characters may appear in a string except unbalanced parentheses and the backslash, which must be treated specially.
| str | Character string. |
References makeStringPdfValid().
| std::string pdfobjects::utils::makeStringPdfValid | ( | Iter | it, | |
| Iter | end | |||
| ) | [inline] |
Make string pdf valid.
Any characters may appear in a string except unbalanced parentheses and the backslash, which must be treated specially.
This includes also (NUL) character, therefore we can't use standard str* functions for strings.
| it | Start iterator. | |
| end | End iterator. |
Referenced by makeStringPdfValid().
| bool pdfobjects::utils::objHasParent | ( | const IProperty & | ip | ) |
Returns true if object has a parent.
| ObjInvalidOperation | Thrown when the object does not belong to a valid pdf. |
| ip | IProperty of object. |
| bool pdfobjects::utils::objHasParent | ( | const IProperty & | ip, | |
| boost::shared_ptr< IProperty > & | indiObj | |||
| ) |
Returns true if object has a parent.
| ObjInvalidOperation | Thrown when the object does not belong to a valid pdf. |
| ip | IProperty of object. | |
| indiObj | Out parameter wheren indirect object will be saved, because finding the object can be an expensive operation. |
Referenced by pdfobjects::IProperty::dispatchChange().
| ostream& pdfobjects::utils::operator<< | ( | ostream & | stream, | |
| PageTreeNodeType | nodeType | |||
| ) |
Operator for output stream with PageTreeNodeType enumeration type.
| stream | Stream, where to print. | |
| nodeType | type to print. |
Prints human readable from of page tree node enumeration value.
References ErrorNode, InterNode, LeafNode, RootNode, and UnknownNode.
| void pdfobjects::utils::parseStreamToContainer | ( | T & | container, | |
| const ::Object & | obj | |||
| ) | [inline] |
Parse stream object to a container
| container | Container of characters (e.g. ints). | |
| obj | Stream object. |
| template void pdfobjects::utils::parseStreamToContainer< CStream::Buffer > | ( | CStream::Buffer & | container, | |
| const ::Object & | obj | |||
| ) |
| void pdfobjects::utils::printProperty | ( | boost::shared_ptr< IProperty > | ip, | |
| std::ostream & | out | |||
| ) |
Helper method for property printing.
| ip | Property to print. | |
| out | Output stream, where to print (implicit value is std::cout). |
Gets string representation of given property and dumps it to standard output. Checks whether this functionality is duplicated.
| size_t pdfobjects::utils::searchTreeNode | ( | shared_ptr< const CPdf > | pdf, | |
| shared_ptr< CDict > | superNode, | |||
| shared_ptr< CDict > | node, | |||
| size_t | startValue, | |||
| PageTreeNodeCountCache * | cache | |||
| ) |
Searches node in page tree structure.
| Pdf where to search. | ||
| superNode | Page tree node where to search (may be intermediate or leaf). | |
| node | Node to search for. | |
| startValue | Position of the superNode. | |
| cache | Cache for reference to page count mapping. |
At first checks if node and superNode are same nodes (uses == operator to compare) and if so, returns startPos. Otherwise tries to get node type (uses getNodeType helper function). In Page case (LeafNode) returns with startValue if given nodes are same or 0 (page not found). This the end of recursion. If it is intermediate node, goes through Kids array and recursively calls this method for each element until recursion returns with non 0 result. This means the end of recursion. startValue is actualized for each Kid's element with 0 recursion return value (Leaf node element increases by 1, intermediate node element by getKidsCount value).
If node is found as direct Kids member (this means that reference of target node is direct member of Kids array), then determines if the node position is unambiguous - checks whether reference to the node is unique in Kids array. If not throws exception. This means that searchTreeNode function is not able to definitively determine node's position.
Function tries to find node position also in page tree structure which doesn't follow pdf specification. All wierd page tree elements are ignored and just those which may stand for intermediate or leaf nodes are considered. Also doesn't use Count and Parent fields information during searching.
Uses getKidsCount function internally to get intermediate leaf nodes count. getKidsCount method requieres also cache parameter which stores already known nodes to their counts mapping. This function just delegates given cache parameter to getPageCount and doesn't care for it much more. Note that if parameter is NULL, cache is not used.
| AmbiguousPageTreeException | if page tree is ambiguous and node position can't be determined. |
References debug::DBG_DBG, debug::DBG_WARN, getKidsCount(), getKidsFromInterNode(), getNodeType(), InterNode, pdfobjects::isRef(), LeafNode, and utilsPrintDbg.
Referenced by getNodePosition().
| void pdfobjects::utils::setDoubleInArray | ( | const IP & | ip, | |
| size_t | position, | |||
| double | val | |||
| ) | [inline] |
Set double in array.
References setIntInArray().
| void pdfobjects::utils::setDoubleInDict | ( | const IP & | ip, | |
| const std::string & | name, | |||
| double | val | |||
| ) | [inline] |
Set double in dictioary.
References setIntInDict().
| void pdfobjects::utils::setIntInArray | ( | const IP & | ip, | |
| size_t | position, | |||
| int | val | |||
| ) | [inline] |
Set int in array.
Referenced by setDoubleInArray().
| void pdfobjects::utils::setIntInDict | ( | const IP & | ip, | |
| const std::string & | name, | |||
| int | val | |||
| ) | [inline] |
Set int in dictionary.
Referenced by setDoubleInDict().
| void pdfobjects::utils::setSimpleValueInArray | ( | const IProperty & | ip, | |
| size_t | position, | |||
| const typename ItemType::Value & | val | |||
| ) | [inline] |
Sets simple value to array element. Checks given property type and if it is pArray, casts it to CArray and calls setSimpleValueInArray with CArray parameter.
| ip | Array property. | |
| position | Position of element to set. | |
| val | Simple value to set. |
| ElementBadTypeException | if given property is not CArray instance. |
References pdfobjects::isArray().
| void pdfobjects::utils::setSimpleValueInArray | ( | const IProperty & | array, | |
| size_t | position, | |||
| const Value & | val | |||
| ) | [inline] |
Set simple value in array. If it is a reference, set fetch it and set it to the fetched object.
| array | Array property. | |
| position | Position in the array. | |
| val | Value to be written. |
References pdfobjects::isArray().
| void pdfobjects::utils::setSimpleValueInArray | ( | const CArray & | array, | |
| size_t | position, | |||
| const typename ItemType::Value & | val | |||
| ) | [inline] |
Sets simple value to array element. Uses setValueToSimple function to set property value.
| array | Array property. | |
| position | Position of element to set. | |
| val | Simple value to set. |
References debug::DBG_DBG, pdfobjects::CArray::getProperty(), getReferencedObject(), and utilsPrintDbg.
| void pdfobjects::utils::setSimpleValueInArray | ( | const CArray & | array, | |
| size_t | position, | |||
| const Value & | val | |||
| ) | [inline] |
Set simple value in array. If it is a reference, set fetch it and set it to the fetched object.
| array | Array property. | |
| position | Position in the array. | |
| val | Value to be written. |
References debug::DBG_DBG, pdfobjects::CArray::getProperty(), getReferencedObject(), and utilsPrintDbg.
| void pdfobjects::utils::setSimpleValueInDict | ( | const IProperty & | ip, | |
| CDict::PropertyId | name, | |||
| const typename ItemType::Value & | val | |||
| ) | [inline] |
Set simple value in dictionary. If it is a reference, set fetch it and set it to the fetched object.
| dict | Dict property. | |
| name | Name of property. | |
| val | Value to be written. |
References pdfobjects::isDict().
| void pdfobjects::utils::setSimpleValueInDict | ( | const IProperty & | dict, | |
| const std::string & | name, | |||
| const Value & | val | |||
| ) | [inline] |
Set simple value in dictionary. If it is a reference, set fetch it and set it to the fetched object.
| dict | Dict property. | |
| name | Name of property. | |
| val | Value to be written. |
References pdfobjects::isDict().
| void pdfobjects::utils::setSimpleValueInDict | ( | const CDict & | dict, | |
| CDict::PropertyId | name, | |||
| const typename ItemType::Value & | val | |||
| ) | [inline] |
Sets value of property with given name.
Gets property with given name and dereference (uses getReferencedObject) it (if it is reference) and sets its value (uses setValueToSimple).
| dict | Dictionary. | |
| name | Property name. | |
| val | Value for property. |
References debug::DBG_DBG, pdfobjects::CDict::getProperty(), getReferencedObject(), and utilsPrintDbg.
| void pdfobjects::utils::setSimpleValueInDict | ( | const CDict & | dict, | |
| const std::string & | name, | |||
| const Value & | val | |||
| ) | [inline] |
Set simple value in dictionary. If it is a reference, set fetch it and set it to the fetched object.
| dict | Dict property. | |
| name | Name of property. | |
| val | Value to be written. |
References debug::DBG_DBG, pdfobjects::CDict::getProperty(), getReferencedObject(), and utilsPrintDbg.
| void pdfobjects::utils::setValueToSimple | ( | const boost::shared_ptr< IProperty > & | ip, | |
| const Value & | val | |||
| ) | [inline] |
Set simple value.
| ip | IProperty. | |
| val | Value to set. |
References debug::DBG_DBG, and utilsPrintDbg.
| bool pdfobjects::utils::simpleEquals | ( | const boost::shared_ptr< IProperty > & | val1, | |
| const boost::shared_ptr< IProperty > & | val2 | |||
| ) | throw () [inline] |
Compares two simple values.
| val1 | value to compare. | |
| val2 | value to compare. |
Helper methods for simple value comparing. Uses getValueFromSimple method to get value from property. Simple properties are same if values, which they holds are same.
SimpleClass template parameter stands for property class type (CRef, CInt, ...)
simpleType is property type - constant value returned by getType() method.
NOTE: no checking of parameters is done here.
| void pdfobjects::utils::simpleValueFromString | ( | const std::string & | str, | |
| IndiRef & | val | |||
| ) |
| void pdfobjects::utils::simpleValueFromString | ( | const std::string & | str, | |
| std::string & | val | |||
| ) |
| void pdfobjects::utils::simpleValueFromString | ( | const std::string & | str, | |
| double & | val | |||
| ) |
| void pdfobjects::utils::simpleValueFromString | ( | const std::string & | str, | |
| int & | val | |||
| ) |
| void pdfobjects::utils::simpleValueFromString | ( | const std::string & | str, | |
| bool & | val | |||
| ) |
Parses string to get simple values like int, name, bool etc.
| str | String to be parsed. | |
| val | Desired value. |
| ObjBadValueE | Thrown when the string, can't be parsed correctly. |
Referenced by pdfobjects::CObjectSimple< Tp >::setStringRepresentation().
| void pdfobjects::utils::simpleValueFromXpdfObj | ( | const ::Object & | obj, | |
| T | val | |||
| ) | [inline] |
Save real xpdf object value to val.
| obj | Xpdf object which holds the value. | |
| val | Variable where the value will be stored. |
| void pdfobjects::utils::simpleValueFromXpdfObj | ( | const Object & | obj, | |
| T | val | |||
| ) | [inline] |
| void pdfobjects::utils::simpleValueFromXpdfObj< pNull, NullType & > | ( | const Object & | , | |
| NullType & | ||||
| ) | [inline] |
| void pdfobjects::utils::simpleValueToString | ( | const IndiRef & | val, | |
| std::string & | str | |||
| ) | [inline] |
| void pdfobjects::utils::simpleValueToString | ( | const NullType & | val, | |
| std::string & | str | |||
| ) | [inline] |
| void pdfobjects::utils::simpleValueToString | ( | double | val, | |
| std::string & | str | |||
| ) | [inline] |
| void pdfobjects::utils::simpleValueToString | ( | int | val, | |
| std::string & | str | |||
| ) | [inline] |
| void pdfobjects::utils::simpleValueToString | ( | bool | val, | |
| std::string & | str | |||
| ) | [inline] |
Return simple xpdf object (null,number,string...) in string representation.
REMARK: String can represent more different objects, so we have to distinguish among them. This is done at compile time with use of templates, but because of this we have to make other functions also template.
| val | that will be converted to string. | |
| str | string. |
| void pdfobjects::utils::simpleValueToString | ( | const std::string & | val, | |
| std::string & | str | |||
| ) | [inline] |
| void pdfobjects::utils::simpleValueToString< pBool > | ( | bool | val, | |
| string & | str | |||
| ) | [inline] |
| void pdfobjects::utils::simpleValueToString< pInt > | ( | int | val, | |
| string & | str | |||
| ) | [inline] |
| template void pdfobjects::utils::simpleValueToString< pName > | ( | const string & | val, | |
| string & | str | |||
| ) |
| void pdfobjects::utils::simpleValueToString< pNull > | ( | const NullType & | , | |
| string & | str | |||
| ) | [inline] |
| void pdfobjects::utils::simpleValueToString< pReal > | ( | double | val, | |
| string & | str | |||
| ) | [inline] |
| void pdfobjects::utils::simpleValueToString< pRef > | ( | const IndiRef & | ref, | |
| string & | str | |||
| ) | [inline] |
| template void pdfobjects::utils::simpleValueToString< pString > | ( | const string & | val, | |
| string & | str | |||
| ) |
Referenced by stringToCharBuffer().
| Object * pdfobjects::utils::simpleValueToXpdfObj | ( | T | val | ) | [inline] |
Create xpdf Object which represents value.
| val | Value where the value is stored. |
| template Object* pdfobjects::utils::simpleValueToXpdfObj< pBool, const bool & > | ( | const bool & | val | ) |
| template Object* pdfobjects::utils::simpleValueToXpdfObj< pInt, const int & > | ( | const int & | val | ) |
| template Object* pdfobjects::utils::simpleValueToXpdfObj< pName, const string & > | ( | const string & | val | ) |
| template Object* pdfobjects::utils::simpleValueToXpdfObj< pNull, const NullType & > | ( | const NullType & | val | ) |
| template Object* pdfobjects::utils::simpleValueToXpdfObj< pReal, const double & > | ( | const double & | val | ) |
| template Object* pdfobjects::utils::simpleValueToXpdfObj< pRef, const IndiRef & > | ( | const IndiRef & | val | ) |
| template Object* pdfobjects::utils::simpleValueToXpdfObj< pString, const string & > | ( | const string & | val | ) |
| size_t pdfobjects::utils::streamToCharBuffer | ( | const Object & | streamObject, | |
| Ref * | ref, | |||
| CharBuffer & | outputBuf, | |||
| stream_data_extractor | extractor | |||
| ) |
Makes a valid pdf indirect object representation of stream object.
| streamObject | Xpdf object representing stream. | |
| ref | Reference for this indirect object. | |
| outputBuf | Output byte buffer containing complete representation. | |
| extractor | Function to be used to extract data from the object's stream. |
Allocates and fills buffer in given outputBuf with pdf object format representation of given stream object. Moreover adds indirect header and footer if ref is non NULL.
If you want some filters to be used to encode stream data, use extractor function parameter for this purpose. bufferFromStreamData used by default returns stream data without any filters applied.
Given buffer may contain NUL bytes inside. Caller should consume number of returned bytes from outputBuf.
References char_buffer_new(), pdfobjects::Specification::CSTREAM_FOOTER, debug::DBG_DBG, debug::DBG_ERR, debug::DBG_WARN, xpdf::freeXpdfObject(), pdfobjects::XPdfObjectFactory::getInstance(), pdfobjects::Specification::INDIRECT_FOOTER, pdfobjects::Specification::INDIRECT_HEADER, utilsPrintDbg, and xpdfObjToString().
Referenced by pdfobjects::utils::ZlibFilterStreamWriter::compress(), and pdfobjects::utils::NullFilterStreamWriter::compress().
| void pdfobjects::utils::streamToString | ( | const std::string & | strDict, | |
| ITERATOR | begin, | |||
| ITERATOR | end, | |||
| OUTITERATOR | out | |||
| ) | [inline] |
CStream object to string
| strDict | Dictionary string representation. | |
| begin | Buffer begin | |
| end | Buffer end | |
| out | Output string. |
| template void pdfobjects::utils::streamToString< CStream::Buffer::const_iterator, std::back_insert_iterator< std::string > > | ( | const std::string & | strDict, | |
| CStream::Buffer::const_iterator | begin, | |||
| CStream::Buffer::const_iterator | end, | |||
| std::back_insert_iterator< std::string > | out | |||
| ) |
| size_t pdfobjects::utils::stringToCharBuffer | ( | Object & | stringObject, | |
| CharBuffer & | outputBuf | |||
| ) |
Makes a valid pdf representation of xpdf string object.
| stringObject | Xpdf object with objString type. | |
| outputBuf | Output buffer where final representation is stored. |
This method creates correct pdf representation of given xpdf string object. It should be used for string objects which may contain NUL characters inside. Otherwise simpleValueToString method can be used.
References char_buffer_new(), debug::DBG_DBG, debug::DBG_ERR, simpleValueToString< pString >(), and utilsPrintDbg.
| void pdfobjects::utils::stripXRefStreamFields | ( | const Object & | trailer | ) |
Helper function for trailer cleanup from xref stream entries.
| trailer | TrailerClenaup. |
Get rid all entries which could come from xref stream dictionary.
References debug::DBG_INFO, xpdf::freeXpdfObject(), and utilsPrintDbg.
Referenced by pdfobjects::utils::OldStylePdfWriter::writeTrailer().
| void pdfobjects::utils::trim_trailing_zero | ( | char * | number_str | ) |
Removes trailing zeros from given number in string form.
| number_str | Number in string representation. |
Note that number must be in [-+]nnnn.nnnn form.
| bool pdfobjects::utils::typeSafeTrailerEntry | ( | const char * | name, | |
| ::Object & | value, | |||
| XRef & | xref | |||
| ) |
Checks whether given name, value pair is valid for Trailer entry.
| name | Name for the Trailer entry (must be non NULL). | |
| value | Value to be set for Trailer entry. | |
| xref | Xref for value fetching. |
Referenced by pdfobjects::XRefWriter::changeTrailer().
| void pdfobjects::utils::writeObject | ( | const ::Object & | obj, | |
| StreamWriter & | stream, | |||
| ::Ref * | ref, | |||
| bool | indirect | |||
| ) |
Helper method for xpdf object writing to the stream.
| obj | Xpdf object to write. | |
| ref | Object's reference (NULL for indirect object). | |
| stream | Stream where to write. | |
| indirect | Flag for indirect object |
Creates correct pdf string representation of given object, adds indirect header and footer if indirect flag is specified and writes everything to the given stream.
Given xpdf object data (like stream or string) can contain unprintable or 0 bytes.
References char_buffer_new(), createIndirectObjectStringFromString(), createObjFromXpdfObj(), pdfobjects::utils::FilterStreamWriter::getInstance(), and StreamWriter::putLine().
Referenced by pdfobjects::utils::OldStylePdfWriter::writeContent(), and pdfobjects::utils::OldStylePdfWriter::writeTrailer().
| ::Object* pdfobjects::utils::xpdfObjFromString | ( | const std::string & | str, | |
| ::XRef * | xref = NULL | |||
| ) |
Create xpdf object from string.
| str | String that should represent an xpdf object. | |
| xref | Xref of actual pdf if any. |
| ::Object* pdfobjects::utils::xpdfObjFromString | ( | const std::string & | str, | |
| XRef * | xref | |||
| ) |
| void pdfobjects::utils::xpdfObjToString | ( | Object & | obj, | |
| string & | str | |||
| ) |
| void pdfobjects::utils::xpdfObjToString | ( | Object & | obj, | |
| std::string & | str | |||
| ) |
Convert xpdf object to string
| obj | Xpdf object that will be converted. | |
| str | This will hold the string representation of the object. |
Referenced by streamToCharBuffer().
| Object * pdfobjects::utils::xpdfStreamObjFromBuffer | ( | const CStream::Buffer & | buffer, | |
| const CDict & | dict | |||
| ) |
Create xpdf object from string.
| buffer | Stream buffer. | |
| dict | Stream dictionary. |
Referenced by pdfobjects::CStream::_makeXpdfObject().