Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5991927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:27:31+00:00 2026-05-22T23:27:31+00:00

I am looking for APIs for Java that can print Microsoft Office and PDF

  • 0

I am looking for APIs for Java that can print Microsoft Office and PDF files. I would also like to provide print specifications, even if there is no software for opening these files on the system. Commercial libraries are fine. Can you recommend any?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:27:31+00:00Added an answer on May 22, 2026 at 11:27 pm

    For Printing of PDF here is the Best solution for free!!Use the PDFBox ..

    import java.awt.print.PrinterJob;
    
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    
    import org.apache.pdfbox.pdmodel.PDDocument;
    import org.apache.pdfbox.util.PDFTextStripper;
    
    
    public class PrintPDF
    {
    
        private static final String PASSWORD     = "-password";
        private static final String SILENT       = "-silentPrint";
        private static final String PRINTER_NAME = "-printerName";
    
        /**
         * private constructor.
         */
        private PrintPDF()
        {
            //static class
        }
    
    
        public static void main( String pdfFilepath,String printerindx ) throws Exception
        {
            String password = "";
            String pdfFile = pdfFilepath;
            boolean silentPrint = true;
    
            PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();            
    
    
            if( pdfFile == null )
            {
                usage();
            }
    
            PDDocument document = null;
            try
            {
                document = PDDocument.load( pdfFile );
    
                if( document.isEncrypted() )
                {
                    document.decrypt( password );
                }
                PrinterJob printJob = PrinterJob.getPrinterJob();
    
                if(printerindx != null )
                {
                    PrintService[] printService = PrinterJob.lookupPrintServices();
    
                    printJob.setPrintService(printService[Integer.parseInt(printerindx)]);
    
    
                }
                txt=new PDDocument(document);
                if( silentPrint )
                {
    
    
                    document.silentPrint( printJob );
                }
                else
                {
                    document.print( printJob );
                }
            }
            finally
            {
                if( document != null )
                {
                    document.close();
                }
            }
        }
    
        /**
         * This will print the usage requirements and exit.
         */
        private static void usage()
        {
            System.err.println( "Usage: java org.apache.pdfbox.PrintPDF [OPTIONS] <PDF file>\n" +
                    "  -password  <password>        Password to decrypt document\n" +
                    "  -silentPrint                 Print without prompting for printer info\n"
            );
            System.exit( 1 );
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for suggestions/examples of tools or APIs that enable the mapping of large
Looking for an example that: Launches an EXE Waits for the EXE to finish.
Looking to do a very small, quick 'n dirty side project. I like the
Looking for a Linux application (or Firefox extension) that will allow me to scrape
The company I work for is looking for an IVR implementation that is highly
I'm trying to pick a web framework that is Java based to start a
I am looking for an Java API to extract and control content from an
I am looking for a solution (APIs, etc.) for handling a similar experience as
I'm looking for a google search module that uses the 'Google Custom Search API'
I realise that the two Java versions are substantially different but the library I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.