Get a Free Trial
GrabzIt's Online Community

Url To PDF using Java :Getting Error: Error: ENOENT: no such file or directory, open '/Users/shankeytyagi/vs-studio-workspacea/result.pdf']

Ask questions on how to use GrabzIt’s various plugins in your application or website.

There are no forum posts on this topic! Why don't you write one?

Hi Team,

I am getting the below error when I try to save the pdf created from the URL. I am using node js to create a pdf from the URL and save it to my local drive. For reference, I have attached the code below. Could someone please help here? F

Error: 
[Error: ENOENT: no such file or directory, open '/Users/shankeytyagi/vs-studio-workspacea/result.pdf'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/Users/shankeytyagi/vs-studio-workspacea/result.pdf'
}

Code:

 

try {

String dest="C:\\pdf\\test.pdf";

GrabzItClient client = new GrabzItClient(appKey, appSecret);
PDFOptions options = new PDFOptions();
options.setBrowserWidth(1500);
options.setHideElement(".ArevicoModal-bg,.ArevicoModal");
options.setDelay(30000);
client.URLToPDF(url, options);
Assert.assertNotNull("Failed to take hide popups using URLToPDF method", client.SaveTo(dest));

} catch (Exception ex) {
// Assert.fail("An error occured when trying to take a PDF screenshot: " +
// ex.getMessage());
System.out.println("Error Message:: " + ex.getStackTrace() + "\n" + ex.getMessage());

}

 

Cheers

Shankey

Asked by anonymous on the 20th of August 2021