Extract Pages from PDF via Go SDK
API for extracting Pages from PDF documents with Aspose.PDF Cloud Go SDK
Get StartedHow to extract Pages from PDF documents using Cloud Go SDK
For extracting pages from PDF documents, we’ll use Aspose.PDF Cloud Go SDK This Cloud Go SDK assists Go programmers in developing cloud-based PDF creator, annotator, editor, and converter apps using Go programming language via Aspose.PDF REST API. Use the following command from the Package Manager Console.
Package Manager Console Command
go get -u github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25
Steps to extract pages using Go
Aspose.PDF Cloud Go developers can easily extract pages from PDF documents. Developers need just a few lines of code.
- Define the ExtractPageInfo Function
- Use your own upload function
- Set API Request Parameters
- Call the API to Get Page Information
- Handle Errors and Display Page Size
This sample code shows extracting pages from PDF document using PDF Cloud Go SDK
package main
import (
"fmt"
asposepdfcloud "github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25"
)
func ExtractPageInfo(pdf_api *asposepdfcloud.PdfApiService, document string, pageNumber int32, remoteFolder string) {
// Get page information of the PDF document.
uploadFile(pdf_api, document)
args := map[string]interface{}{
"folder": remoteFolder,
}
result, httpResponse, err := pdf_api.GetPage(document, pageNumber, args)
if err != nil {
fmt.Println(err.Error())
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
fmt.Println("Unexpected error!")
} else {
fmt.Println("Successfully extract page :", pageNumber, "Width :", result.Page.Rectangle.URX, "Height: ", result.Page.Rectangle.URY)
}
}
Work with the pages in PDF via Go SDK
Extracting pages from a PDF is a common task that serves various purposes across different contexts. This process involves selecting specific pages from a larger document to create a new, separate PDF file. Understanding the reasons behind this practice can help in effectively managing and utilizing PDF documents. Large PDF files can be cumbersome to share or store. By extracting only the necessary pages, users can create smaller, more manageable files. This is particularly useful when only a portion of the document is relevant for a specific purpose. For instance, removing unnecessary pages can significantly decrease the file size, making it easier to handle and distribute. Extracting pages allows users to repurpose content for different applications. For example, one might extract pages from a comprehensive report to create a standalone summary or to isolate specific data for analysis. This enables the reuse of existing content without the need to recreate information from scratch. Extract the Pages from PDF documents with Aspose.PDF Cloud Go SDK.
With our Go SDK you can
- Add PDF document’s header & footer in text or image format.
- Add tables & text or image stamps to PDF documents.
- Append multiple PDF documents to an existing file.
- Work with PDF attachments, annotations, & form fields.
- Apply encryption or decryption to PDF documents & set a password.
- Delete all stamps & tables from a page or entire PDF document.
- Delete a specific stamp or table from the PDF document by its ID.
- Replace single or multiple instances of text on a PDF page or from the entire document.
- Extensive support for converting PDF documents to various other file formats.
- Extract various elements of PDF files & make PDF documents optimized.
- You can try out our free App to get the pages from PDF files online and test the functionality.
- Learning Resources
- Documentation
- Source Code
- API References
- Product Support
- Free Support
- Paid Support
- Blog
- Why Aspose.PDF Cloud for Go?
- Customers List
- Security