OK.. I think I've solved it.
Your example below has a small error, I think.  It doesn't work as previously 
explained.I think this was due to the fact that when constructing the 
PdfVariant with a PdfString, I have previously tried to construct a PdfString 
the same way I construct a PdfVariant.  The line in bold below shows why I was 
running into this problem. I get the reported error on the third line if I 
dont' do this.  Could you let me know if I'm missing a point  here.. Thanks



std::string str = "Hallo World!";PdfVariant var(PdfString (str,NULL)); // (I've 
added a NULL for string encoding in this case)PdfString pdfStr = 
var.GetString();cout << pdfStr.GetString() << endl;cout << 
var.GetDataTypeString() << endl;cout << var.GetDataType() << endl;
Date: Wed, 28 Aug 2013 22:02:07 +0200
Subject: Re: [Podofo-users] PdfVariants and Data Types?
From: domseich...@googlemail.com
To: abdom...@hotmail.com
CC: podofo-users@lists.sourceforge.net

Hi,
Take a look at the API documentation: 
http://podofo.sourceforge.net/doc/html/classPoDoFo_1_1PdfVariant.html

The following code should work:std::string str = "Hallo World!";PdfVariant 
var(PdfString(str));PdfString pdfStr = var.GetString();cout << 
pdfStr.GetString()

It should work similar for all the other types like PdfName, PdfDictionary etc.
Cheers, Dominik




On Wed, Aug 28, 2013 at 3:31 PM, Domonic Tom <abdom...@hotmail.com> wrote:




I'm just trying to get some basic grasp of PdfVariants.  I can't seem to do 
anything with them. Would anyone be able to explain whether a PdfVariant can be 
turned into another Pdf Data Type or does it just support it in some elusive 
way.

If it can hold any data type (like the VB variant type) then how is it 
initialized?  It's quiet clear that .... myvar = "string";   doesn't work.  Nor 
does myvar("string").  

I'm having trouble understanding them.. Why won't the below work?  I get an 
error :'request for member 'GetDataTypeString' in 'myvar', which is of 
non-class type '

PdfVariant myvar(const PdfString &st);
cout << myvar.GetDataTypeString();
Thanks                                    


------------------------------------------------------------------------------

Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!

Discover the easy way to master current and previous Microsoft technologies

and advance your career. Get an incredible 1,500+ hours of step-by-step

tutorial videos with LearnDevNow. Subscribe today and save!

http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________


Podofo-users mailing list

Podofo-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/podofo-users



                                          
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to