Source Code Cross Referenced for HelloWorldSample.java in  » PDF » PDFClown-0.0.5 » it » stefanochizzolini » clown » samples » 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.samples 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package it.stefanochizzolini.clown.samples;
02:
03:        import it.stefanochizzolini.clown.bytes.Buffer;
04:        import it.stefanochizzolini.clown.documents.Document;
05:        import it.stefanochizzolini.clown.documents.Page;
06:        import it.stefanochizzolini.clown.documents.PageFormat;
07:        import it.stefanochizzolini.clown.documents.contents.Contents;
08:        import it.stefanochizzolini.clown.documents.contents.ContentScanner;
09:        import it.stefanochizzolini.clown.documents.contents.Fonts;
10:        import it.stefanochizzolini.clown.documents.contents.Resources;
11:        import it.stefanochizzolini.clown.documents.contents.composition.PrimitiveFilter;
12:        import it.stefanochizzolini.clown.documents.contents.fonts.Font;
13:        import it.stefanochizzolini.clown.documents.contents.fonts.StandardType1Font;
14:        import it.stefanochizzolini.clown.files.File;
15:        import it.stefanochizzolini.clown.objects.PdfName;
16:
17:        import java.awt.geom.Point2D;
18:
19:        /**
20:         This sample is a minimalist introduction to the use of PDF Clown.
21:         <h3>Remarks</h3>
22:         <p>Skimming through its source code you may appreciate the BIG simplification that has been
23:         introduced with the current version (0.0.5): PDF Clown keeps unaltered its powerful facilities
24:         for fine-grained access to the PDF domain, introducing at the same time a bunch of shortcuts
25:         that automate routine tasks and ease users' experience. This way, users can opt either to gain
26:         full control over the PDF model or to go straight to their high-level intended result.</p>
27:         <p>PDF Clown's stacked architecture allows multiple levels of progressive
28:         abstraction (byte, token, object, file, document, content streaming, content block typesetting,
29:         content flow typesetting), to narrow the working scope so much as needed.</p>
30:         <p>Since version 0.0.3, it has reached the content block typesetting (i.e. content
31:         placement within a page's canvas) implementation. Content flow typesetting (i.e. content
32:         placement across multiple pages) implementation will be the target of the following releases: it
33:         will deliver a higher level of abstraction that shall permit further coding simplification, at
34:         your will.</p>
35:         */
36:        public class HelloWorldSample implements  ISample {
37:            // <dynamic>
38:            // <interface>
39:            // <public>
40:            // <ISample>
41:            public void run(PDFClownSampleLoader loader) {
42:                // 1. Instantiate a new PDF file!
43:                /* NOTE: a File object is the low-level (syntactic) representation of a PDF file. */
44:                File file = new File();
45:
46:                // 2. Get its corresponding document!
47:                /* NOTE: a Document object is the high-level (semantic) representation of a PDF file. */
48:                Document document = file.getDocument();
49:
50:                // 3. Insert the contents into the document!
51:                populate(document);
52:
53:                // (boilerplate metadata insertion -- ignore it)
54:                loader.buildAccessories(document, this .getClass(),
55:                        "Hello world", "a simple 'hello world'");
56:
57:                // 4. Serialize the PDF file (again, boilerplate code -- see the PDFClownSampleLoader class source code)!
58:                loader.serialize(file, this .getClass().getSimpleName(), false);
59:            }
60:
61:            // </ISample>
62:            // </public>
63:
64:            // <private>
65:            /**
66:              Populates a PDF file with contents.
67:             */
68:            private void populate(Document document) {
69:                // 1. Add the page to the document!
70:                Page page = new Page(document); // Instantiates the page inside the document context.
71:                document.getPages().add(page); // Puts the page in the pages collection.
72:
73:                // 2. Create a content builder for the page!
74:                PrimitiveFilter builder = new PrimitiveFilter(page);
75:
76:                // 3. Inserting contents...
77:                // Set the font to use!
78:                builder.setFont(new StandardType1Font(document,
79:                        StandardType1Font.FamilyNameEnum.Courier, true, false),
80:                        32);
81:                // Show the text onto the page!
82:                builder.showText("Hello World!", new Point2D.Double(32, 48));
83:
84:                // 4. Flush the contents into the page!
85:                builder.flush();
86:            }
87:            // </private>
88:            // </interface>
89:            // </dynamic>
90:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.