If you're like me, you've taken advantage of the extensibility of Lotus Notes by adding widgets, Live Text recognizers, and plug-ins. I love customizing my Notes client with extras that help me get t
Generating PDF documents on the fly isn't exactly rocket science and - with the help of tools like iText - is easily done in Java and something I've talked about before.
The trouble is that creating them is a cumbersome and often tedious task if what you want is anything other than a set of plain text paragraphs added in series. Unlike creating HTML everything in PDF-land is of absolute size and position. I find that getting the result you want is often a case of repetitive, pixel by pixel tweaking to get it right. You need a lot of patience.
If you had a complicated document to create with logos and background images then you're in for a rough ride. What would make more sense is to use a GUI tool to author a base template and then just have your code add the text bits where necessary. This is the situation I found myself in recently and after a bit of digging I worked out how to take an existing PDF and add to it. PDF templating if you will.
Creating a Template
First thing to do, assuming you've not already been provided with a template is to create one. Let's look at creating a letter head. I did this in Word, as you can see below and simply pasted in some images, moved them about and added some company details to the footer in an off grey colour.
Once I was happy with it I used the File - Save As - PDF menu option to save the file in PDF format.
What I did with the PDF is attached it to a document in the same Notes database as we're generating the PDFs from. In reality I had been provided with a PDF template by my client's design agency, so that's what I attached. I could skip the bit above about creating a template, but went through it here in case you need help or inspiration.
The idea behind adding it as an attachment to a document is that the client has control over the template and can change it as and when they please. That being another benefit of this approach - if they happened to change the design of the letterhead then I'd have to go back to messing with the code each time. With this approach there should be no need to.
All we need to do now is add the actual content. Here's an example of what the generated PDF looks like once we've done adding to it with our own code:
Let's look at how we'd do that.
Adding To The Template
The code below is the Java needed to create a new PDF document, import the existing template and then add our own text atop of it.
//Setup a new PDF Document
Document document = new Document();
ByteArrayOutputStream os = new ByteArrayOutputStream(); PdfWriter writer = PdfWriter.getInstance(document, os); document.open();
document.newPage(); //Get the template PDF as the starting point!
View files = db.getView("files");
lotus.domino.Document filestore = settings.getDocumentByKey("pdf_template.pdf", true); String filename = filestore.getItemValueString("FileName"); EmbeddedObject file = filestore.getAttachment(filesname);
InputStream is = file.getInputStream(); //Here's the key part. Let's turn the template in to//usable PDF object
PdfReader reader = new PdfReader(is);
PdfImportedPage page = writer.getImportedPage(reader, 1); //Now, add it to the blank PDF document we've opened
PdfContentByte cb = writer.getDirectContent();
cb.addTemplate(page, 0, 0); //Now do the usual addition of text atop the template
document.add(new Paragraph("Here some text added to the template"));
//Etc, etc//Done!
document.close(); //Tidy up
is.close();
file.recycle(); //Make SURE you do this!!!//Attach the resuling PDF to the Notes document
Stream stream = session.createStream();
stream.write(os.toByteArray()); MIMEEntity m = doc.createMIMEEntity("Files"); MIMEHeader header = m.createHeader("content-disposition");
header.setHeaderVal("attachment;filename=\""+filename+"\""); m.setContentFromBytes(stream, "application/pdf", MIMEEntity.ENC_IDENTITY_BINARY); m.decodeContent();
Code's boring though. What you want is a demo and a download, no?
STRUGGLING WITH EXPORTING NOTES DATA TO SPREADSHEETS? NO MORE! Try IntelliPRINT, The world's leading Reporting, Dashboards, and Analysis solution for Notes & Domino
Don't spend unproductive time maintaining different versions of the same spreadsheet
Preserve data integrity and security in multi-user environments
Create reports in minutes INSIDE Notes
Get freedom from iterative report requests, deliver self-serve capabilities
Experience Reporting, Dashboards, and Analysis INSIDE Notes!
Teamstudio and GEDYS IntraWare today announced a newly formed partnership to bring GEDYS CRM product to the UK market for the first time. GEDYS is a leading European supplier of CRM solutions based on the Lotus Notes and Domino platform. The GEDYS IntraWare 7 CRM product line includes a complete suite for customer management, comprising of modules for sales, marketing and helpdesk services. This includes solutions to sales management, methods and activity, electronic customer files, order processing, workflow automation and campaign management. With versions in multiple languages, the scalable modular solution for today's business needs is now available in the UK.
The 'Type to Find' feature in the Open menu, should return results from the local addressbook, so that its possible to search for contacts directly from the Open menu.
REFItemName = "$REF" by default or omit this parameter.
apply to following methods:
Call notesDocument.MakeResponse(document As NotesDocument, [ REFItemName As String ])
Set notesDocumentCollection = notesDocument.Responses( [ REFItemName As String ] )
Command([ComposeWithReference]; server : database ; form ; flags ; [ REFItemName ])
Responses([ REFItemName ])
probably need to take into account:
notesDocument.ParentDocumentUNID
IsResponse
EDITED: MakeResponse or ComposeWithReference can be excluded from this list, but then give a chance to create item type of "Response Reference List", because now it correctly you can create only MakeResponse method.
I propose to unify the functional window open databases.
Instead of "Browse" button you can proceed to the browsing of local resources using the icon "Up", located to the right of "Look in: On My Computer"]. Also in the expands window (the button "Browse") contains the file extensions that are not databases ...
Below the field "File name:" to append a ComboBox with a list of file types, appropriate databases Lotus] (nsf, ntf, box).
I propose to unify the functional window open databases.
Instead of "Browse" button you can proceed to the browsing of local resources using the icon "Up", located to the right of "Look in: On My Computer"]. Also in the expands window (the button "Browse") contains the file extensions that are not databases...
Below the field "File name:" to append a ComboBox with a list of file types, appropriate databases Lotus] (nsf, ntf, box).
There are three new simple widgets in
the Widget
Library project. Widget
to Join Sametime Unyte Web Conference Widget
for Flickr Widget
for Text to ...
Add the Lotus Notes settings for the possibility of the appointment of custom combinations of keys for different actions. Be able to assign hotkeys for the operation of the Lotus Domino Designer.
It would help developers to move Notes apps and basic web apps to XPages. It could be a cut & paste convertion that would let the developer to paste in the macro formula and get back the javascript replacement.
It would help reduce errors in the conversion process. Especially with the issue of case since Javascript is case sensitive.
It stretches from the time of R5.x and annoys users.
I suggest not show this message and make the reaction to DoubleClick on category by analogy with the usual behavior in a view, - that is opening or closing category.
It stretches from the time of R5.x and annoys users.
I suggest not show this message and make the reaction to DoubleClick on category by analogy with the usual behavior in a view, - that is collapse or expand category.
When the database was moved from a server (often from Local), then when you click on application icon appears the window label "Database dbTitle cannot be found".
I propose to add to this window "Browse" button to choice the database by hand, by analogy with click on shortcuts to a nonexistent file in the operating system. When you click on "Browse" button to display "Open Application ..." window.
When the database was moved from a server (often from Local), then when you click on application icon appears the window label "Database dbTitle cannot be found".
I propose to add to this window "Browse" button to choice the database by hand, by analogy with click on shortcuts to a nonexistent file in the operating system. When you click on "Browse" button to display "Open Application ..." window.
EDITED:
Alternatively: instead of "Database ... cannot be found" window display a "Open Application ..." window, because recently window has all required functionality:
- can choose a server;
- can choose the database by hand;
- can click the "Cancel" button.
Propose:
1. Add the ability to drag tabs of workspace.
2. Add support to drag and drop the file (nsf, ntf, box) from browser of the operating system to the workspace (the application's icon should be created automatically).
1. Add the ability to drag tabs of workspace (edited: find here something like).
2. Add support to drag and drop the file (nsf, ntf, box) from browser of the operating system to the workspace (the application's icon should be created automatically).
We have just added the QuickNote
project to OpenNTF.
This comes from my article
on devWorks a few years ago. In
the near future, we plan on releasing the other plugins from that series
as well as several others that we have written. Additionally, ...
If the file is not empty, then will attempt to open the folder on the specified server, with the file name should be displayed in the field "File name" dialog.
If the folder is not found, then an attempt should be made the opening of the parent folder. If the path fully does not exist, then the server must be open, just as it opens now.
4. It would be good to set multipleSelection (for this can be used in this case an unused parameter choiceList/values), and depending on this to display the "Open" button or "Select".
If the file is not empty, then will attempt to open the folder on the specified server, with the file name should be displayed in the field "File name" dialog.
If the folder is not found, then an attempt should be made the opening of the parent folder. If the path fully does not exist, then the server must be open, just as it opens now.
4. It would be good to set multipleSelection (for this can be used in this case an unused parameter choiceList/values), and depending on this to display the "Open" button or "Select".
EDITED:
I am aware that a much better solution would be to create a separate method ChooseDatabase; do not understand why the engineers IBM went to add type=13 is in the method Prompt, if the choice of database is essentially (and parameters!) is much closer to the OpenFileDialog, than Prompt ... But something must be done about this, because the ability to customize the displayed window, in my opinion, is culture.
Chun Yan Zhang has contributed a new
plugin to OpenNTF
to open web links in Lotus Notes documents in external browsers. As always
you can install this plugin via drag and drop from the Apache
catalog. You can download the
source
code here and read the ...
When a user attempts to access a Microsoft Office 2007 document on the Domino Web Server or as an attachment in iNotes, the file may not open or save correctly
Read about a simple solution that enables you to define site structures in IBM® Lotus® Web Content Management in an automated fashion. This solution allows you to save time on an otherwise time-consuming and monotonous task.