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)  

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
pdfobjects::CPageContents Class Reference

#include <cpagecontents.h>

Inheritance diagram for pdfobjects::CPageContents:
Collaboration diagram for pdfobjects::CPageContents:

Public Member Functions

 CPageContents (CPage *page)
 
 ~CPageContents ()
 
virtual void reset ()
 
void reparse ()
 
template<typename Container >
void addToFront (const Container &cont)
 
template<typename Container >
void addToBack (const Container &cont)
 
void remove (size_t csnum)
 
template<typename RectangleContainer >
size_t findText (std::string text, RectangleContainer &recs, const TextSearchParams &params=TextSearchParams()) const
 
void replaceText (const std::string &what, const std::string &with)
 
void addText (const std::string &what, const libs::Point &where, const std::string &font_id)
 
void addInlineImage (const CStream::Buffer &what, const libs::Point &image_size, const libs::Point &where)
 
template<typename WordEngine , typename LineEngine , typename ColumnEngine >
void convert (textoutput::OutputBuilder &out)
 
template<typename OpContainer , typename PositionComparator >
void getObjectsAtPosition (OpContainer &opContainer, PositionComparator cmp)
 
boost::shared_ptr< CContentStreamgetContentStream (CContentStream *cc)
 
boost::shared_ptr< CContentStreamgetContentStream (size_t pos)
 
template<typename Container >
void getContentStreams (Container &container)
 
void getText (std::string &text, const std::string *encoding=NULL, const libs::Rectangle *rc=NULL) const
 
void moveAbove (boost::shared_ptr< const CContentStream > ct)
 
void moveAbove (size_t pos)
 
void moveBelow (boost::shared_ptr< const CContentStream > ct)
 
void moveBelow (size_t pos)
 
template<typename Cont >
void setContents (shared_ptr< CDict > dict, const Cont &cont)
 
- Public Member Functions inherited from pdfobjects::ICPageModule
void init ()
 
void reset ()
 
virtual ~ICPageModule ()
 

Static Public Member Functions

template<typename Cont >
static void setContents (boost::shared_ptr< CDict > dict, const Cont &cont)
 

Detailed Description

Class representing the Contents entry in a page. Provides convinient access and modify operations on "Contents" entry of a page dictionary.

Definition at line 59 of file cpagecontents.h.

Constructor & Destructor Documentation

pdfobjects::CPageContents::CPageContents ( CPage page)

Definition at line 224 of file cpagecontents.cc.

References pdfobjects::CPage::getDictionary().

pdfobjects::CPageContents::~CPageContents ( )

Definition at line 231 of file cpagecontents.cc.

References reset().

Member Function Documentation

template<typename Container >
template void pdfobjects::CPageContents::addToBack< deque< shared_ptr< PdfOperator > > > ( const Container &  cont)

Add new content stream to the back. This function adds new entry in the "Contents" property of a page. The container of provided operators must form a valid contentstream. This function should be used when supplied operators should be handled at the end e.g. should be drawn at the end which means they will appear "above" other objects.

This function can be used to separate our changes from original content stream. Indicats that the page changed.

Parameters
contContainer of operators to add.

Definition at line 305 of file cpagecontents.cc.

References pdfobjects::hasValidPdf(), pdfobjects::hasValidPdf(), pdfobjects::hasValidPdf(), pdfobjects::hasValidPdf(), and pdfobjects::hasValidRef().

Referenced by addInlineImage(), and addText().

template<typename Container >
template void pdfobjects::CPageContents::addToFront< deque< shared_ptr< PdfOperator > > > ( const Container &  cont)

Add new content stream to the front. This function adds new entry in the "Contents" property of a page. The container of provided operators must form a valid contentstream. This function should be used when supplied operators should be handled at the beginning end e.g. should be drawn first which means they will appear the "below" other object.

This function can be used to separate our changes from original content stream. Indicats that the page changed.

Parameters
contContainer of operators to add.

Definition at line 265 of file cpagecontents.cc.

References pdfobjects::hasValidPdf(), pdfobjects::hasValidPdf(), pdfobjects::hasValidPdf(), and pdfobjects::hasValidRef().

template<typename WordEngine , typename LineEngine , typename ColumnEngine >
void pdfobjects::CPageContents::convert ( textoutput::OutputBuilder out)
inline

Get text source of a page.

Definition at line 234 of file cpagecontents.h.

References debug::DBG_INFO, pdfobjects::PdfOperator::getIterator(), pdfobjects::hasValidPdf(), and kernelPrintDbg.

template<typename RectangleContainer >
size_t pdfobjects::CPageContents::findText ( std::string  text,
RectangleContainer &  recs,
const TextSearchParams params = TextSearchParams() 
) const

Find all occurences of a text on this page.

It uses xpdf TextOutputDevice to get the bounding box of found text.

Parameters
textText to find.
recsOutput container of rectangles of all occurences of the text.
paramsSearch parameters.
Returns
Number of occurences found.

Definition at line 395 of file cpagecontents.cc.

References gFalse, gFalse, gFalse, gFalse, gFalse, gTrue, i, i, i, i, i, and NULL.

shared_ptr< CContentStream > pdfobjects::CPageContents::getContentStream ( CContentStream cc)

Returns shared pointer to the specified content stream.

Definition at line 238 of file cpagecontents.cc.

shared_ptr< CContentStream > pdfobjects::CPageContents::getContentStream ( size_t  pos)

Returns shared pointer to the specified content stream.

Definition at line 251 of file cpagecontents.cc.

template<typename Container >
void pdfobjects::CPageContents::getContentStreams ( Container &  container)
inline

Fills container with contents streams.

Definition at line 308 of file cpagecontents.h.

template<typename OpContainer , typename PositionComparator >
void pdfobjects::CPageContents::getObjectsAtPosition ( OpContainer &  opContainer,
PositionComparator  cmp 
)
inline

Get pdf operators at specified position. This call will be delegated to content stream object.

Parameters
opContainerOperator container where operators in specified are wil be stored.
cmpNull if default kernel area comparator should be used otherwise points to an object which will decide whether an operator is "near" a point.

Definition at line 286 of file cpagecontents.h.

void pdfobjects::CPageContents::getText ( std::string &  text,
const std::string *  encoding = NULL,
const libs::Rectangle *  rc = NULL 
) const

Returns plain text extracted from a page using xpdf code.

This method uses xpdf TextOutputDevice that outputs a page to a text device. Text in a pdf is stored neither word by word nor letter by letter. It is not easy not decide whether two letters form a word. Xpdf uses insane algorithm that works most of the time.

Parameters
textOutput string where the text will be saved.
encodingEncoding format.
rcRectangle from which to extract the text.

Definition at line 364 of file cpagecontents.cc.

References debug::DBG_DBG, gFalse, gFalse, gFalse, globalParams, kernelPrintDbg, and NULL.

void pdfobjects::CPageContents::moveAbove ( boost::shared_ptr< const CContentStream ct)

Move contentstream up one level. Which means it will be repainted by less objects.

Referenced by moveAbove().

void pdfobjects::CPageContents::moveAbove ( size_t  pos)

Definition at line 1029 of file cpagecontents.cc.

References moveAbove().

void pdfobjects::CPageContents::moveBelow ( boost::shared_ptr< const CContentStream ct)

Move contentstream below one level. Which means it will be repainted by more objects.

Referenced by moveBelow().

void pdfobjects::CPageContents::moveBelow ( size_t  pos)

Definition at line 1038 of file cpagecontents.cc.

References moveBelow().

void pdfobjects::CPageContents::remove ( size_t  csnum)

Remove content stream. This function removes all objects from "Contents" entry which form specified contentstream. Indicats that the page changed.

Parameters
csnumNumber of content stream to remove.

Definition at line 343 of file cpagecontents.cc.

References pdfobjects::hasValidPdf().

void pdfobjects::CPageContents::reparse ( )

Reparse content stream using actual display parameters.

Definition at line 781 of file cpagecontents.cc.

References pdfobjects::hasValidPdf(), and pdfobjects::hasValidRef().

void pdfobjects::CPageContents::replaceText ( const std::string &  what,
const std::string &  with 
)

Replaces text in the whole page.

Definition at line 455 of file cpagecontents.cc.

void pdfobjects::CPageContents::reset ( )
virtual
See Also
ICPageModule::reset

Definition at line 1044 of file cpagecontents.cc.

References NULL.

Referenced by ~CPageContents().

template<typename Cont >
static void pdfobjects::CPageContents::setContents ( boost::shared_ptr< CDict dict,
const Cont &  cont 
)
static

Set Contents entry from a container of content streams. Indicats that the page changed.

Referenced by pdfobjects::CPageChanges::displayChange().

template<typename Cont >
void pdfobjects::CPageContents::setContents ( shared_ptr< CDict dict,
const Cont &  cont 
)

Set Contents entry from a container of content streams. Indicats that the page changed.

Definition at line 675 of file cpagecontents.cc.

References pdfobjects::Specification::Page::CONTENTS, pdfobjects::Specification::Page::CONTENTS, pdfobjects::hasValidPdf(), pdfobjects::hasValidPdf(), pdfobjects::hasValidRef(), and pdfobjects::hasValidRef().


The documentation for this class was generated from the following files: