X

Geertjan's Blog

  • May 29, 2006

Options Panel for PDF Settings

Geertjan Wielenga
Product Manager
Made a lot of progress implementing the iText API. I'm trying to use as much of its functionality as possible. Here's how the Options panel now looks (I ended up dedicating a special panel to it, although it should probably be accessible via a "Print to PDF" menu item under the File menu, to mirror how it works for HTML files):

By the way, everything above works as one would expect (in other words, it is not just a pretty screenshot). Because the Options panel is quite hard to get to, and for last minute tweaking, I've also implemented the font formatting functionality in the toolbar:

The same settings file is used for both of the above, so which ever is set last overrides the previous setting. Roumen reminded me about a module that lets you read PDF files inside the IDE (based on an API called JPeddle that I can't track down on-line), but despite searching his blog, I haven't been able to find it. That would be a perfect combination with this module, because it would let iText write PDF files while the other module reads them. Hope I track down that module soon.

There's still a lot of work I need to do on this module before it is ready for publication, but right now it is already pretty cool. The only real problem I have is... why would anyone even want to make PDF files of their Java files (or any other file) in the IDE? In other words, this is a case of: "Hmm. Interesting functionality. But what is it good for?"

Join the discussion

Comments ( 9 )
  • Ivica Loncar Monday, May 29, 2006
    Perhaps
    http://www.jpedal.org/plugin.html
  • Ramón Monday, May 29, 2006
    Anyway, you can open the pdf file if you get the open cookie from its data object and call open(), no matter which application (adobe reader or something else) is associated with pdf files in the IDE.
  • Juan Ara Tuesday, May 30, 2006

    Greg, inside JasperReports you have a ready to use JPanel that you can use to view PDF files, zoom them, move along, navigate shortcuts and even print them. We have used it on some applets and a year ago the only thing they had was a small classloader issue (with securty, doprivileged and our applet) but I think you will be able to plug it into editor window.

    I bet you can do it in less than 10 mins ;)

    Cheers,

    Juan

  • Alex Lam Tuesday, May 30, 2006
    One advantage I can think of - PDF files have embedded resources like fonts and images, unlike HTML files as generated by the IDE by default.
  • Charles Simon Tuesday, May 30, 2006
    In answer to your question about usefulness. For those of us with a color printer it would be nice to get the PDF to use the same color highlighting as the IDE's editor. That would be a useful listing output for me.
    In addition if you could add outlining in the left margin that would really be great. (You know the editor's collapsable/expandable sections, expanded of course, with a vertical line to show the extent of the section.)
  • Geertjan Wednesday, May 31, 2006
    Hi all, thanks for the useful comments/ Firstly, thanks Ivica, yes that's the one I meant. I've had another look at the NetBeans plugin on that site and it looks like I'm going to have to create my own version of it, because that one doesn't provide all the functionality I would like (such as thumbnails etc, which means that when I open a PDF file in the IDE with that plugin, thumbnails are not shown, only the most standard view is provided). Ramón, yes, I've created my own open() method for PDF files (in addition to the default one which opens PDF files in Acrobat) but that still means I need to have something to open PDF files into. That's where I think JPedal is going to help me because the IDE can't help me by default. Juan, thanks for that tip -- could you provide more information, maybe some code snippets? Maybe I'll use your approach instead of JPedal. Thanks Alex and Charles for giving some use cases. The syntax coloring is going to take some work to reproduce, currently I have no idea of where to even begin on working on that part of it, but I'm not there yet so am not worried yet!
  • guest Monday, July 24, 2006
    very BAD......thts it
  • Haijun Zhang Sunday, January 14, 2007
    Can you sent the doc and source code to me?
  • Haijun Zhang Sunday, January 14, 2007
    Can you sent the doc and source code to me?
    E-Mail:zhanghaijun973@163.com
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.