We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

Extract PDF Metadata and PDF Document Info Request in Java Throws Error

I am facing issues in running any request for Aspose-pdf-cloud. I have set up the API and made account as well. Following is the code that i am using:

pom.xml:

aspose-cloud
artifact.aspose-cloud-releases
http://artifact.aspose.cloud/repo


com.aspose
aspose-pdf-cloud
21.1.0
compile

Code:
ApiClient apiClient = new ApiClient();
apiClient.setAppKey(“XXXXXXXXXX”);
apiClient.setAppSid(“XXXXXXX”);
PdfApi apiInstance = new PdfApi(apiClient);

String name = “CoverPage.pdf”; // String | The document name.
String storage = “AsposeCloudTesting”; // String | The document storage.
String folder = “TestFiles”; // String | The document folder.

DocumentResponse doc = apiInstance.getDocument(name, storage, folder);

It gives me 400 Bad request all though i have same storage, folder and file on my account. Kindly guide how to send requests using aspose-pdf-cloud.

@ahmedtariq

I have tested getDocument API method using Aspose.PDF Cloud SDK for Java to extract PDF metadata and PDF document Info, but I am unable to notice any issue. Please double check the file path/availability. Hopefully, it will help you to accomplish the task. Otherwise, please share your credentials(Client Id/Secret) via private message using the flag button at the end of my post.

@ahmedtariq

Thanks for sharing your credentials. I have tested your shared sample code without any issue. Please use the latest SDK version 21.11.0 from Aspose Cloud Maven Repository. Hopefully, it will resolve the issue.

ApiClient apiClient = new ApiClient();
		apiClient.setAppKey("xxxxxxxxxxxxxxxxxxxxxxxxxx");
		apiClient.setAppSid("xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx");
		
		PdfApi pdfApi = new PdfApi(apiClient);
		String name = "result.pdf";
		String storage = "AsposeCloudTesting";
		String folder = "TestFiles";

		DocumentResponse response = pdfApi.getDocument(name, storage, folder);
		System.out.println(response);

Response:
class DocumentResponse {
class AsposeResponse {
code: 200
status: OK
}
document: class Document {
class LinkElement {
links: [class Link {
href: /result.pdf
rel: self
type: null
title: null
}, class Link {
href: /result.pdf
rel: alternate
type: application/pdf
title: Download As PDF
}, class Link {
href: /result.pdf
rel: alternate
type: image/tiff
title: Download As TIFF
}, class Link {
href: /result.pdf
rel: alternate
type: application/msword
title: Download As DOC
}, class Link {
href: /result.pdf
rel: alternate
type: application/vnd.ms-xpsdocument
title: Download As XPS
}, class Link {
href: /result.pdf
rel: alternate
type: application/zip
title: Download As TeX
}, class Link {
href: /result.pdf
rel: alternate
type: application/zip
title: Download As HTML
}, class Link {
href: /result.pdf
rel: alternate
type: application/pdf
title: Download As PDF/A-1a
}, class Link {
href: /result.pdf
rel: alternate
type: application/pdf
title: Download As PDF/A-1b
}]
}
documentProperties: class DocumentProperties {
class LinkElement {
links: [class Link {
href: /result.pdf/documentproperties
rel: self
type: null
title: null
}]
}
list: [class DocumentProperty {
class LinkElement {
links: [class Link {
href: /Author
rel: self
type: null
title: null
}]
}
name: Author
value: briana
builtIn: true
}, class DocumentProperty {
class LinkElement {
links: [class Link {
href: /CreationDate
rel: self
type: null
title: null
}]
}
name: CreationDate
value: 02/02/2011 05:40:18.000 PM
builtIn: true
}, class DocumentProperty {
class LinkElement {
links: [class Link {
href: /Creator
rel: self
type: null
title: null
}]
}
name: Creator
value: Aspose Ltd.
builtIn: true
}, class DocumentProperty {
class LinkElement {
links: [class Link {
href: /Keywords
rel: self
type: null
title: null
}]
}
name: Keywords
value: null
builtIn: true
}, class DocumentProperty {
class LinkElement {
links: [class Link {
href: /ModDate
rel: self
type: null
title: null
}]
}
name: ModDate
value: 01/17/2022 05:49:48.000 PM
builtIn: true
}, class DocumentProperty {
class LinkElement {
links: [class Link {
href: /Producer
rel: self
type: null
title: null
}]
}
name: Producer
value: Aspose.PDF for Java 21.10
builtIn: true
}, class DocumentProperty {
class LinkElement {
links: [class Link {
href: /Subject
rel: self
type: null
title: null
}]
}
name: Subject
value: null
builtIn: true
}, class DocumentProperty {
class LinkElement {
links: [class Link {
href: /Title
rel: self
type: null
title: null
}]
}
name: Title
value: Pro/ENGINEER - MASK_PAD_XFER_WALLACE
builtIn: true
}]
}
displayProperties: class DisplayProperties {
class LinkElement {
links: [class Link {
href: /result.pdf/displayproperties
rel: self
type: null
title: null
}]
}
centerWindow: false
direction: L2R
displayDocTitle: false
hideMenuBar: false
hideToolBar: false
hideWindowUI: false
nonFullScreenPageMode: UseNone
pageLayout: Default
pageMode: UseNone
}
pages: class Pages {
class LinkElement {
links: [class Link {
href: /result.pdf/pages
rel: self
type: null
title: null
}]
}
list: [class Page {
class LinkElement {
links: [class Link {
href: /1
rel: self
type: null
title: null
}]
}
id: 1
images: class Images {
class LinkElement {
links: [class Link {
href: /result.pdf/pages/1/images
rel: self
type: null
title: null
}]
}
list: []
}
rectangle: class Rectangle {
LLX: 0.0
LLY: 0.0
URX: 1223.0
URY: 791.0
}
}]
}
}
messages: null
}