|
pdfedit
0.4.5
About: PDFedit is a free and open source library for manipulating PDF documents.
Fossies Dox: pdfedit-0.4.5.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation) ![]() |
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 |
| More... | |
| 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 |
| More... | |
| 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 |
| More... | |
| 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) |
| More... | |
| 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 |
| More... | |
| template<typename ItemType > | |
| ItemType::Value | getSimpleValueFromDict (const CDict &dict, const std::string &id) |
| More... | |
| template<typename SimpleValueType , typename ItemType , PropertyType ItemPType> | |
| SimpleValueType | getSimpleValueFromDict (const boost::shared_ptr< IProperty > &dict, const std::string &id) DONOTUSE |
| More... | |
| template<typename ItemType > | |
| ItemType::Value | getSimpleValueFromDict (const boost::shared_ptr< IProperty > &ip, const std::string &id) |
| More... | |
| 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 |
| More... | |
| template<typename ItemType > | |
| void | setSimpleValueInDict (const IProperty &ip, CDict::PropertyId name, const typename ItemType::Value &val) |
| More... | |
| 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 |
| More... | |
| 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) |
| More... | |
| 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) |
| More... | |
| template<PropertyType Tp> | |
| void | simpleValueToString (double val, std::string &str) |
| More... | |
| template<PropertyType Tp> | |
| void | simpleValueToString (const NullType &val, std::string &str) |
| More... | |
| template<PropertyType Tp> | |
| void | simpleValueToString (const IndiRef &val, std::string &str) |
| More... | |
| 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.
Definition at line 81 of file pdfwriter.h.
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.
| Enumerator | |
|---|---|
| ErrorNode | |
| UnknownNode | |
| LeafNode | |
| InterNode | |
| RootNode | |
| 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.
Definition at line 50 of file cannotation.cc.
References StrikeOut, gui::Text, and Underline.
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.
Definition at line 887 of file cobject2xpdf.cc.
References Stream::getChar(), i, NULL, NULL, Stream::reset(), Stream::reset(), utilsPrintDbg, utilsPrintDbg, 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). |
Definition at line 282 of file xrefwriter.cc.
References i, i, i, i, kernelPrintDbg, and NULL.
Referenced by pdfobjects::XRefWriter::changeTrailer(), and TestCPdf::changeTrailerTC().
| 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.
Definition at line 303 of file cobjecthelpers.cc.
Referenced by pdfobjects::CPageAnnots::add(), pdfobjects::CAnnotation::createAnnotation(), pdfobjects::CAnnotation::createAnnotation(), pdfobjects::CAnnotation::createAnnotation(), pdfobjects::utils::TextAnnotInitializer::operator()(), pdfobjects::utils::TextAnnotInitializer::operator()(), pdfobjects::utils::TextAnnotInitializer::operator()(), pdfobjects::utils::TextAnnotInitializer::operator()(), pdfobjects::utils::TextAnnotInitializer::operator()(), pdfobjects::utils::TextAnnotInitializer::operator()(), pdfobjects::utils::TextAnnotInitializer::operator()(), pdfobjects::utils::LinkAnnotInitializer::operator()(), pdfobjects::utils::LinkAnnotInitializer::operator()(), pdfobjects::utils::LinkAnnotInitializer::operator()(), and pdfobjects::utils::LinkAnnotInitializer::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.
Definition at line 50 of file xrefwriter.cc.
References FIRST_LINEARIZED_BLOCK, Object::free(), Object::free(), Object::free(), Object::free(), Object::free(), Object::free(), Object::free(), Object::free(), Object::free(), Object::free(), Ref::gen, Object::getDict(), Object::getInt(), Object::getInt(), Parser::getObj(), Parser::getObj(), Parser::getObj(), Parser::getObj(), Stream::getPos(), Stream::getPos(), gTrue, Object::isCmd(), Object::isDict(), Object::isEOF(), Object::isEOF(), Object::isEOF(), Object::isEOF(), Object::isInt(), Object::isInt(), Object::isNull(), BaseStream::makeSubStream(), NULL, Ref::num, gui::parser, Stream::reset(), and utilsPrintDbg.
Referenced by pdfobjects::XRefWriter::XRefWriter().
| void pdfobjects::utils::complexValueFromXpdfObj | ( | IProperty & | ip, |
| const ::Object & | obj, | ||
| T | val | ||
| ) |
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. |
|
inline |
Definition at line 737 of file cobject2xpdf.cc.
| 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 | ||
| ) |
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 | ||
| ) |
Definition at line 276 of file cobject2string.cc.
References debug::DBG_DBG, and utilsPrintDbg.
Referenced by pdfobjects::CArray::getStringRepresentation().
| void pdfobjects::utils::complexValueToString< CDict > | ( | const CDict::Value & | val, |
| string & | str | ||
| ) |
Definition at line 305 of file cobject2string.cc.
References debug::DBG_DBG, and utilsPrintDbg.
Referenced by pdfobjects::CDict::getStringRepresentation().
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!
Definition at line 926 of file cobject2xpdf.cc.
References bufferFromStream(), xpdf::freeXpdfObject(), Object::getInt(), Object::getStream(), Object::getStream(), i, i, Object::isInt(), NULL, NULL, Object::streamGetDict(), 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.
Definition at line 196 of file cobject.cc.
References pdfobjects::Specification::INDIRECT_FOOTER, and pdfobjects::Specification::INDIRECT_HEADER.
Referenced by writeObject().
| 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). |
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 | ||
| ) |
Definition at line 605 of file cobject2xpdf.cc.
References pdfobjects::CObjectFactory< Type >::getInstance(), pdfobjects::CObjectFactory< Type >::getInstance(), pdfobjects::CObjectFactory< Type >::getInstance(), pdfobjects::CObjectFactory< Type >::getInstance(), pdfobjects::CObjectFactory< Type >::getInstance(), pdfobjects::CObjectFactory< Type >::getInstance(), pdfobjects::CNullFactory::getInstance(), pdfobjects::CDictFactory::getInstance(), pdfobjects::CArrayFactory::getInstance(), Object::getType(), objArray, objBool, objDict, objInt, objName, objNull, objReal, objRef, objStream, and objString.
Referenced by dictFromXpdfObj(), pdfobjects::CPdf::getIndirectProperty(), and writeObject().
Definition at line 647 of file cobject2xpdf.cc.
References pdfobjects::CObjectFactory< Type >::getInstance(), pdfobjects::CObjectFactory< Type >::getInstance(), pdfobjects::CObjectFactory< Type >::getInstance(), pdfobjects::CObjectFactory< Type >::getInstance(), pdfobjects::CObjectFactory< Type >::getInstance(), pdfobjects::CObjectFactory< Type >::getInstance(), pdfobjects::CNullFactory::getInstance(), pdfobjects::CDictFactory::getInstance(), pdfobjects::CArrayFactory::getInstance(), Object::getType(), objArray, objBool, objDict, objInt, objName, objNull, objReal, objRef, objStream, and objString.
| 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. |
Definition at line 758 of file cobject2xpdf.cc.
References pdfobjects::CDict::addProperty(), createObjFromXpdfObj(), debug::DBG_DBG, Object::dictGetKey(), Object::dictGetLength(), Object::dictGetLength(), Object::dictGetValNF(), pdfobjects::XPdfObjectFactory::getInstance(), pdfobjects::CDict::getPropertyCount(), Object::getType(), Object::getType(), i, objDict, objDict, and utilsPrintDbg.
Referenced by pdfobjects::CInlineImage::CInlineImage(), and 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. |
Definition at line 427 of file cpdf.cc.
References count, count, getKidsCount(), getKidsFromInterNode(), getNodeType(), getNodeType(), i, i, i, i, InterNode, InterNode, InterNode, pdfobjects::isDict(), pdfobjects::isRef(), pdfobjects::isRef(), LeafNode, LeafNode, LeafNode, RootNode, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, and utilsPrintDbg.
Referenced by pdfobjects::CPdf::getPage(), pdfobjects::CPdf::insertPage(), and pdfobjects::CPdf::removePage().
| void pdfobjects::utils::getAllChildrenOfPdfObject | ( | boost::shared_ptr< CDict > | topdict, |
| Container & | cont | ||
| ) |
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. |
Definition at line 332 of file cobjecthelpers.h.
References getCDictFromDict(), and getCDictFromDict().
Referenced by pdfobjects::CPdf::getOutlines().
|
inline |
Get dictionary from dictionary. If it is an indirect object, fetch the object.
Definition at line 972 of file cdict.h.
Referenced by pdfobjects::CPageFonts::addSystemType1Font(), pdfobjects::CPageFonts::addSystemType1Font(), getAllChildrenOfPdfObject(), getAllChildrenOfPdfObject(), pdfobjects::CPageFonts::getFontIdsAndNames(), pdfobjects::CPageFonts::getFontIdsAndNames(), and pdfobjects::CPdf::getOutlines().
| boost::shared_ptr<CType> pdfobjects::utils::getCObjectFromRef | ( | const boost::shared_ptr< IProperty > & | refProp) |
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. |
Definition at line 1865 of file cpdf.h.
References pdfobjects::isRef().
| boost::shared_ptr<CType> pdfobjects::utils::getCObjectFromRef | ( | const IndiRef & | ref, |
| const boost::shared_ptr< CPdf > & | |||
| ) |
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. |
|
inline |
Get stream from array. If it is CRef fetch the object pointed at.
Definition at line 572 of file cstream.h.
Referenced by getTestStreamContent().
| 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. |
Definition at line 118 of file cobjecthelpers.cc.
References pdfobjects::pDict, and pdfobjects::pRef.
| 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. |
Definition at line 137 of file cobjecthelpers.cc.
References pdfobjects::CPdf::getIndirectProperty(), and pdfobjects::pDict.
| 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.
Definition at line 104 of file cobjecthelpers.cc.
References getNameFromDict().
|
inline |
Get double from array.
Definition at line 479 of file carray.h.
References getIntFromArray().
Referenced by pdfobjects::CPageDisplay::getMediabox(), pdfobjects::CPageDisplay::getMediabox(), pdfobjects::CPageDisplay::getMediabox(), pdfobjects::CPageDisplay::getMediabox(), getRectangleFromProperty(), getRectangleFromProperty(), getRectangleFromProperty(), getRectangleFromProperty(), gui::PageViewMode_Annotations::getRectOfAnnotation(), gui::PageViewMode_Annotations::getRectOfAnnotation(), gui::PageViewMode_Annotations::getRectOfAnnotation(), and gui::PageViewMode_Annotations::getRectOfAnnotation().
|
inline |
| 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. |
Definition at line 64 of file pdfwriter.cc.
References count, count, count, Object::free(), Array::get(), Object::getArray(), Array::getLength(), Object::getName(), Object::getName(), i, i, Object::isArray(), Object::isName(), Object::isName(), Object::isNull(), Object::isStream(), and Object::streamGetDict().
Referenced by pdfobjects::utils::ZlibFilterStreamWriter::supportObject().
|
inline |
| 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. |
Definition at line 41 of file cobjecthelpers.cc.
References pdfobjects::pInt.
|
inline |
Get int from ip.
Definition at line 622 of file cobjectsimple.h.
Referenced by TestCPdf::indirectPropertyTC(), TestCPdf::indirectPropertyTC(), and TestCPdf::indirectPropertyTC().
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).
Definition at line 285 of file cobjecthelpers.cc.
References pdfobjects::CObjectFactory< Type >::getInstance().
Referenced by pdfobjects::CAnnotation::createAnnotation().
| 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).
Definition at line 251 of file cobjecthelpers.cc.
References pdfobjects::CObjectFactory< Type >::getInstance(), pdfobjects::CObjectFactory< Type >::getInstance(), pdfobjects::CObjectFactory< Type >::getInstance(), pdfobjects::CObjectFactory< Type >::getInstance(), and pdfobjects::CArrayFactory::getInstance().
Referenced by pdfobjects::CAnnotation::createAnnotation(), pdfobjects::CPageAttributes::fillInherited(), and pdfobjects::CPageAttributes::fillInherited().
| 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.
Definition at line 368 of file cpdf.cc.
References count, count, count, getKidsFromInterNode(), getNodeType(), i, i, i, i, pdfobjects::isDict(), pdfobjects::isRef(), pdfobjects::isRef(), and LeafNode.
Referenced by pdfobjects::CPdf::consolidatePageList(), pdfobjects::CPdf::consolidatePageList(), pdfobjects::CPdf::consolidatePageTree(), findPageDict(), findPageDict(), pdfobjects::CPdf::getPageCount(), TestCPdf::pageManipulationTC(), TestCPdf::pageManipulationTC(), and searchTreeNode().
| void pdfobjects::utils::getKidsFromInterNode | ( | const boost::shared_ptr< CDict > & | interNodeDict, |
| Container & | container | ||
| ) | |||
| throw | ( | ||
| ) | |||
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.
Definition at line 185 of file cpdf.cc.
References pdfobjects::isArray(), and pdfobjects::isRef().
Referenced by pdfobjects::CPdf::consolidatePageTree(), findPageDict(), getKidsCount(), 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. |
Definition at line 86 of file cobjecthelpers.cc.
References pdfobjects::pName.
|
inline |
Get name from dictionary.
Definition at line 723 of file cdict.h.
Referenced by getDictType(), pdfobjects::CPageFonts::getFontIdsAndNames(), and pdfobjects::CPageFonts::getFontIdsAndNames().
|
inline |
Get name from ip.
Definition at line 644 of file cobjectsimple.h.
| size_t pdfobjects::utils::getNodePosition | ( | const shared_ptr< CPdf > & | pdf, |
| const shared_ptr< IProperty > & | node, | ||
| PageTreeNodeCountCache * | cache | ||
| ) |
Definition at line 738 of file cpdf.cc.
References getPageTreeRoot(), pdfobjects::isRef(), pdfobjects::pDict, pdfobjects::pRef, searchTreeNode(), utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, and utilsPrintDbg.
Referenced by pdfobjects::CPdf::consolidatePageList(), pdfobjects::CPdf::consolidatePageList(), TestCPdf::pageManipulationTC(), TestCPdf::pageManipulationTC(), TestCPdf::pageManipulationTC(), and pdfobjects::CPdf::unregisterPageTreeObservers().
| 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). |
| 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.
Definition at line 104 of file cpdf.cc.
References ErrorNode, ErrorNode, getPageTreeRoot(), InterNode, InterNode, InterNode, pdfobjects::isArray(), pdfobjects::isDict(), pdfobjects::isRef(), pdfobjects::isRef(), pdfobjects::isRef(), LeafNode, RootNode, UnknownNode, and UnknownNode.
Referenced by pdfobjects::CPdf::consolidatePageList(), pdfobjects::CPdf::consolidatePageList(), pdfobjects::CPdf::consolidatePageTree(), pdfobjects::CPdf::consolidatePageTree(), findPageDict(), findPageDict(), getKidsCount(), TestCPdf::pageManipulationTC(), searchTreeNode(), and searchTreeNode().
| boost::shared_ptr< CDict > pdfobjects::utils::getPageTreeRoot | ( | const boost::shared_ptr< CPdf > & | pdf) |
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.
Definition at line 84 of file cpdf.cc.
References pdfobjects::isRef().
Referenced by getNodePosition(), getNodeType(), pdfobjects::CPdf::getPage(), pdfobjects::CPdf::getPageCount(), pdfobjects::CPdf::insertPage(), TestCPdf::pageManipulationTC(), TestCPdf::pageManipulationTC(), 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 | ( | ||
| ) | |||
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.
Definition at line 280 of file cobjecthelpers.h.
References utilsPrintDbg.
| void pdfobjects::utils::getRectangleFromProperty | ( | const shared_ptr< IProperty > | prop, |
| libs::Rectangle & | rect | ||
| ) |
Definition at line 270 of file cobjecthelpers.cc.
References getDoubleFromArray(), getDoubleFromArray(), getDoubleFromArray(), getDoubleFromArray(), and pdfobjects::isArray().
Referenced by pdfobjects::CPageAttributes::fillInherited().
| 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. |
| boost::shared_ptr< IProperty > pdfobjects::utils::getReferencedObject | ( | boost::shared_ptr< IProperty > | ip) |
If the object is a reference, fetch the "real" object
| ip | IProperty. |
Definition at line 227 of file cobjecthelpers.cc.
References pdfobjects::hasValidPdf(), pdfobjects::hasValidPdf(), pdfobjects::hasValidRef(), pdfobjects::hasValidRef(), and pdfobjects::isRef().
Referenced by getSimpleValueFromDict(), getSimpleValueFromDict(), getSimpleValueFromDict(), getSimpleValueFromDict(), getTestStreamContent(), getTypeFromArray(), getTypeFromArray(), getTypeFromDictionary(), getTypeFromDictionary(), setSimpleValueInArray(), setSimpleValueInArray(), setSimpleValueInDict(), and setSimpleValueInDict().
|
inline |
| 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. |
Definition at line 56 of file cobjecthelpers.cc.
References pdfobjects::pRef.
|
inline |
Get simple value from array.
| array | Array. |
| position | Position in the array. |
Definition at line 393 of file carray.h.
References debug::DBG_DBG, and utilsPrintDbg.
|
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. |
Definition at line 414 of file carray.h.
References debug::DBG_DBG, and utilsPrintDbg.
|
inline |
Get simple value from array.
| array | Array. |
| position | Position in the array. |
Definition at line 432 of file carray.h.
References pdfobjects::isArray(), and pdfobjects::isArray().
|
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).
| ElementBadTypeException | if given property is not CArray or property with given index is not ItemType. |
Definition at line 459 of file carray.h.
References pdfobjects::isArray().
|
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. |
Definition at line 591 of file cdict.h.
References getReferencedObject().
|
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. |
Definition at line 612 of file cdict.h.
References debug::DBG_DBG, getReferencedObject(), and utilsPrintDbg.
|
inline |
Get simple value from dictionary.
| dict | Dictionary. |
| id | Position in the dictionary. |
Definition at line 629 of file cdict.h.
References pdfobjects::CDict::getProperty(), and getReferencedObject().
|
inline |
Get simple value from dictionary.
| dict | Dictionary. |
| id | Position in the dictionary. |
Definition at line 642 of file cdict.h.
References debug::DBG_DBG, pdfobjects::CDict::getProperty(), getReferencedObject(), and utilsPrintDbg.
|
inline |
Get simple value from dictionary.
| dict | Dictionary. |
| id | Position in the dictionary. |
Definition at line 660 of file cdict.h.
References pdfobjects::isDict(), and pdfobjects::isDict().
|
inline |
Get simple value from dictionary.
| dict | Dictionary. |
| id | Position in the dictionary. |
Definition at line 679 of file cdict.h.
References pdfobjects::isDict().
|
inline |
| 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. |
Definition at line 71 of file cobjecthelpers.cc.
References pdfobjects::pString.
|
inline |
Get string from dictionary.
Definition at line 715 of file cdict.h.
Referenced by pdfobjects::getOutlineText(), pdfobjects::ContentsChangeTag::getTime(), and pdfobjects::isPage().
|
inline |
Get string from ip.
Definition at line 637 of file cobjectsimple.h.
Referenced by pdfobjects::TextSimpleOperator::getRawText(), pdfobjects::TextSimpleOperator::getRawText(), and 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. |
Definition at line 579 of file cobject2xpdf.cc.
References Object::isStream(), Object::streamClose(), Object::streamGetChar(), and Object::streamReset().
Referenced by pdfobjects::CStream::getDecodedStringRepresentation().
|
inline |
Get iproperty casted to specific type from array.
| array | Array. |
| pos | Position in the array. |
Definition at line 642 of file carray.h.
References debug::DBG_DBG, getReferencedObject(), and utilsPrintDbg.
|
inline |
Get iproperty casted to specific type from array.
| array | Array. |
| id | Position in the array. |
| ElementBadTypeException | if property doesn't have ItemType type. |
Definition at line 673 of file carray.h.
References debug::DBG_DBG, debug::DBG_DBG, getReferencedObject(), utilsPrintDbg, and utilsPrintDbg.
|
inline |
Get iproperty casted to specific type from array.
| array | Array. |
| pos | Position in the array. |
Definition at line 703 of file carray.h.
References pdfobjects::isArray(), and pdfobjects::isArray().
|
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. |
Definition at line 731 of file carray.h.
References pdfobjects::isArray().
|
inline |
Get iproperty casted to specific type from dictionary.
| dict | Dictionary. |
| key | Position in the dictionary. |
Definition at line 859 of file cdict.h.
References debug::DBG_DBG, debug::DBG_DBG, getReferencedObject(), utilsPrintDbg, and utilsPrintDbg.
|
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. |
Definition at line 894 of file cdict.h.
References debug::DBG_DBG, debug::DBG_DBG, getReferencedObject(), utilsPrintDbg, and utilsPrintDbg.
|
inline |
Get iproperty casted to specific type from dictionary.
| dict | Dictionary. |
| key | Position in the dictionary. |
Definition at line 927 of file cdict.h.
References pdfobjects::isDict(), and pdfobjects::isDict().
|
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. |
Definition at line 956 of file cdict.h.
References pdfobjects::isDict().
|
inline |
Get simple value from simple cobject.
| ip | IProperty. |
Definition at line 579 of file cobjectsimple.h.
References debug::DBG_DBG, and utilsPrintDbg.
|
inline |
Get simple value from simple cobject.
Given property must have correct type (ItemType::type).
| ip | IProperty. |
Definition at line 605 of file cobjectsimple.h.
References debug::DBG_DBG, and utilsPrintDbg.
| ::XRef* pdfobjects::utils::getXRef | ( | shared_ptr< IProperty > | ip) |
Definition at line 326 of file cobjecthelpers.cc.
References NULL.
Referenced by pdfobjects::CStreamsXpdfReader< T >::open().
| ::XRef* pdfobjects::utils::getXRef | ( | boost::shared_ptr< IProperty > | ip) |
Get xref from an object.
| bool pdfobjects::utils::isBinaryString | ( | const std::string & | val) |
Definition at line 211 of file cobject2string.cc.
Referenced by simpleValueToString().
| bool pdfobjects::utils::isEncrypted | ( | const boost::shared_ptr< CPdf > & | pdf) |
Checks whether file content is encrypted.
| Pdf instance to check. |
Simple helper which asks its cross reference table.
Definition at line 816 of file cpdf.cc.
References gTrue.
Referenced by pdfobjects::CPdf::changeIndirectProperty(), gui::QSPdf::isEncrypted(), print_info(), and TestCPdf::Test().
| bool pdfobjects::utils::isLatestRevision | ( | const XRefWriter & | xref) |
Checks whether the current revision is the most recent one.
| xref | Xref. |
Definition at line 140 of file xrefwriter.cc.
References pdfobjects::XRefWriter::getActualRevision(), and pdfobjects::XRefWriter::getRevisionCount().
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(), TestCPdf::revisionsTC(), and pdfobjects::CPdf::save().
| bool pdfobjects::utils::isNodeDescendant | ( | const boost::shared_ptr< CPdf > & | pdf, |
| const IndiRef & | parent, | ||
| const shared_ptr< CDict > & | child | ||
| ) |
Definition at line 779 of file cpdf.cc.
References pdfobjects::isRef().
Referenced by pdfobjects::CPdf::consolidatePageList(), and TestCPdf::pageManipulationTC().
| 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).
| 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. |
Definition at line 382 of file pdfwriter.cc.
Referenced by pdfobjects::utils::FilterStreamWriter::getInstance().
| std::string pdfobjects::utils::makeHexString | ( | Iter | it, |
| Iter | end | ||
| ) |
Definition at line 220 of file cobject2string.cc.
References snprintf.
Referenced by simpleValueToString().
| std::string pdfobjects::utils::makeNamePdfValid | ( | Iter | it, |
| Iter | end | ||
| ) |
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. |
Definition at line 323 of file cobjectsimple.h.
References snprintf.
Referenced by makeNamePdfValid(), and simpleValueToString().
|
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. |
Definition at line 356 of file cobjectsimple.h.
References makeNamePdfValid().
| void pdfobjects::utils::makeStreamPdfValid | ( | Iter | it, |
| Iter | end, | ||
| std::string & | out | ||
| ) |
Make stream pdf valid.
Not needed now.
| it | Start insert iterator. |
| end | End iterator. |
| out | Output valid string. |
Definition at line 501 of file cstream.h.
Referenced by pdfobjects::CStream::setBuffer().
| std::string pdfobjects::utils::makeStringPdfValid | ( | Iter | it, |
| Iter | end | ||
| ) |
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 \0 (NUL) character, therefore we can't use standard str* functions for strings.
| it | Start iterator. |
| end | End iterator. |
Definition at line 375 of file cobjectsimple.h.
Referenced by makeStringPdfValid(), and simpleValueToString().
|
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. |
Definition at line 405 of file cobjectsimple.h.
References GString::getCString(), GString::getLength(), and makeStringPdfValid().
| 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. |
Definition at line 57 of file cobject.cc.
References pdfobjects::IProperty::getIndiRef(), pdfobjects::IProperty::getPdf(), pdfobjects::hasValidPdf(), and pdfobjects::hasValidPdf().
Referenced by pdfobjects::IProperty::dispatchChange(), and objHasParent().
| 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. |
Definition at line 71 of file cobject.cc.
References objHasParent().
| 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.
Definition at line 60 of file cpdf.cc.
References ErrorNode, InterNode, LeafNode, RootNode, and UnknownNode.
| void pdfobjects::utils::parseStreamToContainer | ( | T & | container, |
| const ::Object & | obj | ||
| ) |
Parse stream object to a container
| container | Container of characters (e.g. ints). |
| obj | Stream object. |
Definition at line 81 of file cobject.cc.
References Stream::close(), debug::DBG_DBG, debug::DBG_DBG, Stream::getBaseStream(), Stream::getBaseStream(), Stream::getChar(), pdfobjects::XPdfObjectFactory::getInstance(), pdfobjects::XPdfObjectFactory::getInstance(), Stream::reset(), utilsPrintDbg, utilsPrintDbg, and utilsPrintDbg.
| 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.
Definition at line 146 of file cobjecthelpers.cc.
| 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. |
Definition at line 634 of file cpdf.cc.
References getKidsCount(), getKidsFromInterNode(), getNodeType(), getNodeType(), i, i, i, i, i, i, InterNode, InterNode, pdfobjects::isRef(), pdfobjects::isRef(), LeafNode, LeafNode, LeafNode, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, and utilsPrintDbg.
Referenced by getNodePosition().
|
inline |
|
inline |
Set double in dictioary.
Definition at line 831 of file cdict.h.
References name, and setIntInDict().
|
inline |
|
inline |
Set int in dictionary.
Definition at line 823 of file cdict.h.
References name.
Referenced by setDoubleInDict().
|
inline |
Set simple value in array. If it is a reference, set fetch it and set it to the fetched object.
Definition at line 523 of file carray.h.
References debug::DBG_DBG, pdfobjects::CArray::getProperty(), getReferencedObject(), and utilsPrintDbg.
|
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. |
Definition at line 545 of file carray.h.
References debug::DBG_DBG, pdfobjects::CArray::getProperty(), getReferencedObject(), and utilsPrintDbg.
|
inline |
Set simple value in array. If it is a reference, set fetch it and set it to the fetched object.
Definition at line 566 of file carray.h.
References pdfobjects::isArray(), and pdfobjects::isArray().
|
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. |
Definition at line 592 of file carray.h.
References pdfobjects::isArray().
|
inline |
Set simple value in dictionary. If it is a reference, set fetch it and set it to the fetched object.
Definition at line 747 of file cdict.h.
References debug::DBG_DBG, pdfobjects::CDict::getProperty(), getReferencedObject(), and utilsPrintDbg.
|
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).
Definition at line 771 of file cdict.h.
References debug::DBG_DBG, pdfobjects::CDict::getProperty(), getReferencedObject(), and utilsPrintDbg.
|
inline |
Set simple value in dictionary. If it is a reference, set fetch it and set it to the fetched object.
Definition at line 792 of file cdict.h.
References pdfobjects::isDict(), pdfobjects::isDict(), and name.
|
inline |
|
inline |
Set simple value.
Definition at line 661 of file cobjectsimple.h.
References debug::DBG_DBG, and utilsPrintDbg.
| bool pdfobjects::utils::simpleEquals | ( | const boost::shared_ptr< IProperty > & | val1, |
| const boost::shared_ptr< IProperty > & | val2 | ||
| ) | |||
| throw | ( | ||
| ) | |||
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.
Definition at line 169 of file cobjecthelpers.cc.
| 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. |
Definition at line 55 of file cobject2string.cc.
References nocase_compare(), and nocase_compare().
Referenced by add_ref(), pdfobjects::ContentsChangeTag::getTime(), main(), main(), main(), pdfobjects::CObjectSimple< Tp >::setStringRepresentation(), and pdfobjects::CObjectSimple< Tp >::setStringRepresentation().
| void pdfobjects::utils::simpleValueFromString | ( | const std::string & | str, |
| int & | val | ||
| ) |
Definition at line 69 of file cobject2string.cc.
| void pdfobjects::utils::simpleValueFromString | ( | const std::string & | str, |
| double & | val | ||
| ) |
Definition at line 82 of file cobject2string.cc.
References objInt, objReal, objReal, and xpdfObjFromString().
| void pdfobjects::utils::simpleValueFromString | ( | const std::string & | str, |
| std::string & | val | ||
| ) |
Definition at line 94 of file cobject2string.cc.
| void pdfobjects::utils::simpleValueFromString | ( | const std::string & | str, |
| IndiRef & | val | ||
| ) |
Definition at line 100 of file cobject2string.cc.
References pdfobjects::IndiRef::gen, and pdfobjects::IndiRef::num.
| void pdfobjects::utils::simpleValueFromXpdfObj | ( | const ::Object & | obj, |
| T | val | ||
| ) |
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 | ||
| ) |
Definition at line 715 of file cobject2xpdf.cc.
|
inline |
Definition at line 726 of file cobject2xpdf.cc.
| void pdfobjects::utils::simpleValueToString | ( | const std::string & | val, |
| std::string & | str | ||
| ) |
Definition at line 237 of file cobject2string.cc.
References isBinaryString(), makeHexString(), makeNamePdfValid(), makeStringPdfValid(), pdfobjects::pName, pdfobjects::pName, pdfobjects::pString, pdfobjects::pString, and STATIC_CHECK.
| void pdfobjects::utils::simpleValueToString | ( | bool | val, |
| std::string & | str | ||
| ) |
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 | ( | int | val, |
| std::string & | str | ||
| ) |
| void pdfobjects::utils::simpleValueToString | ( | double | val, |
| std::string & | str | ||
| ) |
| void pdfobjects::utils::simpleValueToString | ( | const NullType & | val, |
| std::string & | str | ||
| ) |
| void pdfobjects::utils::simpleValueToString | ( | const IndiRef & | val, |
| std::string & | str | ||
| ) |
| void pdfobjects::utils::simpleValueToString< pBool > | ( | bool | val, |
| string & | str | ||
| ) |
Definition at line 125 of file cobject2string.cc.
| void pdfobjects::utils::simpleValueToString< pInt > | ( | int | val, |
| string & | str | ||
| ) |
Definition at line 134 of file cobject2string.cc.
References snprintf.
| template void pdfobjects::utils::simpleValueToString< pName > | ( | const string & | val, |
| string & | str | ||
| ) |
| void pdfobjects::utils::simpleValueToString< pNull > | ( | const NullType & | , |
| string & | str | ||
| ) |
Definition at line 194 of file cobject2string.cc.
| void pdfobjects::utils::simpleValueToString< pReal > | ( | double | val, |
| string & | str | ||
| ) |
Definition at line 168 of file cobject2string.cc.
References snprintf, and trim_trailing_zero().
| void pdfobjects::utils::simpleValueToString< pRef > | ( | const IndiRef & | ref, |
| string & | str | ||
| ) |
Definition at line 203 of file cobject2string.cc.
| template void pdfobjects::utils::simpleValueToString< pString > | ( | const string & | val, |
| string & | str | ||
| ) |
Referenced by stringToCharBuffer().
| Object * pdfobjects::utils::simpleValueToXpdfObj | ( | T | val) |
Create xpdf Object which represents value.
| val | Value where the value is stored. |
Definition at line 694 of file cobject2xpdf.cc.
References pdfobjects::XPdfObjectFactory::getInstance().
| 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.
Definition at line 957 of file cobject2xpdf.cc.
References char_buffer_new(), pdfobjects::Specification::CSTREAM_FOOTER, pdfobjects::Specification::CSTREAM_FOOTER, pdfobjects::Specification::CSTREAM_FOOTER, pdfobjects::Specification::CSTREAM_FOOTER, xpdf::freeXpdfObject(), pdfobjects::XPdfObjectFactory::getInstance(), pdfobjects::XPdfObjectFactory::getInstance(), Object::getStream(), Object::getType(), Object::getType(), pdfobjects::Specification::INDIRECT_FOOTER, pdfobjects::Specification::INDIRECT_HEADER, Object::streamGetDict(), Object::streamGetDict(), utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, utilsPrintDbg, and xpdfObjToString().
Referenced by pdfobjects::utils::NullFilterStreamWriter::compress(), and pdfobjects::utils::ZlibFilterStreamWriter::compress().
| void pdfobjects::utils::streamToString | ( | const std::string & | strDict, |
| ITERATOR | begin, | ||
| ITERATOR | end, | ||
| OUTITERATOR | out | ||
| ) |
CStream object to string
| strDict | Dictionary string representation. |
| begin | Buffer begin |
| end | Buffer end |
| out | Output string. |
Definition at line 132 of file cobject.cc.
References pdfobjects::Specification::CSTREAM_FOOTER, pdfobjects::Specification::CSTREAM_FOOTER, pdfobjects::Specification::CSTREAM_HEADER, and pdfobjects::Specification::CSTREAM_HEADER.
Referenced by pdfobjects::CStream::getStringRepresentation().
| 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.
Definition at line 157 of file cobject.cc.
References GString::append(), char_buffer_new(), Object::getString(), Object::getType(), Object::getType(), i, i, i, i, i, i, i, i, i, simpleValueToString< pString >(), utilsPrintDbg, and utilsPrintDbg.
Helper function for trailer cleanup from xref stream entries.
| trailer | TrailerClenaup. |
Get rid all entries which could come from xref stream dictionary.
Definition at line 556 of file pdfwriter.cc.
References Object::dictDel(), Object::dictLookupNF(), Object::free(), xpdf::freeXpdfObject(), Object::getType(), i, i, i, i, NULL, 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.
Definition at line 148 of file cobject2string.cc.
Referenced by simpleValueToString< pReal >().
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. |
Definition at line 301 of file xrefwriter.cc.
References XRef::fetch(), Object::fetch(), pdfobjects::XPdfObjectFactory::getInstance(), pdfobjects::XPdfObjectFactory::getInstance(), Object::getRefGen(), Object::getRefNum(), Object::getType(), Object::getType(), Object::getType(), Object::getType(), Object::getType(), Object::getType(), kernelPrintDbg, kernelPrintDbg, kernelPrintDbg, kernelPrintDbg, kernelPrintDbg, objArray, objDict, objDict, objInt, and objRef.
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.
Definition at line 421 of file pdfwriter.cc.
References char_buffer_new(), createIndirectObjectStringFromString(), createObjFromXpdfObj(), pdfobjects::utils::FilterStreamWriter::getInstance(), i, i, i, i, i, and StreamWriter::putLine().
Referenced by pdfobjects::utils::OldStylePdfWriter::writeContent(), and pdfobjects::utils::OldStylePdfWriter::writeTrailer().
Create xpdf object from string.
| str | String that should represent an xpdf object. |
| xref | Xref of actual pdf if any. |
Definition at line 797 of file cobject2xpdf.cc.
References Object::free(), xpdf::freeXpdfObject(), pdfobjects::XPdfObjectFactory::getInstance(), gmalloc(), Object::isNull(), nocase_compare(), gui::parser, and utilsPrintDbg.
Referenced by simpleValueFromString().
| 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 ip_validate(), ip_validate(), operator<<(), and streamToCharBuffer().
| void pdfobjects::utils::xpdfObjToString | ( | Object & | obj, |
| string & | str | ||
| ) |
Definition at line 557 of file cobject2xpdf.cc.
References Object::getType(), objArray, objDict, and objStream.
| Object * pdfobjects::utils::xpdfStreamObjFromBuffer | ( | const CStream::Buffer & | buffer, |
| const CDict & | dict | ||
| ) |
Create xpdf object from string.
Definition at line 852 of file cobject2xpdf.cc.
References pdfobjects::CDict::_makeXpdfObject(), Stream::addFilters(), pdfobjects::Specification::CSTREAM_FOOTER, pdfobjects::Specification::CSTREAM_FOOTER, pdfobjects::Specification::CSTREAM_FOOTER, pdfobjects::XPdfObjectFactory::getInstance(), gfree(), gmalloc(), Object::initStream(), objDict, Stream::reset(), and STATIC_CHECK.
Referenced by pdfobjects::CStream::_makeXpdfObject().