-
1. Re: iText (PDF) support in Seam
m.schuetz Jan 19, 2007 5:47 PM (in response to norman.richards)As I already mentioned in a former post I am not quite happy with the way Seam generates the extension for the generated pdf-file.
Is it possible that Seam would redirect to a "simple" pdf-file? The name of the pdf-file could be defined in the link from the content-page.
For example:
mypage.xhtml... <s:link value="/pdf.jsf" pdfName="myPdf" /> or even better <s:pdf value="/pdf.jsf" pdfName="myPdf" /> or maybe <p:link value="/pdf.jsf" pdfName="myPdf" />
pdf.xhtml<p:document xmlns:p="http://jboss.com/products/seam/pdf" title="Hello"> <p:paragraph>Hello #{user.name}!</p:paragraph> </p:document>
and the generated file would be: /myPdf.pdf
What's your opinion about that - or would it cause problems with accessing seam components? -
2. Re: iText (PDF) support in Seam
venkateshbr Jan 20, 2007 1:06 AM (in response to norman.richards)Does the current version support embedding digital signatures in pdf or signing a pdf file with a digital signature. If i am not wrong you can do this in iText through the use of pdfStamper. This feature would be used in all e-business sites and it would be really great to have this feature supported through seam.
-
3. Re: iText (PDF) support in Seam
norman.richards Jan 20, 2007 2:49 AM (in response to norman.richards)I've added some preliminary support for using file extensions with PDFs.
components.xml:<pdf:documentStore useExtensions="true" />
web.xml:<filter> <filter-name>Seam Servlet Filter</filter-name> <filter-class>org.jboss.seam.servlet.SeamServletFilter</filter-class> </filter> <filter-mapping> <filter-name>Seam Servlet Filter</filter-name> <url-pattern>*.pdf</url-pattern> </filter-mapping> <servlet> <servlet-name>Document Store Servlet</servlet-name> <servlet-class>org.jboss.seam.pdf.DocumentStoreServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Document Store Servlet</servlet-name> <url-pattern>*.pdf</url-pattern> </servlet-mapping>
A PDF URL would have the form /seam-doc.pdf. I'll add support for /yourViewId.pdf soon. It's just getting a bit late...
My only concerns are the configuration overhead and the fact that doing it like this prevents you from serving a plain PDF out of your web-app. (obviously you can get around that by being more clever with the URL pattern, but that adds yet MORE configuration overhead) -
4. Re: iText (PDF) support in Seam
norman.richards Jan 20, 2007 2:55 AM (in response to norman.richards)Hmmm - digital signatures are an interesting idea. I hadn't given it much thought. iText does support the feature, so it's definitely a possibility. Would you be willing to open a JIRA feature request for it? If it gets a few votes, I'll definitely bump it up on the priority list.
-
5. Re: iText (PDF) support in Seam
kukeltje Jan 20, 2007 9:52 AM (in response to norman.richards)http://jira.jboss.org/jira/browse/JBSEAM-678 (ventateshbr did it, it already has one vote in one day... :-))
-
6. Re: iText (PDF) support in Seam
rbz285 Jan 20, 2007 12:49 PM (in response to norman.richards)Let me start off by saying it looks really good.
My aim when I tried this out was to create adhoc PDF versions of tabular data in a generic fashion, and came across the following questions and issues:
- unlike in html, table columns must have their width explicitly set, is there a way around this or will I need to write some text size calculation routines in order to display it nicely
- how can I format the cell data ? in xhtml I use an h:outputText with a nested converter tag for numbers and dates but I can't do that within the pdf tags
- I would also like to be able to specify landscape page orientation to fit more columns on the page (prefereably at the chapter/section level rather than the whole document)
More general points
- The phase listener only appears to catch pdfs launched from pages in the root of the webapp as it checks for startsWith "/seam-doc"
- As others have mentioned I would also like to be able to use a different file ending to .seam and would like to be able to use various names for the pdf, ideally on a per document basis (I haven't tried the servlet version in cvs yet)
- lastly, the sessional document store doesn't appear to be ever cleared of the pdf data so will fill up the session with data. I'd be tempted to remove the data from the store after it has been sent down to the client (losing the ability to refresh the pdf without going back to the link that generated it), and/or using a store that has a cache expiry timeout
Next thing I was going to try is a seam-gen style template for my entities so they can be printed nicely as PDF for people who like paper
thanks -
7. Re: iText (PDF) support in Seam
norman.richards Jan 20, 2007 12:49 PM (in response to norman.richards)Thanks. If you have any specific requirements for the functionality or suggestions on how to make it work, please add them to the task.
-
8. Re: iText (PDF) support in Seam
norman.richards Jan 20, 2007 3:05 PM (in response to norman.richards)As best as I can tell, iText will not compute column widths for you. You need to determine your column structure in advance. Keep in mind that in iText, the table begins rendering to the PDF long before the end of the table is reached. (allowing for long multi-page tables)
You are right. I actually thought I added a renderer for h:outputText, but looking back I see I only added one for literal text. I'll try and get that sometime this weekend.
You can specify any page size, but looking through the itext page sizes, I see there are no constants for lanscape mode. I've added pageSize="width height" and orientation="landscape|portrait" to deal with this.
I didn't realize I left the DocumentStore in the session. Woops. That should be a conversational component. -
9. Re: iText (PDF) support in Seam
rbz285 Jan 21, 2007 9:20 AM (in response to norman.richards)for the page orientation, there is an example on the lowagie site, its called landscapeportrait on page
http://itextdocs.lowagie.com/tutorial/#part1
the code is at
http://itextdocs.lowagie.com/examples/com/lowagie/examples/general/LandscapePortrait.java
it seems to use a convenient rotate method on the page size class -
10. Re: iText (PDF) support in Seam
rbz285 Jan 21, 2007 9:51 AM (in response to norman.richards)thanks for the response, I'll probably end up doing a simple guesstimate of column width ratios based on the heading row and the first row of data using a custom EL function
However, in order to use it I need to be able to set the table attributes for widths and columns using an EL expression. It doesn't like it at the moment, I presume thats what the getValueBinding is used for on some of the other attributes -
11. Re: iText (PDF) support in Seam
norman.richards Jan 21, 2007 11:14 AM (in response to norman.richards)Sorry - the lack of a value binding was just oversight on my part. I think in general most people will want to statically size their tables, but I'll be glad to work with to make sure you have whatever you need to dynamically size them. Let me know if you run into any particular problems.
-
12. Re: iText (PDF) support in Seam
norman.richards Jan 21, 2007 11:14 AM (in response to norman.richards)Oh and, I did add the width valuebinding in CVS.
-
13. Re: iText (PDF) support in Seam
luizruiz Jan 21, 2007 4:09 PM (in response to norman.richards)It's great!
My suggestion is to add to an archive taglib.tld for integration with IDEs -
14. Re: iText (PDF) support in Seam
luizruiz Jan 21, 2007 4:39 PM (in response to norman.richards)- As others have mentioned I would also like to be able to use a different file ending to .seam and would like to be able to use various names for the pdf, ideally on a per document basis (I haven't tried the servlet version in cvs yet)
The p:document tag could have an attribute 'fileName'.