Some test text!

Loading...
Guides
Create a package

Create a PDF portfolio (package) in Ruby

To create a PDF portfolio containing multiple file types.

def AddPackage(doc, file, desc)
	files = NameTree.Create(doc.GetSDFDoc, "EmbeddedFiles")
	fs = FileSpec.Create(doc.GetSDFDoc, file, true)
	files.Put(file, file.length, fs.GetSDFObj)
	fs.SetDesc(desc)

	collection = doc.GetRoot.FindObj("Collection")
	if collection.nil?
		collection = doc.GetRoot.PutDict("Collection")
	end

	# 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")
end
doc = PDFDoc.new
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: Support

Upcoming Webinar: Live tech update & run-through: Redaction | March 31st at 11 am PT

PDFTron SDK

The Platform

NEW

© 2022 PDFTron Systems Inc. All rights reserved.

Privacy

Terms of Use