You are trying to mix layers (OCGs/Optional Content) with User Properties.  
Pick one.

-----Original Message-----
From: Amit Sinha [mailto:amit.si...@dataworld.co.in] 
Sent: Tuesday, October 13, 2009 7:22 AM
To: itext-questions@lists.sourceforge.net
Subject: Re: [iText-questions] Object Data Tool doesn't recognize my shape as 
an object in Marked content pdf.



Hi     I need consulting help. What is the standerd fee for help. Please
tell me.

I am trying to build a PDF that contains a simple graphic (square) with two
"Object Data" properties.
When I open the resulting PDF in Acrobat the Object Data Tool doesn't
recognize my shape as an object.

My Code is given Below.

Document document = new Document(PageSize.A4.Rotate());
            try
            {
                PdfWriter writer = PdfWriter.GetInstance(document, new
FileStream(RESULT, FileMode.Create));
                writer.SetAtLeastPdfVersion(PdfWriter.VERSION_1_7);
                writer.SetTagged();
                
                document.Open();
                PdfContentByte cb = writer.DirectContent;                
                PdfStructureTreeRoot tree = writer.StructureTreeRoot;

                PdfStructureElement MainLayer = new
PdfStructureElement(tree, new PdfName("Layers"));
                PdfDictionary userpropertiesMainLayer = new PdfDictionary();
                userpropertiesMainLayer.Put(PdfName.O,
PdfName.USERPROPERTIES);
                userpropertiesMainLayer.Put(PdfName.S, new
PdfName("Figure"));
                MainLayer.Put(PdfName.A, userpropertiesMainLayer);

                PdfStructureElement eTop = new
PdfStructureElement(MainLayer, new PdfName("POI"));
                PdfDictionary userpropertiesTOP = new PdfDictionary();
                userpropertiesTOP.Put(PdfName.O, PdfName.USERPROPERTIES);
                userpropertiesTOP.Put(PdfName.S, new PdfName("Figure"));
                eTop.Put(PdfName.A, userpropertiesTOP);

                PdfStructureElement tag = new PdfStructureElement(eTop, new
PdfName("FIRST"));

                PdfDictionary userproperties = new PdfDictionary();
                userproperties.Put(PdfName.O, PdfName.USERPROPERTIES);
                userproperties.Put(PdfName.S, new PdfName("Figure"));
                PdfArray properties = new PdfArray();
                PdfDictionary property1 = new PdfDictionary();
                property1.Put(PdfName.N, new PdfString("Value1"));
                property1.Put(PdfName.V, new PdfString("Value2"));
                properties.Add(property1);
                PdfDictionary property2 = new PdfDictionary();
                property2.Put(PdfName.N, new PdfString("Value3"));
                property2.Put(PdfName.V, new PdfString("Value4"));
                properties.Add(property2);
                PdfDictionary property3 = new PdfDictionary();
                property3.Put(PdfName.N, new PdfString("Value5"));
                property3.Put(PdfName.V, new PdfString("Value6"));
                properties.Add(property3);                
                userproperties.Put(PdfName.P, properties);
                
                tag.Put(PdfName.A, userproperties);

                PdfLayer Lay1 = new PdfLayer("Tag Object", writer);
                cb.BeginMarkedContentSequence(tag);
                cb.BeginLayer(Lay1);
                cb.SetColorFill(Color.RED);
                cb.Rectangle(340f, 340f, 80f, 100f);
                cb.Fill();
                cb.EndLayer();
                cb.EndMarkedContentSequence();
                                
            }
            catch (DocumentException de)
            {

            }
            catch (IOException ioe)
            {

            }
            document.Close();


Please Help me 

-- 
View this message in context: 
http://www.nabble.com/Object-Data-Tool-doesn%27t-recognize-my-shape-as-an-object-in-Marked-content-pdf.-tp25868117p25871090.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to