Skip to content

eiceblue/Spire.PDF-for-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 

Repository files navigation

Spire.PDF-for-Java-JAVA Library for Processing & Manipulating PDF Files

Product PageDocumentationExamplesForumTemporary LicenseCustomized Demo

Spire.PDF for JAVA is a PDF API that enables Java applications to read, write and save PDF documents without using Adobe Acrobat. Using this Java PDF component, developers and programmers can implement rich capabilities to create PDF files from scratch or process existing PDF documents entirely on Java applications (J2SE and J2EE).

PDF Processing Features

Conversions

Support Environment

  • 100% Written in Java
  • Supports 32-bit and 64-bit OS
  • Works on Windows, Linux, Unix and Mac OS
  • Supports PDF Version 1.2, 1.3, 1.4, 1.5, 1.6 and 1.7
  • No Need to Install Additional Software

Convert PDF to DOC in Java

	         //create a PdfDocument object
	         PdfDocument doc = new PdfDocument();
	
	         //load a sample PDF file	
	         doc.loadFromFile("C:\\Users\\Administrator\\Desktop\\Introduction of Spire.PDF for Java.pdf");
	
	        //save as .doc file	
	        doc.saveToFile("output/ToDoc.doc",FileFormat.DOC);
	
	        //save as. docx file
	        doc.saveToFile("output/ToDocx.docx",FileFormat.DOCX);
	        doc.close();
	
	    }

Convert PDF to images in Java

          //Create a PdfDocument instance
	        PdfDocument pdf = new PdfDocument();
	 
	        //Load a PDF sample document
	        pdf.loadFromFile("sample.pdf");

	        //Loop through every page
	        for (int i = 0; i < pdf.getPages().getCount(); i++) {

	            //Convert all pages to images and set the image Dpi
	            BufferedImage image = pdf.saveAsImage(i, PdfImageType.Bitmap,500,500);

	            //Save images to a specific folder as a .png files
	            File file = new File("C:\\Users\\Administrator\\Desktop\\PDFToImages" + "/" + String.format(("ToImage-img-%d.png"), i));
                    ImageIO.write(image, "PNG", file);

	        }
	        pdf.close();

	    }

	}

Convert PDF to HTML in Java

            //Load the PDF file
	        PdfDocument pdf = new PdfDocument();
	        pdf.loadFromFile("New Zealand.pdf");

	        //Save to HTML format
	        pdf.saveToFile("ToHTML.html", FileFormat.HTML);

	    }
	}

Product PageDocumentationExamplesForumTemporary LicenseCustomized Demo

About

Spire.PDF for Java is a PDF component that enables to read, write, print and convert PDF documents in Java applications without using Adobe Acrobat.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published