Modifying named destinations

View: New views
8 Messages — Rating Filter:   Alert me  

Modifying named destinations

by Sierra Bravo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear all
I need to pull out named destinations from a PDF file, change embedded spaces in the destinations to underscores and put it back into the same PDF.

How can this be done? While this Board has several examples of extracting NDs, I couldn't locate any about writing them back.

Thanks in advance for any help with this

sb

Parent Message unknown Re: Modifying named destinations

by Paulo Soares :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Look at the code in PdfReader.consolidateNamedDestinations(), it will
locate all the destinations.

Paulo

> -----Original Message-----
> From: itext-questions-bounces@...
> [mailto:itext-questions-bounces@...] On
> Behalf Of Sierra Bravo
> Sent: Friday, September 08, 2006 8:45 AM
> To: itext-questions@...
> Subject: [iText-questions] Modifying named destinations
>
>
> Dear all
> I need to pull out named destinations from a PDF file, change embedded
> spaces in the destinations to underscores and put it back
> into the same PDF.
>
> How can this be done? While this Board has several examples
> of extracting
> NDs, I couldn't locate any about writing them back.
>
> Thanks in advance for any help with this
>
> sb
> --
> View this message in context:
> http://www.nabble.com/Modifying-named-destinations-tf2237562.h
> tml#a6204398
> Sent from the iText - General forum at Nabble.com.
>
>
> --------------------------------------------------------------
> -----------
> Using Tomcat but need to do more? Need to support web
> services, security?
> Get stuff done quickly with pre-integrated technology to make
> your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on
> Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&
> dat=121642
> _______________________________________________
> iText-questions mailing list
> iText-questions@...
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>

Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

Re: Modifying named destinations

by Leonard Rosenthol :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At 03:45 AM 9/8/2006, Sierra Bravo wrote:
>I need to pull out named destinations from a PDF file, change embedded
>spaces in the destinations to underscores and put it back into the same PDF.

         Don't forget that you need to change NOT ONLY the actual
values in the Dests, but also all references to them.  That will take
a lot more walking of the PDF to find all the references...


Leonard

---------------------------------------------------------------------------
Leonard Rosenthol                            <mailto:leonardr@...>
Chief Technical Officer                      <http://www.pdfsages.com>
PDF Sages, Inc.                              215-938-7080 (voice)
                                              215-938-0880 (fax)


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

Re: Modifying named destinations

by Sierra Bravo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Look at the code in PdfReader.consolidateNamedDestinations(), it will
locate all the destinations.


Thanks. I am able to convert all the NDs into an XML file from the PdfReader class. Programmatically, I end up with a HashList that contains all modified NDs. Now, how do I write it back into a copy of the original file?

Thanks in advance, once again.
s.b.

Re: Modifying named destinations

by Paulo Soares :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You don't convert anything to XML. Use the code as inspiration and write your own to find the ND and replace them in place.
 
Paulo

________________________________

De: itext-questions-bounces@... em nome de Sierra Bravo
Enviada: sex 08-Set-06 16:51
Para: itext-questions@...
Assunto: Re: [iText-questions] Modifying named destinations






Look at the code in PdfReader.consolidateNamedDestinations(), it will
locate all the destinations.


Thanks. I am able to convert all the NDs into an XML file from the PdfReader
class. Programmatically, I end up with a HashList that contains all modified
NDs. Now, how do I write it back into a copy of the original file?

Thanks in advance, once again.
s.b.
--
View this message in context: http://www.nabble.com/Modifying-named-destinations-tf2237562.html#a6211677
Sent from the iText - General forum at Nabble.com.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions




Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

winmail.dat (9K) Download Attachment

Re: Modifying named destinations

by Sierra Bravo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



You don't convert anything to XML. Use the code as inspiration and write your own to find the ND and replace them in place.
 
Thanks.

I examined the code of PdfReader.consolidateNamedDestinations(), and I find that it uses a private method replaceNamedDestination(PdfObject,HashList), which presumably does what I want. However, since it is private, I'm unable to use it without changing the source code itself (which, I presume, should be the last resort).

s.b.

Re: Modifying named destinations

by Paulo Soares :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cut and paste the code to suit your needs.

Paulo

----- Original Message -----
From: "Sierra Bravo" <sierra1bravo@...>
To: <itext-questions@...>
Sent: Saturday, September 09, 2006 5:29 AM
Subject: Re: [iText-questions] Modifying named destinations


>
>
>
> You don't convert anything to XML. Use the code as inspiration and write
> your own to find the ND and replace them in place.
>
> Thanks.
>
> I examined the code of PdfReader.consolidateNamedDestinations(), and I
> find
> that it uses a private method replaceNamedDestination(PdfObject,HashList),
> which presumably does what I want. However, since it is private, I'm
> unable
> to use it without changing the source code itself (which, I presume,
> should
> be the last resort).
>
> s.b.
>
> --
> View this message in context:
> http://www.nabble.com/Modifying-named-destinations-tf2237562.html#a6220411
> Sent from the iText - General forum at Nabble.com.
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> iText-questions mailing list
> iText-questions@...
> https://lists.sourceforge.net/lists/listinfo/itext-questions 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

Re: Modifying named destinations

by Sierra Bravo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Sierra Bravo wrote:
Thanks for all the responses. I post the working code below--although it could perhaps be improved, I hope it saves time for others (esp. if they are in the same predicament that I am in--more than 200 PDFs, and over 30,000 named destinations).

What the code below does is to replace spaces in named destinations (these create problems when used within URLs) and replace them with underscores..

best
s.b.

DConvert.java