How do I set the PDF properties ?

In the screen shot (below), you can see the Auteur (Author) and Object fields are empty and Mac OS X is credited as the Auteur du PDF (PDF’s Author) does not have my name (or any user’s name).

How can I fill the empty fields and PDF’s Author field ?


PS: it may be nice to be able to let the user change all defaults values (set a value to all fields).

you can import PDF to DynaPDF, change values and write back to disk.

Same may be possible with PDFKit or CoreGraphics PDF functions for Mac only apps.
All in MBS Plugins.

Exiftool should work according to the site but I hav not tested it.

Are you creating the PDFs yourself? I’ve done some additions to this information in PDFs that my app creates with CoreGraphics from the MBS plugin.

Yes, I do.

If I have time this evening I’ll dig out some code - crazy day today.

[quote]@Beatrix W Are you creating the PDFs yourself?
Yes, I do.[/quote]


Actually, you can do this with existing PDFs. I’m first creating a PDF from Html via a HtmlViewer and then I add header, page numbers and some information:

[code]Private Sub CreatePDF(theSubject as String, thePDFFile as FolderItem, newPrintPath as FolderItem)

'add to the raw printed html page numbers and the subject as header

if newPrintPath = nil then Return

'get page count
app.SleepCurrentThread 1
if thePDFFile = nil then Return
dim thePDFDoc as CGPDFDocumentMBS = thePDFFile.OpenAsCGPDFDocumentMBS

if thePDFDoc = nil then Return
dim pageCount as Integer = thePDFDoc.PageCount

'make new pdf
dim finalPDF as CGContextMBS = newPrintPath.NewCGPDFDocumentMBS(thePDFDoc.MediaBox(1), theSubject, SystemInformationMBS.UserName, “Mail Archiver X”)

if finalPDF = nil then
globals.theerrorlog.DialogErrorProceed “There was a problem with generating the PDF for the subject “”” + theSubject + “”"! Please report this to Moth Software."
globals.theerrorlog.logitem "print path: " + newPrintPath.NativePath

'loop through pages and add header information
for currentPage as Integer = 1 to pageCount
  dim theRect as new CGRectMBS 
  theRect = thePDFDoc.MediaBox(currentPage)
  if theRect = nil then Return
  finalPDF.BeginPage theRect
  finalPDF.DrawCGPDFDocument(thePDFDoc, theRect, currentPage)

 'draw header here
  'page is finished


end if

'add creation date
finalPDF = nil
newPrintPath.CreationDateMBS = MainDateTime

End Sub[/code]


Print data just like if I print to a true printer, then in the Print dialog, I choose Print to pdf (to disk) in the popup menu, set a file name and that is all.

I can even open a copy in Preview (and just generate the pdf without saving it to disk) to check what I do / get…

Thank you Beatrix, I will use your code this afternoon.

If everything will be OK, I have a strange bug to squash.

I print the ListBox background colour (and the black text above that), but in the last page, I get the last color printed (the same number of lines I print with text) below the last line with text. So if the last page have only one line of text, I get a no text but the previous background printed. If there is 10 lines with text, I will get 10 lines with teh same background color used in the last line of text. I already asked here (last year ?), get there two or three times without success. Maybe this time…

Oh, I know: I will do code design reverse ingeneering: write the code desing on a sheet of paper from the actual code and watch carefully what I will get. Who knows, now that I forgot my code, doing that may give a light ray on the error…

Next possible search is to refactor that code.

To Jeff: I do that on OS X (thus the channel), but it works fine using a virtual prd printer for windows (PDFCreator is the one I use, I think).