Q:
We've been trying to make a new PDF file, which we planned to have a
row of the repeated same images from a different PDF source. We wrote a
sample code to test on copying images. But the code kept giving us
exception and didn't work what we planned it to work. This is what was
shown on the screen.
Exception:
Message: Objects cannot belong to different documents
Conditional expression: this_doc == obj->GetDoc()
Filename : Dict.cpp
Function : trn::SDF::Dict::Put
Linenumber : 104
Could you tell us how to solve this prblem? (I attached the test image (image1.pdf) in the sample code folder(Test1)
As far as I
know, PDFNet SDK cannot copy elements. But, we want to have each element
repeatedly printed in a new PDF file after collecting and analysing
each element from an original PDF file. Would you let us know how to
solve this issue? It seems that the attached sample code doesn't really
help you to understand but I attached it anyway. When I run a sample
code afer building it, memory access violation error occurs. And if I
try to process everything in one single function in order not to making
errors, I've got a new blank PDF file.
----------
A:
Each pdftron::PDF::Image object is created within the context of PDFDoc
or SDFDoc. Thus you would need to create a new Image within tar_doc,
using Image::Create:
http://www.pdftron.com/pdfnet/PDFNetC/d2/d12/classpdftron_1_1_p_d_f_1_1_image.html
> But, we want to have each element repeatedly
> printed in a new PDF file after collecting and
> analysing each element from an original PDF file.
You can certainly re-use the same object multiple times
in a page --- for example, you can show one image multiple times (as
shown in
http://www.pdftron.com/pdfnet/samplecode.html#ElementBuilder