Home > Software design >  Print via batch file
Print via batch file

Time:03-25

I have to run a batch file that is running a JasperStudio report. I only want to display the pdf of the report on the screen instead of printing it out. In the batch, there's only just /o command, because I deleted the /p. But it keeps printing.

My question is, is there any batch cmd that disable printing?

CodePudding user response:

It's not the batch itself that prints the document, it's the application you use to display the PDF.

Possible switches for Acrobat Reader are:

  • /n : Launch a new instance of Reader even if one is already open
  • /s : Don't show the splash screen
  • /o : Don't show the open file dialog
  • /h : Open as a minimized window
  • /p <filename> : Open and go straight to the print dialog
  • /t <filename> <printername> <drivername> <portname> : Print the file the specified printer.

As you see, a print can also be done through /t parameter, but I suppose that there isn't a /t if a /p was present. You should try, manually in a command prompt, the call that open the PDF. You will see immediately if it prints the PDF or not - and it shouldn't.

So, the printing is done elsewhere. Can you post your batch in your question?

CodePudding user response:

Once you exported the document to the PDF format, you can visualize the PDF file using a dedicated PDF viewer only, such as Adobe Reader [ Or the system default MS EDGE or any other viewer]. The JasperViewer tool cannot be used to view PDF files.

When using windows since your tag is [batch-file]

You simply call the pdf filepath name without any batch file required to open it.

Thus calling

C:\Users\WDAGUtilityAccount\Desktop\Projects\downloads\report.pdf

will open that pdf in my default pdf handler (MS Edge) HOWEVER if I want it to open a set page It needs a more complex approach to start viewing at page 3 (other options are available)

"c:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" file:///C:\Users\WDAGUtilityAccount\Desktop\Projects\downloads\report.pdf#page=3

If I wish to change that to Acrobat not Edge then I need to prefix the name. with the path to acrord32.exe

  • Related