Makes a FormXObject out of the page.




FormXObject MakeFormXObject()

[Visual Basic]
Function MakeFormXObject() As FormXObject



Name Description
return The newly created FormXObject.




Makes a FormXObject out of the page.

This process involves copying the page content stream to a new Form XObject and referencing any required resources. The current page is left unaltered.

The returned FormXObject will have been added to the same ObjectSoup as contains the Page. The returned Form XObject can then be added to other pages using methods such as AddXObject.





This example shows how to take a page, convert it into a separate drawing object and then draw it, scaled, onto the page it came from.


using (Doc doc = new Doc()) {   doc.Read(Server.MapPath("../mypics/HyperX.pdf"));   Page page1 = doc.ObjectSoup[doc.Page] as Page;   FormXObject form = page1.MakeFormXObject();   doc.Transform.Magnify(0.5, 0.5, 0, 0);   doc.Page = doc.AddPage();   Page page2 = doc.ObjectSoup[doc.Page] as Page;   string name = page2.AddResource(form, "XObject", "Iabc");   // Here we create our own layer for the purposes of the demonstration.   // However a simpler approach would be to use Doc.AddXObject.   StreamObject layer = new StreamObject(doc.ObjectSoup);   layer.SetText(String.Format("q {0} cm /{1} Do Q ", doc.Transform.ToString(), name));   page2.AddLayer(layer);   doc.Save(Server.MapPath("exampleformxobject.pdf")); }

exampleformxobject.pdf [Page 1]

exampleformxobject.pdf [Page 2]