Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Sat Jul 03, 2021 8:32 am

Hi there,

I am a new user for spire.pdf.

I used the following code to extract text data from pdf

import com.spire.pdf.*;
import com.spire.pdf.PdfPageBase;
import java.io.*;

public class Extract_Text {

public static void main(String[] args) throws IOException {
String input="1-s2.0-S187705092030750X-main.pdf";

//Load the PDF file
PdfDocument doc = new PdfDocument();
doc.loadFromFile(input);

//Create a new txt file to save the extracted text
String result = "output/extractAllText.txt";
File file=new File(result);
if(!file.exists()){
file.delete();
}
file.createNewFile();
FileWriter fw=new FileWriter(file,true);
BufferedWriter bw=new BufferedWriter(fw);

//Extract text from all the pages on the PDF
PdfPageBase page;
for(int i=0;i<doc.getPages().getCount();i++){
page=doc.getPages().get(i);
String text = page.extractText(true);
bw.write(text);
}

bw.flush();
bw.close();
fw.close();
}
}
But the following error has occured
Exception in thread "main" class com.spire.pdf.packages.sprfhc: Value cannot be null.
Parameter name: File doesn't exist
Parameter name: filename

derkmingFong
 
Posts: 1
Joined: Sat Jul 03, 2021 4:18 am

Mon Jul 05, 2021 2:28 am

Hello,

Thanks for your inquiry.
From your error message, your issue should be caused by the file path "1-s2.0-S187705092030750X-main.pdf" that you passed in does not exist. Our loadFromFile method supports the use of relative and absolute paths. Please make sure that your input file path is correct and your project has permission to access the file.

If there is still any issue, please provide your input file for further investigation. You can send it to us (support@e-iceblue.com) via email. Thanks in advance.

Sincerely,
Brian
E-iceblue support team
Last edited by Brian.Li on Fri Sep 17, 2021 7:43 am, edited 1 time in total.
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Thu Jul 08, 2021 11:14 am

Hello,

How is your issue now? Could you please give us some feedback at your convenience?

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Tue May 17, 2022 6:05 am

how to apply digital signature on xml file please provide some guidance and documentation

Shamsulhuda
 
Posts: 2
Joined: Tue Apr 19, 2022 8:05 am

Tue May 17, 2022 6:20 am

Shamsulhuda wrote:how to apply digital signature on xml file please provide some guidance and documentation


Hi,

I'm sorry that our products don't support adding digital signature on a xml file. If you have any other questions about our products, please feel free to contact us.
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Return to Spire.PDF

cron