I've been searching for an answer to this question. How can I print duplex or create double-sided PDF using BIRT + eclipse? I generate documents that contain multiple reports, and often the reports are multi-page. How can I force the header pages to always be "page 1" and avoid the next report from flowing onto the back of the previous report?
This isn't a BIRT topic.
When you say you print from BIRT, that's technically not the case. You create a PDF file with BIRT and print that file somehow.
Unfortunately the PDF file format does not support instructions to do a physical page break at a given logical page break.
So, unless you know at generation time if the resulting file will be printed duplex or not, there is no way to control this.
If you know that the file will be printed duplex in most cases, you might insert blank pages at certain places (maybe with a text "this page is intentionally left blank"), but this results in wasted pages if the file is printed single-sided.
Anyway, this still leaves you with two tasks:
1) Use a different Master Page when a new section of the report starts.
2) Finding out where to insert blank pages.
The first task is actually quite simple.
In BIRT, you can have different master pages (say, "first page" and "following page").
You can choose the master page to use in the properties of layout elements in BIRT.
Give it a try!
The second task is outside the scope of BIRT, you'll need some kind of PDF post-processing here. The idea is as follows:
Use BIRT to create a PDF file.
Use BIRT's TOC entry property to create a PDF TOC (also called Outline). This is the document structure shown on the left side if you open the file in Adobe Reader.
Use a PDF post processor (e.g. based on iText or whatever) to read the TOC entries.
Each entry has information about the page where it points to.
Now, if you want to print duplex and the entry starts on a even page (1-based), insert a blank page before this page.
It is possible, but will take at least a few hours of Java programming (or several days, depending on your experience with your chosen PDF processing tool).
Related
I'm using BIRT report designer v4.8 and trying to build a table of contents(TOC).
I know that BIRT has a builtin Table of Contents in Properties, but that kind of TOC can only be viewed in the Web Viewer by clicking the "Toggle table of contents" and be showed up on the left side of the report.
What I want to do is to create a TOC that is part of the report, which means the TOC is directly showed up as a section in the report without clicking the "Toggle table of contents", and also can be exported along with the report.
For example, here is a sample of TOC, suppose we have four sections in the report.
The challenge I'm facing now is calculating the page numbers for each section and then add a hyperlink for each section so that the page will jump to that section when a user clicks it from the TOC. Does anyone know how to get this functionality? What kind of scripts do I need?
This is not possible with BIRT alone.
A possible solution is depending on the output format.
With PDF and a good knowledge of iText, it should be possible to create a TOC in a post-processing step.
I'll sketch the idea here (assuming that the TOC will fit on one page):
With BIRT, generate your invisible TOC as before. On the first page, leave enough room for the TOC.
The rest of the work will happen after BIRT has generated the PDF. BIRT contains iText and iText can examine and modify existing PDFs.
In PDF speech, the TOC is called "outline". With iText, examine the outline. This will give you the data you need for your visible TOC and can be transformed to an array of triples of the form (toc_level, toc_text, page_no).
Then you can create a new PDF with the help of iTexts PDFStamper class: Take the existing PDFs and render your list of triples on page 1.
This will cost you at least 1-2 days of Java development work, however.
I have a form with some comboboxes, a datagrid and an image. My ultimate goal here is: When the user clicks the save button on a menustrip, it will send this data to a printer (preferably to a PDF one) and print the file ready to be mailed to our clients. I tried the code provided by:
http://msdn.microsoft.com/en-us/library/aa287529%28VS.71%29.aspx
But it sent me to OneNote which then showed me an empty file. I also tried Printform and PrintDialog which didn't bring me much luck either. Any suggestions?
edit: I configured it to print to pdf although it now prints only half the form (cuts it in half of width), and if the datagrid is Scrollable it only prints the data that is showing on the screen. Like this:
You cannot print scrolled data using graphics object. even you cannot create your own design using graphics object. Also, you will get some problem in creating PDF and managing multiple pages. So, don't make it more complicated just use reporting library. You have two choices to print form data into pdf file.
Microsoft Reporinting
Crystal Report
But, I would like to prefer to use Crystal Report to Print any document. It is more flexible than Microsoft Reporting. You can export that document into PDF, WORD, EXCEL or Direct to Printer.
for my company I am making a report in Xi3/Desktop Intelligence that pulls data via free hand SQL and makes a html file displaying the data, updating every 20mins. We want to incorporate a hit counter that will show us the number of times this report is being viewed.
I found a couple basic templates online. I tried copying and pasting them into a cell, but the output HTML page just displayed the full HTML (unrendered by my browser). I am decent at writing my own HTML, but I just do not understand how to stick my own HTML code in a dynamically updating report in Xi3.
Moreover, I doubt (for legality reasons) my company will be okay with me using a free hit counter template I find online, especially considering they all seem to reference a third party website to do the actual "counting." Any ideas of the best way to implement/learn how to create a visitor counter?
Thanks.
You can include HTML in a DeskI report. In the cell that contains the HTML, click Format Cell; on the "Number" tab, there is a checkbox for "Read as HTML". Make sure that's checked off. Note that you won't see the rendered HTML within DeskI, but it will display when viewed in Infoview.
I have a three page Word document that needs to be converted into PDF. This Word document was given to me as a template to show me what the PDF output should look like. I tried converting this document into PDF, created a PDF form and used iTextSharp to open the form, populate it with data and return it back to the client. This is all great but due to large amounts of data stored, the placeholders were insufficient and the text would be truncated or hidden.
My second attempt was to create an MVC 2 View without master page, pass the model to the view, take the HTML representation of the View, pass it over to iTextSharp and render the PDF. The problem here was that iTextSharp failed on some tags (one of them was <hr> tag). I managed to get rid of the problematic tag, but then tables were not rendered properly. Namely, the border attribute was ignored so I ended up with borderless tables. That attempt failed.
I need a suggestion or advice on the most efficient way to create a PDF document in MVC 2 which would be maintainable in the long run. I really don't want my actions to be 200+ lines long. Working directly with the Word document is not the best solution as I have never worked with VSTO so I don't quite know what it would look like to open Word and manipulate text inside of it and add dynamic data and then convert that dynamically into PDF.
Any suggestion is highly welcome.
Best regards!
One thing that I've done in the past is to save the Word file as a DOCX and unzip it since DOCX is just a renamed zip file. Within the archive open up /word/document.xml and you'll see your document. There's a lot of weird XML tags in there but overall you should get a pretty good idea of where your content is. Then just add placeholder text like {FIRST_NAME}, save the file and re-zip.
Then from code you can just perform the same steps, unzipping with something like SharpZipLib or DotNetZip, swapping placeholder copy, re-zipping and then using very simple Word automation to Save-As a PDF.
The other route is to fully utilize iTextSharp and actually write Paragraphs and PdfPTable and everything else. It takes a lot longer to setup but would give you the most control.
Q: you say "... but due to large amounts of data stored, the placeholders were insufficient and the text would be truncated or hidden"
How do you end up having to much data ? If the word template can "hold" the data in 3 pages, they should fit in 3 PDF pages.
I used to use iTextSharp to create my PDF's, but I also almost always ended up building the PDF document from scratch myself.(not really a <200 line solution) Have you considerate another library, I recently switched to MigraDoc's PDFSharp.Way simpler to use then iText, lotsa examples / docus
Just my two cents
Word documents object model is quite easy to understand. It will either contain series of Paragraphs or Tables. Using the Open XML SDK, you can iterate through each paragraph/table in the word document and retrieve it's content and styles. Then you can generate PDF document on the fly using those retrieved information. This will work under MVC too.
But if your word document contains complex elements, then it will take some more time for you to implement based on this approach. Also, this approach would only work with (Word 2007 and 2010) files.
Also, HTML to PDF options currently available in the ITextSharp library would work with only known set of tags, as far as I know.
Another suggestion is to make use of commercially available .NET components. There are lot of good solution available. For ex: Syncfusion
As part of a recent project, I have created a Cell Table that holds a few million rows of data. This data can be exported to CSV, filtered, and a few other basic functions. The last bit of functionality that I want to add, is the ability to print out the contents of the Cell Table to a local printer. I've done some research online (Google Groups and all the intro GWT material), but as far as I can tell there is no method to print a widget's contents -- specifically a Cell Table. Does anyone have an idea of how to go about setting something like this up (obviously I expect no code -- a description would be great!)?
There's an idea on how to print GWT widgets in this thread. The author of that post also placed his Print class in a Google Code project.
You can't directly use a printer interface from js code.
http://javascript.about.com/od/events/a/print.htm
Several webs have a button like "print version" which generates an HTML page with plain custom style.
example - http://www.alistapart.com/articles/goingtoprint/
You can also easily generate pdf versions in either client or server. PDF is quite a good way to let user print a document.
more info - https://stackoverflow.com/questions/1523851/gwt-printing-to-pdf