Q:
Our company has a requirement to have a large image inside a PDF that will be duplicated to say 50,000 PDF files. We have been told that your tool can use that single image as a resource with all PDF files referencing it there by reducing the final size of each PDF.
------------
A:
First, you need to extract the image from the source PDF. You can check out the ImageExtract project on how to do this:
http://www.pdftron.com/pdfnet/samplecode.html#ImageExtract You can then use the image as the same PDF resource to be used to embed into other PDFs. If you take a look at the first code sample in ElementBuilder test
sample project (
http://www.pdftron.com/pdfnet/samplecode.html#ElementBuilder) you will notice that the same image instance is used three times on the same page. So, to reuse an existing PDF resource (e.g. an image, a font, a form xobject, etc.), you would do something like this:
static pdftron.PDF.Image my_image = null;
pdftron.PDF.Image GetImage(PDFDoc doc) {
if (my_image == null) {
my_image = pdftron.PDF.Image.Create(doc, "my.jpg");
}
return my_image;
}
Then each time you need to place the image, you would use the same image instance. For example:
Element element = element_builder.CreateImage( GetImage(doc) , new Matrix2D(200, 0, 0, 250, 50, 500));
writer.WritePlacedElement(element);