I've updated the patch as suggested <
http://github.com/ymasory/Flashup/blob/master/lib/nodiff-patch-r4594>.
The approach is to overload the Document constructor to allow the user to
specify a unique ID string. If the user does not use that constructor the
old randomly generated ID will be used. When I use the patched jar I give
the overloaded constructor the hashcode the abstract syntax tree of my
content, since Scala case classes have stable hashCodes between JVM
instances. So I'm happy and so should the databases everyone's worried
about.
Best,
Yuvi
--
Yuvi Masory
University of Pennsylvania
On Wed, Sep 29, 2010 at 1:26 PM, Yuvi Masory <[email protected]> wrote:
> If by "page content" you mean the underlying content I'm making a PDF of, I
> think I agree.
> I'll mde5 the hashCode of those Java objects and make that the file ID.
> Should work :)
>
>
> Best,
> Yuvi
>
> --
> Yuvi Masory
> University of Pennsylvania
>
>
> On Wed, Sep 29, 2010 at 12:54 PM, Leonard Rosenthol <[email protected]>wrote:
>
>> Why not extract the page content and hash that?
>>
>>
>>
>> *From:* Yuvi Masory [mailto:[email protected]]
>> *Sent:* Wednesday, September 29, 2010 12:05 PM
>>
>> *To:* iText Questions
>> *Subject:* Re: [iText-questions] how to get zero diff on two
>> consecutively created pdf files
>>
>>
>>
>> Well I hope you like tea because they're already out:
>> http://yuvimasory.com/flashcards.html
>>
>> I want iText to behave this way because I have a script that rebuilds all
>> my pdfs every night to benefit from the latest changes in my program.
>> However, I *don't* want meaningless revisions to complicate my source tree
>> in Git. So ideally, if the program has not changed, the pdfs that result
>> will be identicai, and Git will not commit them.
>>
>>
>>
>> Anyway, does anyone have suggestions as to how to construct a reproducible
>> unique ID for a file? Perhaps traversing the Document in some way as to make
>> a string from its contents?
>>
>> Thanks again for the help.
>>
>> Best,
>> Yuvi
>>
>> --
>> Yuvi Masory
>> University of Pennsylvania
>>
>> On Wed, Sep 29, 2010 at 7:45 AM, Leonard Rosenthol <[email protected]>
>> wrote:
>>
>> Can you tell us what you are doing that you need iText to work this way?
>>
>>
>>
>> Because if you’re files show up in the real world with the matching IDs, I
>> will get on the R3 downtown to the U of P for a “personal visit”….
>>
>>
>>
>> Leonard
>>
>>
>>
>> *From:* Yuvi Masory [mailto:[email protected]]
>> *Sent:* Wednesday, September 29, 2010 7:38 AM
>> *To:* iText Questions
>>
>>
>> *Subject:* Re: [iText-questions] how to get zero diff on two
>> consecutively created pdf files
>>
>>
>>
>> Thanks for the feedback everyone! Right now the patch meets my needs, but
>> I may modify it to construct unique (reproducible) IDs when I have the
>> chance.
>>
>> Best,
>> Yuvi
>>
>> --
>> Yuvi Masory
>> University of Pennsylvania
>>
>> On Wed, Sep 29, 2010 at 7:01 AM, Leonard Rosenthol <[email protected]>
>> wrote:
>>
>> As Michael said, the ID is indeed that - a UNIQUE identifier for the
>> document and is indeed used in that way by various CMS/DMS systems to track
>> the document.
>>
>> So if your code is being used in DEBUG mode for some sort of regression
>> test - that's fine. But you can NOT put it into a production system.
>>
>> Leonard
>>
>>
>> -----Original Message-----
>> From: mkl [mailto:[email protected]]
>> Sent: Wednesday, September 29, 2010 6:36 AM
>> To: [email protected]
>> Subject: Re: [iText-questions] how to get zero diff on two consecutively
>> created pdf files
>>
>>
>> Yuvi,
>>
>> Yuvi Masory wrote:
>> > 3) The PDF's trailer includes a randomly generated String as its file ID
>> -
>> > solved by changing the appropriate method in PdfEncryption to always
>> hash
>> > the empty string.
>>
>> That could turn out against you eventually: As the trailer IDs are meant
>> to
>> be identifiers for documents and your patched code calculates the
>> identical
>> one for ANY document, other applications may consider all the documents
>> you
>> generate with that patched iText to be identical. This might result in
>> them
>> rejecting or silently discarding your documents as duplicates.
>>
>> Therefore, I would advice you to reconsider this part of your patch:
>> Either
>> generate an ID which is unique for the generated document but
>> reproducible,
>> or change the patch to not include a trailer ID at all.
>>
>> Regards, Michael.
>> --
>> View this message in context:
>> http://itext-general.2136553.n4.nabble.com/how-to-get-zero-diff-on-two-consecutively-created-pdf-files-tp2718441p2718700.html
>> Sent from the iText - General mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>> Start uncovering the many advantages of virtual appliances
>> and start using them to simplify application deployment and
>> accelerate your shift to cloud computing.
>> http://p.sf.net/sfu/novell-sfdev2dev
>> _______________________________________________
>> iText-questions mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> Buy the iText book: http://www.itextpdf.com/book/
>> Check the site with examples before you ask questions:
>> http://www.1t3xt.info/examples/
>> You can also search the keywords list:
>> http://1t3xt.info/tutorials/keywords/
>>
>>
>> ------------------------------------------------------------------------------
>> Start uncovering the many advantages of virtual appliances
>> and start using them to simplify application deployment and
>> accelerate your shift to cloud computing.
>> http://p.sf.net/sfu/novell-sfdev2dev
>> _______________________________________________
>> iText-questions mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> Buy the iText book: http://www.itextpdf.com/book/
>> Check the site with examples before you ask questions:
>> http://www.1t3xt.info/examples/
>> You can also search the keywords list:
>> http://1t3xt.info/tutorials/keywords/
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Start uncovering the many advantages of virtual appliances
>> and start using them to simplify application deployment and
>> accelerate your shift to cloud computing.
>> http://p.sf.net/sfu/novell-sfdev2dev
>> _______________________________________________
>> iText-questions mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> Buy the iText book: http://www.itextpdf.com/book/
>> Check the site with examples before you ask questions:
>> http://www.1t3xt.info/examples/
>> You can also search the keywords list:
>> http://1t3xt.info/tutorials/keywords/
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Start uncovering the many advantages of virtual appliances
>> and start using them to simplify application deployment and
>> accelerate your shift to cloud computing.
>> http://p.sf.net/sfu/novell-sfdev2dev
>> _______________________________________________
>> iText-questions mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> Buy the iText book: http://www.itextpdf.com/book/
>> Check the site with examples before you ask questions:
>> http://www.1t3xt.info/examples/
>> You can also search the keywords list:
>> http://1t3xt.info/tutorials/keywords/
>>
>
>
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/