Print Page | Close Window

Creator, Publisher, ModDate, Createdate

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=623
Printed Date: 18 May 24 at 8:18PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Creator, Publisher, ModDate, Createdate
Posted By: Darin
Subject: Creator, Publisher, ModDate, Createdate
Date Posted: 01 Feb 07 at 2:23PM
Hi
I was wondering if anyone knows whether it's possible to "Set" (or actually clear in my case) these values before saving a PDF file.

I seem to be able to set them just fine, but when I save the PDF, QuickPDF puts it's own name in as the Creator and producer, and puts today's date in for the Mod and Create dates, which I need it not to do.

Any ideas.

Thanks
Darin



Replies:
Posted By: Ingo
Date Posted: 01 Feb 07 at 4:12PM
Hi Darin!

I've never heard that there's a problem.
I do it like this:

// . . .

   QP  := TiSEDQuickPDF.Create;
   try
      Save_Cursor   := Screen.Cursor;
      QP.UnlockKey('MyUnlockKey');
      QP.LoadFromFile(Edit1.text);
      If QP.Encrypted > 0 Then
         QP.Unencrypt;

// . . .

       QP.SetInformation(0, Copy(Trim(pdf_version.Text),1,3)); //PDF-Version
       QP.SetInformation(1, pdf_autor.Text);             //Autor
       QP.SetInformation(2, pdf_titel.Text);             //Titel
       QP.SetInformation(3, pdf_subject.Text);           //Subject
       QP.SetInformation(4, pdf_keys.Text);              //Keywords
       QP.SetInformation(5, pdf_creator.Text);           //Creator
       QP.SetInformation(6, pdf_producer.Text);          //Producer

// . . .

       QP.SaveToFile(Form1.SaveDialog1.FileName);

// . . .

    finally
       QP.Free;
    end;



...
and i've no problems.

Best regards,
Ingo

 


Posted By: Darin
Date Posted: 01 Feb 07 at 4:39PM
Hmm, well, when I do essentially that same bit of code, I end up with

<<
/Producer (iSEDQuickPDF 5.21 \(www.sedtech.com\))
/Creator (iSEDQuickPDF 5.21 \(www.sedtech.com\))
/CreationDate (D:20070201153335+06'00')
/ModDate (D:20070201153335+06'00')
>>

stuck into the PDF (I pulled it out using a hex editor)


My test is putting BLAH in for all these fields

for instance....
rQPDF.SetCustomInformation "CreationDate", "BLAH"
rQPDF.SetCustomInformation "ModDate", "BLAH"
rQPDF.SetInformation 5, "BLAH"
rQPDF.SetInformation 6, "BLAH"

Eveything else is the same as your snippet.

Sure looks like ISED is forcing those fields no matter what you set them to.

Note that I don't get any errors, all success return codes, it's just that the final file doesn't contain what I set the props to.

Odd.

Darin




Posted By: bogey
Date Posted: 01 Feb 07 at 5:10PM

I have never had a problem setting it either. Perhaps this is a bug in version 5.21?

 



Posted By: Darin
Date Posted: 01 Feb 07 at 5:15PM
Could be....

I am using 5.21.0.1 I downloaded from this fanclub site.

Maybe there's something slightly amiss with the new build?

Darin




Posted By: ukobsa
Date Posted: 02 Feb 07 at 3:40AM
Darin,

I just did a short test:
- set Creator, Producer, CreationDate, ModDate with code:  were set fine to 'BLAH'.
- Then save it: All changed values are saved but only ModDate is set to the current time!  And this is a correct behaviour as saving the changed document must set it's mod date.

In detail: every call to Savexyz() sets ModDate to current datetime

just a few questions:
- are you using a source code version or a compiled dcu version or com interface of QuickPDF?
- is this happening also with newly created (empty) pdfs
- can you provide a sample pdf together with the values you want to set?

greetings,
Ulrich




Posted By: Darin
Date Posted: 02 Feb 07 at 8:45AM
I'll put together a small test app like you have and give it a whirl

I'm using the ActiveX version of 5.21.0.1 downloaded from this fan club site. I don't have the source code, although I'm considering getting that version.

I noticed there are 2 interfaces in the dll that seem almost if not identical, ised.quickpdf, and ised.quickpdf2

Initially, i was using the quickpdf2 interface, but ran into several odd issues. Switching to the quickpdf interface fixed that.

About the MODDATE item, While I understand that normally, that's exactly the behavior you'd want, in this particular case, I actually do need to force the mod date to what I set it to. Maybe it's some fixed date (like 1900-01-01). This is because I'm looking to remove any metadata from the doc that might reflect it's history.

Besides, I'd almost argue it's a bug that you can set the moddate but that it doesn't stick on save. If the programmer doesn't set it, the lib should update it on save, if it does get set, that value should be honored, I'd think (or raise an error at the point that it gets set saying something like "This is a read only property".

Just my 2c. Overall, this seems like a pretty solid lib and the value is definitely good. I may just have to live with this one issue, assuming I can get the Producer etc to work right.

Thanks for trying it though. I'll have a go.

Darin


Posted By: ukobsa
Date Posted: 02 Feb 07 at 9:13AM
Ok, I hope that I find the time to test it against this version.

about your suggestion: While you can get ModDate using GetInformation(8) you cannot set it using SetInformation. This indicates that it should be handled as a read-only information.

But for what you want to do with removing ModDate is perhaps a wrong way: it could corrupt your PDF as ModDate is a required property  when working with Page-Piece dictionaries. But I have to study the PDF Spec for this.

greetings,
Ulrich






Posted By: Darin
Date Posted: 02 Feb 07 at 9:17AM
Ah, well, now if it's really required, that'd change things a bit. I've only just begun to work through the adobe pdf spec so I'm definitely no expert on that.

Maybe the setinfo just needs to apply some validation to make sure that the date you set in is a valid date according to the spec, and not just any old value? As long as the field was really a date, I'd guess the dictionary stuff would be ok, but that's just a guess.

Thanks for the response. I'm setting up a VB test proj now.

Darin


Posted By: marian_pascalau
Date Posted: 02 Feb 07 at 9:31AM
Darin, why don't you use the mailto:support@quickpdf.org - support@quickpdf.org EMail address to submitt your bug? Are we opening new support groups now?
 
Hey guys, I have no problem to forward all support emails to you too. But please make your work organized and not behind my back. Otherwise I see no reason way to lose my time improvig this library when everybody does what he wants.
 
For what reason we spend our time to monitor requests and put bug reports in place when anyway we have a nive Peer2Peer network. I am realy dissapointed guys.


Posted By: Darin
Date Posted: 02 Feb 07 at 9:37AM
I apologize if I haven't submitted this issue properly. I'm not really even sure it's a "bug" yet (although I suspect the issue with the MODDATE "might" be considered one, but then it might not also).

Once I get a little test app going to make sure I'm seeing what I think I'm seeing, I'd be happy to zip the whole thing up and send it to the support email address.

I'm certainly not trying to go behind anyone's back here. I'd love to help any way I can.

Thanks
Darin


Posted By: ukobsa
Date Posted: 02 Feb 07 at 9:53AM
Marian,

???

I really don't understand your problem. It was a question and Ingo, Bogey and I tried to help. Be sure that if it would be a problem that needs some code changes I would have added it to our new Issue tracker (it no other would have done it).

If you want, then we can do discussion about support by email.


Ulrich


Posted By: Darin
Date Posted: 02 Feb 07 at 12:16PM
Hi All
First, a HUGE thank you to everyone that threw in on this issue. I really appreciate it.

I built up a small little test app, tried it and you guys were right, everything got cleaned except the moddate.

Ok. So I started trying to narrow down what was different in my main app vs the test.

In the end, it turned out that I had forgotten about the second pass of my program.

In the first pass, everything worked fine, but in the second pass, I had a conditional that caused the LoadFromFile to get skipped.

So, of course, the end result was that I was saving a file that had never been loaded.

So then, I thought it was odd that even with that being the case, that the Producer, etc fields were being reset to the ISED text.

So I kept digging, and realized that if there is not metadata in the field (for instance if I call GetInformation(5) and get back a blank), I don't even bother calling SETINFORMATION on that field.

And THAT appears to be the rub. If you call GETINFORMATION when no file has been loaded, you'll get back a blank string, but if you save the file WITHOUT calling SETINFORMATION, the file ends up with the ISED creator/producer names.


So in summary, I don't believe there's really any probs with iSed, other than the setting of the MODDATE. One might argue that if you call getinformation, and then save the pdf, whatever was returned by getinfo should get saved, but nobody would intentionally use the library like that, so I'm not concerned about that issue.


About the MODDATE issue, what is the proper way to submit an issue like that? Should I email it to support@quickpdf.org?

Again, I'm not sure it's really a bug per se, but it does seem like it's not operating as intuitively as it seems it should.


Thanks again for everyone's help with this

Darin




Posted By: marian_pascalau
Date Posted: 02 Feb 07 at 1:11PM
Ulrich, the problem is that we have to avoid creating parallel support discussions for test cases when something was not confirmed as usage error inside the forum
 
Each problem must be monitored whether we want it or not. If someone has or believes that he has a problem he should send a description to mailto:support@quickpdf.org - support@quickpdf.org where each available DEV-member has access on (if not he may ask for access). Otherwise, the creator of some function have no chance to explain himself and we may close a thread with an inappropriate answer.
 
Darin, if you believe that your problem is real please (I strongly recommend to) submit your problem to mailto:support@quickpdf.org - support@quickpdf.org  . One more info Darin, the QuickPDF2 coclass is a subclass of QuickPDF. In case that you have problems with one of this type objects you have almoust sure with the second as well.
 
Best regards, Marian


Posted By: Ingo
Date Posted: 02 Feb 07 at 5:52PM
Hi Darin!

Only an idea...
If you want to remove/reset the ModDate why not creating a new empty pdf-document... then you can copy the pages from the older one into this new document with a new ModDate and the old content ;-)

Best regards and good luck!
Ingo



Posted By: Darin
Date Posted: 02 Feb 07 at 6:11PM
Hi Ingo

Thanks for the idea. But from what I've seen so far, the moddate is updated to the current date anytime you save the PDF, so whether I copied the pages into a blank PDF or just updated the original PDF, the moddate would seem to end up set to today's date and time.

What I'd really like to do is set the mod date to either nothing at all, or to some static date, say, jan 1, 1900.

I'm going to keep playing with it and see if there's any way around the "automatic moddate update' that seems to happen when you save a pdf, but I kind of doubt there will be...

Still, not the end of the world!

Darin


Posted By: marian_pascalau
Date Posted: 02 Feb 07 at 7:17PM
Darin, inside the source code (class TiSEDQuickPDF) there is a call to
 
FSelDoc.SetInfo('ModDate', GetPDFDateTime);
 
on each call to seve document (SaveToFile; SaveToString). If you believe that this call is not needed (but in reality it make sens to me) and you have license to QuickPDF source code then you should go there and comment out these statements.
 
If you want this change integrated in our sourcecode you have to sumbit a CR and we will see how we will process your request.
 
Best regards to everybody,
Marian


Posted By: Darin
Date Posted: 05 Feb 07 at 9:13AM
Hi Marian

Thanks. i'd figured it was something like that. I'd rather not use a "one off" of the source, because I think a change like this would make the mainline more generally usable and act more like it's documented now. Besides that, I don't even have the lic for the source yet, although I'm seriously considering it just to be able to evaluate what's going on inside.

In order to submit a CR, should I just email the comment to support@quickpdf.org?

What's the appropriate way to do that?

I'm thinking this issue in particular would be a very quick change. though there may be some ramifications I'm unaware of.

Thanks again
Darin



Posted By: marian_pascalau
Date Posted: 06 Feb 07 at 3:44AM
Hi Darin,  
first of all, you should submit CR/BUGs only over support email address.
second, this is not really a quick change. This is because the creation of PDF files was not my main concern and I myself I am not aware of all dependencies inside the source code.
 
One thing is sure. The removal of this "ModDate date reset" is not 100% propper. It make sense to reset the modification date but not this way. First this change will be done inside program when something was changed inside PDF structure. Then you may set the ModDate as you wanted and on save you get what you need.
 
The second problem is time. You have to accept that at the moment we have other concerns in our priority list. But we may consider your sponsoring to bring some of your needed features direct on our (my) top list. Of course this is optional, otherwise you have to be patient for a while.
 
Best regards, Marian
 


Posted By: Ingo
Date Posted: 06 Feb 07 at 3:55AM
Hi Darin!
What about a workaround to solve this problem without changing the library source? Nearly all programming languages are offering a function to set the system date of the machine...

Create ...
Unlock ...
LoadFromFile ...
-> save the system date
-> set the system date to the one you want
SaveToFile ... (now ModDate will set YOUR date)
Free
-> set the system date again with the saved date
-> change the file date with the saved date

Only my thoughts in this case ... It should work.

Best regards,
Ingo

T


Posted By: Darin
Date Posted: 06 Feb 07 at 9:08AM
Hi Ingo,
You know, I've used that trick before, and I completely missed it this time round.

Good point!

I'll do some experimenting and see how it goes.

Thanks for the heads up!

Darin


Posted By: Darin
Date Posted: 06 Feb 07 at 9:21AM
Hi Marian

Thanks for you reply.

I completely understand about the time issue. I suspect there's many other things that are higher prio that a relatively obscure bit like this.

If I'm understanding the first bit, you're saying that the MODDATE handling the way it is now in the source isn't quite right, in that it resets the MODDATE right before save, and what it really needs to do is reset the moddate each time a call is made to the library that does something to change the PDF, and NOT at the point you actually call the SAVE function. I hope I got that right.

If that's what you meant, I completely agree and I can definitely see where that would be more work. But I like that approach even more than my original suggestion.

Thanks for the reply. If I can license the source, I very well may try to throw in a contribution.

Thanks
Darin



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk