Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Send report directly to printer
rajani_interwove
<p>Hi,</p><p> </p><p>When I run a report, I want to send my report directly to the default printer and print in PDF format.</p><p>I want to set number of copies to print too.</p><p> </p><p>Can anyone could help me on this.</p><p> </p><p>Thanks in advance.</p><p> </p><p>--Rajani</p>
Find more posts tagged with
Comments
kclark
<p>You can try using the <span>&__action=print option in the URL.</span></p>
rajani_interwove
<p>Can you please share a sample report?</p><p> </p><p>Thanks</p><p>Rajani</p>
rajani_interwove
<p>Hi kclark,</p><p>Thank you for your responce.</p><p> </p><p>I am trying with java print service API, in report's afterRender event. I am getting error while I run this on BIRT designer.</p><p> </p><p>I have attached my test report. Could you please tell me where I am going wrong.</p><p> </p>
rajani_interwove
<p>Hi,</p><p> </p><p>I have a critical requirement. I have to send my report to printer.</p><p>I have to execute my report through url which has some parameters and __format=pdf.</p><p>Is it possible to send the report executing through browser, directly to printer?</p><p> </p><p>Below is my sample url:</p><p> </p><p><a data-ipb='nomediaparse' href='
http://ns-poc:8700/iportal/executereport.do?__executableName=/PrintPDF/Report'>http://ns-poc:8700/iportal/executereport.do?__executableName=/PrintPDF/Report</a><a
data-ipb='nomediaparse' href='
http://ns-poc:8700/iportal/executereport.do?__executableName=/PrintPDF/Report'>
; Designs/PrintFromURL.rptdesign&serverURL=
http://NS-POC:8000&volume=ns-poc&invokeSubmit=true&__wait=wait&__newWindow=false&__format=pdf&userid=rajani&password=</a></p><p> </p><p> </p><p>When
I run this in browser, I could get pdf of the report, but I need to send it to the printer directly.</p><p> </p><p>Can anybody help me on this.</p><p> </p><p>Thanks and Regards,</p><p>Rajani Gunda</p>
marcolopes
<p>I use <strong>org.apache.pdfbox.pdmodel.PDDocument</strong> to print the rendered PDF, and it works like a charm!</p>
<p> </p>
<p>pdfbox-1.6.0.jar</p>
<p>fontbox-1.6.0.jar</p>
<p> </p>
<p><a data-ipb='nomediaparse' href='
https://github.com/marcolopes/dma/blob/master/org.dma.java/src/org/dma/java/awt/PrinterHandler.java'>https://github.com/marcolopes/dma/blob/master/org.dma.java/src/org/dma/java/awt/PrinterHandler.java</a></p>
;
<pre class="_prettyXprint">
/** Prints a PDF using apache pdfbox */
public void printPdf(File file) throws PrinterException, IOException {
PrinterJob job=createPrinterJob();
job.setJobName(file.getName());
try{
PDDocument doc=PDDocument.load(file);
try{
doc.silentPrint(job);
}catch(PrinterAbortException e){
//avoid abort exception
}catch(PrinterException e){
throw new PrinterException("Error while printing");
}finally{
doc.close();
}
}catch(IOException e){
throw new IOException("Error reading file "+file);
}
}
</pre>