Source Code Cross Referenced for FormXObject.java in  » PDF » PDFClown-0.0.5 » it » stefanochizzolini » clown » documents » contents » xObjects » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » PDF » PDFClown 0.0.5 » it.stefanochizzolini.clown.documents.contents.xObjects 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:          Copyright © 2006,2007 Stefano Chizzolini. http://clown.stefanochizzolini.it
003:
004:          Contributors:
005:         * Stefano Chizzolini (original code developer, http://www.stefanochizzolini.it):
006:              contributed code is Copyright © 2006,2007 by Stefano Chizzolini.
007:
008:          This file should be part of the source code distribution of "PDF Clown library"
009:          (the Program): see the accompanying README files for more info.
010:
011:          This Program is free software; you can redistribute it and/or modify it under
012:          the terms of the GNU General Public License as published by the Free Software
013:          Foundation; either version 2 of the License, or (at your option) any later version.
014:
015:          This Program is distributed in the hope that it will be useful, but WITHOUT ANY
016:          WARRANTY, either expressed or implied; without even the implied warranty of
017:          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more details.
018:
019:          You should have received a copy of the GNU General Public License along with this
020:          Program (see README files); if not, go to the GNU website (http://www.gnu.org/).
021:
022:          Redistribution and use, with or without modification, are permitted provided that such
023:          redistributions retain the above copyright notice, license and disclaimer, along with
024:          this list of conditions.
025:         */
026:
027:        package it.stefanochizzolini.clown.documents.contents.xObjects;
028:
029:        import it.stefanochizzolini.clown.documents.Document;
030:        import it.stefanochizzolini.clown.documents.contents.Contents;
031:        import it.stefanochizzolini.clown.documents.contents.IContentContext;
032:        import it.stefanochizzolini.clown.documents.contents.Resources;
033:        import it.stefanochizzolini.clown.documents.contents.objects.ContentObject;
034:        import it.stefanochizzolini.clown.files.File;
035:        import it.stefanochizzolini.clown.objects.IPdfNumber;
036:        import it.stefanochizzolini.clown.objects.PdfArray;
037:        import it.stefanochizzolini.clown.objects.PdfDictionary;
038:        import it.stefanochizzolini.clown.objects.PdfDirectObject;
039:        import it.stefanochizzolini.clown.objects.PdfName;
040:        import it.stefanochizzolini.clown.objects.PdfRectangle;
041:        import it.stefanochizzolini.clown.objects.PdfReference;
042:        import it.stefanochizzolini.clown.util.NotImplementedException;
043:
044:        import java.awt.Dimension;
045:        import java.awt.geom.Dimension2D;
046:
047:        /**
048:         Form external object [PDF:1.6:4.9].
049:         @version 0.0.5
050:         */
051:        public class FormXObject extends XObject implements  IContentContext {
052:            // <class>
053:            // <dynamic>
054:            // <constructors>
055:            /**
056:              Creates a new form within the given document context, using default resources.
057:              @version 0.0.5
058:             */
059:            public FormXObject(Document context) {
060:                this (context, null);
061:            }
062:
063:            /**
064:              Creates a new form within the given document context, using custom resources.
065:              @version 0.0.5
066:              @since 0.0.5
067:             */
068:            public FormXObject(Document context, Resources resources) {
069:                super (context);
070:
071:                PdfDictionary header = getBaseDataObject().getHeader();
072:                header.put(PdfName.Subtype, PdfName.Form);
073:                header.put(PdfName.BBox, new PdfRectangle(0, 0, 0, 0));
074:
075:                // No resources collection?
076:                /* NOTE: Resources collection is mandatory. */
077:                if (resources == null) {
078:                    resources = new Resources(context);
079:                }
080:                header.put(PdfName.Resources, resources.getBaseObject());
081:            }
082:
083:            /**
084:              <h3>Remarks</h3>
085:              <p>For internal use only.</p>
086:             */
087:            public FormXObject(PdfDirectObject baseObject) {
088:                super (baseObject);
089:            }
090:
091:            // </constructors>
092:
093:            // <interface>
094:            // <public>
095:            @Override
096:            public FormXObject clone(Document context) {
097:                throw new NotImplementedException();
098:            }
099:
100:            /**
101:              @version 0.0.5
102:              @since 0.0.5
103:             */
104:            @Override
105:            public double[] getMatrix() {
106:                /*
107:                  NOTE: Form-space-to-user-space matrix is identity [1 0 0 1 0 0] by default,
108:                  but may be adjusted by setting the Matrix entry in the form dictionary [PDF:1.6:4.9].
109:                 */
110:                PdfArray matrix = (PdfArray) File.resolve(getBaseDataObject()
111:                        .getHeader().get(PdfName.Matrix));
112:                if (matrix == null) {
113:                    return new double[] { 1, // a.
114:                            0, // b.
115:                            0, // c.
116:                            1, // d.
117:                            0, // e.
118:                            0 // f.
119:                    };
120:                } else {
121:                    return new double[] {
122:                            ((IPdfNumber) matrix.get(0)).getNumberValue(), // a.
123:                            ((IPdfNumber) matrix.get(1)).getNumberValue(), // b.
124:                            ((IPdfNumber) matrix.get(2)).getNumberValue(), // c.
125:                            ((IPdfNumber) matrix.get(3)).getNumberValue(), // d.
126:                            ((IPdfNumber) matrix.get(4)).getNumberValue(), // e.
127:                            ((IPdfNumber) matrix.get(5)).getNumberValue() // f.
128:                    };
129:                }
130:            }
131:
132:            /**
133:              Gets the form size.
134:             */
135:            @Override
136:            public Dimension2D getSize() {
137:                PdfArray box = (PdfArray) File.resolve(getBaseDataObject()
138:                        .getHeader().get(PdfName.BBox));
139:
140:                return new Dimension((int) ((IPdfNumber) box.get(2))
141:                        .getNumberValue(), (int) ((IPdfNumber) box.get(3))
142:                        .getNumberValue());
143:            }
144:
145:            /**
146:              Sets the resources associated to the form.
147:             */
148:            public void setResources(Resources value) {
149:                getBaseDataObject().getHeader().put(PdfName.Resources,
150:                        value.getBaseObject());
151:            }
152:
153:            /**
154:              Sets the form size.
155:             */
156:            @Override
157:            public void setSize(Dimension2D value) {
158:                PdfDirectObject box = getBaseDataObject().getHeader().get(
159:                        PdfName.BBox);
160:
161:                PdfArray boxObject = (PdfArray) File.resolve(box);
162:                ((IPdfNumber) boxObject.get(2))
163:                        .setNumberValue(value.getWidth());
164:                ((IPdfNumber) boxObject.get(3)).setNumberValue(value
165:                        .getHeight());
166:
167:                File.update(box);
168:            }
169:
170:            // <IContentContext>
171:            public PdfArray getBox() {
172:                return (PdfArray) File.resolve(getBaseDataObject().getHeader()
173:                        .get(PdfName.BBox)); // Required [PDF:1.6:4.9.1].
174:            }
175:
176:            /**
177:              Gets the content stream associated to the form.
178:             */
179:            public Contents getContents() {
180:                return new Contents(getBaseObject(),
181:                        ((PdfReference) getBaseObject()).getIndirectObject(),
182:                        this );
183:            }
184:
185:            /**
186:              Gets the resources associated to the form.
187:             */
188:            public Resources getResources() {
189:                return new Resources(getBaseDataObject().getHeader().get(
190:                        PdfName.Resources), ((PdfReference) getBaseObject())
191:                        .getIndirectObject());
192:            }
193:
194:            // <IContentEntity>
195:            /**
196:              @version 0.0.5
197:              @since 0.0.5
198:             */
199:            public ContentObject toInlineObject(IContentContext context) {
200:                throw new NotImplementedException();
201:            }
202:
203:            /**
204:              @version 0.0.5
205:              @since 0.0.5
206:             */
207:            public XObject toXObject(Document context) {
208:                throw new NotImplementedException();
209:            }
210:            // </IContentEntity>
211:            // </IContentContext>
212:            // </public>
213:            // </interface>
214:            // </dynamic>
215:            // </class>
216:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.