Jump to content

BIRT Developer Center Download


Photo
- - - - -

Send report directly to printer

report printer

  • Please log in to reply
5 replies to this topic

#1 rajanig

rajanig

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts

Posted 13 August 2013 - 09:28 PM

Hi,

 

When I run a report, I want to send my report directly to the default printer and print in PDF format.

I want to set number of copies to print too.

 

Can anyone could help me on this.

 

Thanks in advance.

 

--Rajani



#2 kclark

kclark

    BIRT Guru

  • Administrators
  • 2086 posts

Posted 14 August 2013 - 11:29 AM

You can try using the &__action=print option in the URL.


Kristopher Clark

Actuate Corporation – The BIRT Company™

http://www.actuate.com | http://birtondemand.com

 

My Blog

Twitter

LinkedIn
Facebook
 


#3 rajanig

rajanig

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts

Posted 16 August 2013 - 02:55 AM

Can you please share a sample report?

 

Thanks

Rajani



#4 rajanig

rajanig

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts

Posted 21 August 2013 - 10:38 PM

Hi kclark,

Thank you for your responce.

 

I am trying with java print service API, in report's afterRender event. I am getting error while I run this on BIRT designer.

 

I have attached my test report. Could you please tell me where I am going wrong.

 

Attached Files



#5 rajanig

rajanig

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts

Posted 27 August 2013 - 03:15 AM

Hi,

 

I have a critical requirement. I have to send my report to printer.

I have to execute my report through url which has some parameters and __format=pdf.

Is it possible to send the report executing through browser, directly to printer?

 

Below is my sample url:

 

http://ns-poc:8700/i...PrintPDF/Report Designs/PrintFromURL.rptdesign&serverURL=http://NS-POC:8000&volume=ns-poc&invokeSubmit=true&__wait=wait&__newWindow=false&__format=pdf&userid=rajani&password=

 

 

When I run this in browser, I could get pdf of the report, but I need to send it to the printer directly.

 

Can anybody help me on this.

 

Thanks and Regards,

Rajani Gunda



#6 marcolopes

marcolopes

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 10 August 2017 - 10:29 AM

I use org.apache.pdfbox.pdmodel.PDDocument to print the rendered PDF, and it works like a charm!

 

pdfbox-1.6.0.jar

fontbox-1.6.0.jar

 

https://github.com/m...terHandler.java

/** 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);
	}

}