void PdfAnnotation::SetAppearanceStream( PdfXObject* pObject ) { PdfDictionary dict; PdfDictionary internal; if( !pObject ) { PODOFO_RAISE_ERROR( ePdfError_InvalidHandle ); } // when adding #On/Off# entries to #AP#, and set #AS# to "On", // will cause desktop adobe pdf reader not showing display content of the Appearance Stream of PolyLine // so comment out it, joy@onyx // internal.AddKey( "On", pObject->GetObject()->Reference() ); // internal.AddKey( "Off", pObject->GetObject()->Reference() ); // // dict.AddKey( "N", internal ); // // this->GetObject()->GetDictionary().AddKey( "AP", dict ); // this->GetObject()->GetDictionary().AddKey( "AS", PdfName("On") ); dict.AddKey( "N", pObject->GetObject()->Reference() ); this->GetObject()->GetDictionary().AddKey( "AP", dict ); }
void PdfExtGState::SetFrequency( double frequency ) { PdfDictionary halftoneDict; halftoneDict.AddKey( "HalftoneType", PdfVariant( 1LL ) ); halftoneDict.AddKey( "Frequency", PdfVariant( frequency ) ); halftoneDict.AddKey( "Angle", PdfVariant( 45.0 ) ); halftoneDict.AddKey( "SpotFunction", PdfName( "SimpleDot" ) ); m_pObject->GetDictionary().AddKey( "HT", halftoneDict); }
void PdfFileSpec::EmbeddFileFromMem( PdfObject* pStream, const unsigned char* data, ptrdiff_t size ) const { PdfMemoryInputStream memstream(reinterpret_cast<const char*>(data),size); pStream->GetStream()->Set( &memstream ); // Add additional information about the embedded file to the stream PdfDictionary params; params.AddKey( "Size", static_cast<pdf_int64>(size) ); pStream->GetDictionary().AddKey("Params", params ); }
void PdfExtGState::SetFrequency( double frequency ) { PdfDictionary halftoneDict; halftoneDict.AddKey( "HalftoneType", PdfVariant( static_cast<pdf_int64>(PODOFO_LL_LITERAL(1)) ) ); halftoneDict.AddKey( "Frequency", PdfVariant( frequency ) ); halftoneDict.AddKey( "Angle", PdfVariant( 45.0 ) ); halftoneDict.AddKey( "SpotFunction", PdfName( "SimpleDot" ) ); this->GetObject()->GetDictionary().AddKey( "HT", halftoneDict); }
void PdfFileSpec::EmbeddFile( PdfObject* pStream, const char* pszFilename ) const { PdfFileInputStream stream( pszFilename ); pStream->GetStream()->Set( &stream ); // Add additional information about the embedded file to the stream PdfDictionary params; params.AddKey( "Size", static_cast<pdf_int64>(stream.GetFileLength()) ); // TODO: CreationDate and ModDate pStream->GetDictionary().AddKey("Params", params ); }
void PdfDestination::AddToDictionary( PdfDictionary & dictionary ) const { // Do not add empty destinations if( !m_array.size() ) return; // since we can only have EITHER a Dest OR an Action // we check for an Action, and if already present, we throw if ( dictionary.HasKey( PdfName( "A" ) ) ) PODOFO_RAISE_ERROR( ePdfError_ActionAlreadyPresent ); dictionary.RemoveKey( "Dest" ); dictionary.AddKey( "Dest", m_pObject ); }
void PdfFileSpec::Init( const char* pszFilename, const unsigned char* data, ptrdiff_t size, bool bStripPath ) { PdfObject* pEmbeddedStream; PdfString filename( MaybeStripPath( pszFilename, true) ); this->GetObject()->GetDictionary().AddKey( "F", this->CreateFileSpecification( MaybeStripPath( pszFilename, bStripPath) ) ); this->GetObject()->GetDictionary().AddKey( "UF", filename.ToUnicode () ); PdfDictionary ef; pEmbeddedStream = this->CreateObject( "EmbeddedFile" ); this->EmbeddFileFromMem( pEmbeddedStream, data, size ); ef.AddKey( "F", pEmbeddedStream->Reference() ); this->GetObject()->GetDictionary().AddKey( "EF", ef ); }
void PdfAnnotation::SetAppearanceStream( PdfXObject* pObject ) { PdfDictionary dict; PdfDictionary internal; if( !pObject ) { PODOFO_RAISE_ERROR( ePdfError_InvalidHandle ); } internal.AddKey( "On", pObject->GetObject()->Reference() ); internal.AddKey( "Off", pObject->GetObject()->Reference() ); dict.AddKey( "N", internal ); m_pObject->GetDictionary().AddKey( "AP", dict ); m_pObject->GetDictionary().AddKey( "AS", PdfName("On") ); }
void PdfFileSpec::Init( const char* pszFilename, bool bEmbedd, bool bStripPath ) { PdfObject* pEmbeddedStream; PdfString filename( MaybeStripPath( pszFilename, true) ); this->GetObject()->GetDictionary().AddKey( "F", this->CreateFileSpecification( MaybeStripPath( pszFilename, bStripPath ) ) ); this->GetObject()->GetDictionary().AddKey( "UF", filename.ToUnicode () ); if( bEmbedd ) { PdfDictionary ef; pEmbeddedStream = this->CreateObject( "EmbeddedFile" ); this->EmbeddFile( pEmbeddedStream, pszFilename ); ef.AddKey( "F", pEmbeddedStream->Reference() ); this->GetObject()->GetDictionary().AddKey( "EF", ef ); } }