[Podofo-users] Complex scripts

2018-01-13 Thread Sandro Mani

Hi

I use PoDoFo for writing PDFs in gImageReader and have received reports 
that complex scripts (i.e. arabic, devanagari, ...) are not properly 
handled. I could only find one related thread in the past [1], so I was 
wondering whether anyone has done any work in this area since resp. 
whether anyone has some sample code?


Thanks
Sandro

[1] 
https://www.mail-archive.com/podofo-users@lists.sourceforge.net/msg02362.html



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users


Re: [Podofo-users] Difference between PdfObject::GetReference() and PdfObject::Reference()

2018-01-13 Thread Dmitry Salychev
Hi, Georg.

I'm not a developer of PoDoFo and don't know any details lying deep there.
You may just take a look at the src/base/PdfObject.h and
src/base/PdfVariant.h to understand the difference between these two
functions:

inline const PdfReference & Reference() const;
inline const PdfReference & GetReference() const;

and their implementations:

const PdfReference & PdfObject::Reference() const
{
return m_reference;
}

const PdfReference & PdfVariant::GetReference() const
{
DelayedLoad();

if( !IsReference() )
{
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
}

// Do not change this to an reinterpret_cast
// We need a c-style casts here to avoid crashes
// because a reinterpret_cast might point to a different position.
return *((PdfReference*)m_Data.pData);
}

Personally, I didn't have a need to find object by its object and generation
numbers, but I had to obtain 'em from an existing one. There is a chance
that
this piece of code to get a specific XObject by its name will be useful:

PdfObject *xobj;
int nobj, ngen;

xobj = get_xobject(_name, (PdfCanvas *)page);
/* Is object a reference? */
if (xobj->IsReference())
xobj = doc->GetObjects().GetObject(xobj->GetReference());
ngen = xobj->Reference().GenerationNumber();
nobj = xobj->Reference().ObjectNumber();
/* ... */

static PdfObject *get_xobject(PdfName *xobjname, PdfCanvas *pPage)
{
PdfObject *pResources = pPage->GetResources();
PdfObject *xobj_dict;

if (pResources != NULL &&
pResources->GetDictionary().HasKey(PdfName("XObject"))) {
xobj_dict = pResources->GetIndirectKey(PdfName("XObject"));
if (xobj_dict != NULL && xobj_dict->IsDictionary()) {
return xobj_dict->GetIndirectKey(*xobjname);
}
}
return NULL;
}


Regards,

- Dmitry

On Fri, Jan 12, 2018 at 10:35 PM, Georg Funk  wrote:

> Dear podofo-developers,
>
> could you please describe the difference between PdfObject::GetReference()
> and PdfObject::Reference()?
> I need a way to access PdfObjects from within a PfVecObjects vector by
> their object and generation number. Further I need a function to follow
> indirect references of an object.
> Can I use the above mentioned methods for these purposes?
>
> Thank you in advance!
>
> Regards,
> Georg
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Podofo-users mailing list
> Podofo-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/podofo-users
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users