In PDFBox, either keep the source open and don't close it before saving your copy document; or use PDFCloneUtility.

I suspect you mean the resources... these you could simply assign the resources from the old to the new, while creating an adjusted content stream.

I also suggest you use the PDFDebugger app to look at what's really in your document.

Tilman

Am 25.12.2017 um 07:18 schrieb Dale King:
I am still trying to get this to work. I tried switching to iText library
and while initially getting better results with annotations, it still did
not work. I am coming to the conclusion that the primary issue is that if I
copy an annotation from one document to another the problem is that the
annotation dictionary is a shallow copy. The annotation dictionary
references other objects that are not copied to the destination document.
So I am wondering if there is a simple way given a dictionary to do a deep
copy to another document?

On Mon, Dec 4, 2017 at 4:44 PM, Dale King <[email protected]> wrote:

So what I was missing was that annotations can have their own content
streams. This is going to be difficult. I know it is easier programming
wise to add the annotations afterward, but usability wise it is easier to
do it before hand.

So to understand the problem more what my program is doing is it takes an
input that looks like the input I showed you except that there are perhaps
20-30 pages like that that are a single line of music. My program builds
another document with pages that are 8"x5" (to match my tablet that has a
16x10 aspect ratio). The program puts as many lines of music it can per
page (and can actually put several short lines together horizontally.

On Mon, Dec 4, 2017 at 2:11 PM, Tilman Hausherr <[email protected]>
wrote:

Am 04.12.2017 um 19:57 schrieb Dale King:

OK that is really odd. I am on Mac and in preview the blue rectangle is
not the same size as yours, but when I click on it it changes to a dashed
black rectangle bordering the enter page and the blue goes away.

Sorry, I don't speak PDF content streams to know what the content stream
is telling me.

In the PDF 32000 specification look for "operator summary". I'll annotate
a few below.

For what you want to do (I haven't understood all the words - I assume
you want to cover parts so that you see only one line of notes) it would be
easier to create the annotations as new instead of copying them.

Tilman


On Mon, Dec 4, 2017 at 1:34 PM, Tilman Hausherr <[email protected]
<mailto:[email protected]>> wrote:

     Am 04.12.2017 um 18:42 schrieb Dale King:

     I tried for a simpler goal, just take that annotation and
     translate it to cover the entire output page, but even that did
     not work as can be seen in the output pdf. Something is getting
     in the way and adding its own coordinate translation but I cannot
     figure out what.

     The annotation of the target PDF does cover the entire page. Click
     on the left border of the page in Adobe Reader and you'll see the
     rectangle. However...

     I suspect you're unhappy with the blue rectangle. This could be
     because of the appearance stream which you took from the source
     unchanged:


     q
     Q
     q
       7.044313E-5 4.893184E-6 112.2815 29.0435 re   <==== sets a
     rectangle and clip
       W
       n
       /Cs1 cs
       0 0.3813631 0.9982447 sc  <==== color
       /Gs1 gs
       3.498857 3.498791 105.2839 22.04592 re <=== sets a rectangle and
     fill
       f
       4.997579 w
       2 J
       [ 11.99758 18.99274 ] 1 d
       /Cs1 CS
       0 0 0 SC  <===== black
       /Gs2 gs
       q
         1 0 0 1 -399.6912 -556.2903 cm
         403.1903 559.7895 105.284 22.04594 re  <==== sets a rectangle
     and stroke
         S
       Q
     Q


     Tilman




--
Dale King




--
Dale King





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to