Hi Dom,

can you add the below changes to the main tree before
the new 0.6.0 release please. 

As I needed the PdfDocument class working with byte array, 
I added the following method PdfDocument::Load( const char* pBuffer,
long lLen ). The PdfParser initialized here in this method must be adapted 
too, added new ctor and ParseFile methods to the PdfParser class.
-> see email below, I've done the changes to the 0.5.0 version!

PdfDocument:
void PdfDocument::Load( const char* pBuffer, long lLen )
{
        this->Clear();

        PdfParser parser( &m_vecObjects, pBuffer, lLen, true );
        InitFromParser( &parser );
        InitPagesTree();
}

PdfParser:
PdfParser::PdfParser( PdfVecObjects* pVecObjects,const char* pBuffer, long 
lLen, bool bLoadOnDemand )
: PdfTokenizer(), m_vecObjects( pVecObjects )
{
        this->Init();
        this->ParseFile( pBuffer, lLen, bLoadOnDemand );
}

void PdfParser::ParseFile( const char* pBuffer, long lLen, bool bLoadOnDemand )
{
        // make sure everything is clean
        Clear();

        m_bLoadOnDemand = bLoadOnDemand;

        m_device           = PdfRefCountedInputDevice( pBuffer, lLen );
        if( !m_device.Device() )
        {
                PODOFO_RAISE_ERROR_INFO( ePdfError_FileNotFound, "" );
        }

        if( !IsPdfFile() )
        {
                PODOFO_RAISE_ERROR( ePdfError_NoPdfFile );
        }

        ReadDocumentStructure();
        try {
                ReadObjects();
        } catch( PdfError & e ) {
                e.AddToCallstack( __FILE__, __LINE__, "Unable to load objects 
from file." );
                throw e;
        }

        // Now sort the list of objects
        m_vecObjects->Sort();
}

Thank you.

Bye
Sebastian

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 20. Dezember 2007 14:11
An: [email protected]
Cc: EXTERNAL Loch Sebastian (Firma Ferchau; BhP/TEF17); Leonard Rosenthol
Betreff: Re: [Podofo-users] New method PdfDocument

Hi, 

I also thought that PdfMemDocument (from current trunk) would have a Load 
method that takes a PdfInputDevice. But neither PdfMemDocument nor PdfParser 
do have one.

That's no big deal, because PdfParser works internally only with a 
PdfInputDevice, so the relevant code can be easily added.

If you have code available you can post it here and I will integrate it into 
the main tree.

best regards,
        Dom

Am Thursday 20 December 2007 schrieb EXTERNAL Loch Sebastian (Firma Ferchau; 
BhP/TEF17):
> Hi Leonard,
>
> I can't find where PdfDocument take a std::istream as input,
> only when writing the document you can use a PdfOutputDevice
> who takes a std::ostream.
>
> Can you have a look at your code please.
>
> Regards
> Sebastian
>
> > -----Ursprüngliche Nachricht-----
> > Von: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] Im
> > Auftrag von Leonard Rosenthol
> > Gesendet: Donnerstag, 20. Dezember 2007 12:53
> > An: EXTERNAL Loch Sebastian (Firma Ferchau; BhP/TEF17)
> > Cc: [EMAIL PROTECTED]; [email protected]
> > Betreff: Re: [Podofo-users] New method PdfDocument
> >
> > It's been a while since I looked at the code, but doesn't
> > PdfDocument
> > take a std::istream, of which std::istrstream is a valid subtype?
> >
> > Use that - no need to change any code.
> >
> > Leonard
> >
> > On Dec 20, 2007, at 4:45 AM, EXTERNAL Loch Sebastian (Firma Ferchau;
> >
> > BhP/TEF17) wrote:
> > > Hello all,
> > >
> > > as I get the pdf document from the client for the processing on the
> > > server as byte array I needed a new method to load a pdf document
> > > taking
> > >
> > > a buffer as argument.
> > >
> > > I added the following method PdfDocument::Load( const char* pBuffer,
> > > long lLen ).
> > > The PdfParser initialized here in this method must be adapted too,
> > > added
> > > new
> > > ctor and ParseFile methods to the PdfParser class.
> > >
> > > Can we add this changes to the PoDoFo development branch?
> > > How can I get this changes commited?
> > >
> > > Best Regards and a Merry Christmas
> > > Sebastian
> > >
> > > PS: My description how I have done the conversion from CALS
> >
> > format to
> >
> > > pdf
> > > is still missing, I know, probably I will get this done during my
> > > upcoming
> > > two weeks vacation...
> >
> > --------------------------------------------------------------
> > --------
> >
> > > ---
> > > SF.Net email is sponsored by:
> > > Check out the new SourceForge.net Marketplace.
> > > It's the best place to buy or sell services
> > > for just about anything Open Source.
> > > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/
> > > marketplace
> > > _______________________________________________
> > > Podofo-users mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/podofo-users
> >
> > --------------------------------------------------------------
> > -----------
> > SF.Net email is sponsored by:
> > Check out the new SourceForge.net Marketplace.
> > It's the best place to buy or sell services
> > for just about anything Open Source.
> > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.n
> > et/marketplace
> > _______________________________________________
> > Podofo-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/podofo-users
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services
> for just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplac
>e _______________________________________________
> Podofo-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/podofo-users



-- 
**********************************************************************
Dominik Seichter - [EMAIL PROTECTED]
KRename  - http://www.krename.net  - Powerful batch renamer for KDE
KBarcode - http://www.kbarcode.net - Barcode and label printing
PoDoFo - http://podofo.sf.net - PDF generation and parsing library
SchafKopf - http://schafkopf.berlios.de - Schafkopf, a card game,  for KDE
Alan - http://alan.sf.net - A Turing Machine in Java
**********************************************************************

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to