Convert PDF to Word documents in Go
To edit the content of a PDF file in Microsoft Word or other word processors that support DOC and DOCX formats. PDF files are editable, but DOC and DOCX files are more flexible and customizable.
Convert PDF to DOC
The provided Go code snippet demonstrates how to convert a PDF document into a DOC using the Aspose.PDF library:
- Open a PDF document.
- Convert a PDF file to DOC using SaveDoc function.
- Close the PDF document and release any allocated resources.
package main
import "github.com/aspose-pdf/aspose-pdf-go-cpp"
import "log"
func main() {
// Open(filename string) opens a PDF-document with filename
pdf, err := asposepdf.Open("sample.pdf")
if err != nil {
log.Fatal(err)
}
// SaveDoc(filename string) saves previously opened PDF-document as Doc-document with filename
err = pdf.SaveDoc("sample.doc")
if err != nil {
log.Fatal(err)
}
// Close() releases allocated resources for PDF-document
defer pdf.Close()
}
Try to convert PDF to DOC online
Aspose.PDF for Go presents you online free application “PDF to DOC”, where you may try to investigate the functionality and quality it works.
Convert PDF to DOCX
Aspose.PDF for Go API lets you read and convert PDF documents to DOCX. DOCX is a well-known format for Microsoft Word documents whose structure was changed from plain binary to a combination of XML and binary files. Docx files can be opened with Word 2007 and lateral versions but not with the earlier versions of MS Word which support DOC file extensions.
The provided Go code snippet demonstrates how to convert a PDF document into a DOCX using the Aspose.PDF library:
- Open a PDF document.
- Convert a PDF file to DOCX using SaveDocX function.
- Close the PDF document and release any allocated resources.
package main
import "github.com/aspose-pdf/aspose-pdf-go-cpp"
import "log"
func main() {
// Open(filename string) opens a PDF-document with filename
pdf, err := asposepdf.Open("sample.pdf")
if err != nil {
log.Fatal(err)
}
// SaveDocX(filename string) saves previously opened PDF-document as DocX-document with filename
err = pdf.SaveDocX("sample.docx")
if err != nil {
log.Fatal(err)
}
// Close() releases allocated resources for PDF-document
defer pdf.Close()
}
Try to convert PDF to DOCX online
Aspose.PDF for Go presents you online free application “PDF to Word”, where you may try to investigate the functionality and quality it works.