Did you find this guide helpful?
Some test text!
Go / Guides / Create a package
To create a PDF portfolio containing multiple file types.
func AddPackage(doc PDFDoc, file string, desc string){
files := NameTreeCreate(doc.GetSDFDoc(), "EmbeddedFiles")
fs := FileSpecCreate(doc.GetSDFDoc(), file, true)
key := make([]byte, len(file))
for i := 0; i < len(file); i++{
key[i] = file[i]
//fmt.Println(file[i])
}
files.Put(&key[0], len(key), fs.GetSDFObj())
fs.SetDesc(desc)
collection := doc.GetRoot().FindObj("Collection")
if collection.GetMp_obj().Swigcptr() == 0{
collection = doc.GetRoot().PutDict("Collection")
}
// You could here manipulate any entry in the Collection dictionary.
// For example, the following line sets the tile mode for initial view mode
// Please refer to section '2.3.5 Collections' in PDF Reference for details.
collection.PutName("View", "T");
}
doc := NewPDFDoc()
AddPackage(doc, filename, "PDF")
AddPackage(doc, imagename, "Image")
PDF packages (portfolios)
Full code sample which illustrates how to create, extract, and manipulate PDF Packages (also known as PDF Portfolios).
Get the answers you need: Chat with us