473,324 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Convert Excel to PDF

Hi all,

Is there any way to convert or export excel file into pdf file in Java?
Currently, I'm using POI to create an excel file. I want to convert that file to PDF file.

Thanks.
Sep 2 '08 #1
3 18315
Nepomuk
3,112 Expert 2GB
Hi!

Just searching for "java pdf" gave me these results as the first three:
Open Source PDF Libraries in Java
Java libraries to read and write PDF files
iText, a Free Java-PDF Library

So, as you can already write (and at least theoretically read) Excel files with POI, why not build a converter with that?

Greetings,
Nepomuk
Sep 2 '08 #2
myusernotyours
188 100+
People, lets all learn to use the internet... that way we ask fewer questions and google et all are happy.

Regards
Alex.
Sep 2 '08 #3
Pessoa
1 Bit
Hi,

You can use the Spire.XLS for Java.
It works very well to convert Excel to PDF. I’ll show you some example codes I tested before.


Expand|Select|Wrap|Line Numbers
  1. public class excelToPdf {
  2.     public static void main(String[] args) {
  3.  
  4.         Workbook workbook = new Workbook();
  5.         workbook.loadFromFile("C:\\Users\\Administrator\\Desktop\\Test.xlsx");
  6.  
  7.         workbook.getConverterSetting().setSheetFitToPage(true);
  8.  
  9.         workbook.saveToFile("ExcelToPdf.pdf", FileFormat.PDF);
  10.     }
  11. }
Nov 3 '21 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Andrew V. Romero | last post by:
At work we have an excel file that contains the list of medications and their corresponding strengths. I would like to save the excel file as a text list and paste this list into a javascript...
0
by: Alex | last post by:
i have a module in Access which opens an existing Excel file and envokes a macro within the Excel file to draw graphs. now i am trying to convert the Excel macro to an Access one so that the...
2
by: noopathan | last post by:
Hi experts , I have an excel file in the below format --------------------------------------------------------------------- CodeID CodeName Market Name Date...
2
by: karups | last post by:
Hi when i convert Excel file to dataset using the following code, i find that, some col. such as Col1 ------ 404 403 NOT 222
8
by: pappu | last post by:
Hello friends, I want to convert .xls file into text file.So can anybody pls help me out. Thxxxxxx, Sachin.
3
by: Alain R. | last post by:
Hi, I have an excel file with charset "windows-1250" and i would like to convert it to CSV file with charset "UTF-8" how can i do that ? thanks a lot, Al.
32
by: poolboi | last post by:
hi guys, i've read a lot of thread of converting excel data into CSV files. however, i need a perl script to convert CSV file into excel file now, if required modules is needed, it would be...
0
by: Raymond Chiu | last post by:
Dear all, In my vb.net program, I am using excel object to create excel file and stored in a folder. How can it be converted to be pdf file automatically using dotnet coding or others? Actually...
7
by: CSharpCoder | last post by:
I have an Excel VBA app that has 25 forms within and is reading from 60 Excel Sheets for a datasource. This needs to be converted over to the web in 10 days, and it took almost 3 months to do the...
15
by: pakerly | last post by:
How would i do this, convert a test file to excel? Lets say my text file has fields like this: NUMBER NAME ADDRESS PHONE 11002 Test1 ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.