Hi Kent,
On 8/31/06, Kent Gibson <[EMAIL PROTECTED]> wrote:
Has anyone had any success using the "New" pdf
properties programmatically?
I can't find much documenation, so I tried to use
XStore and pass in the properies, but they seem to be
ignored.
This one:
http://specs.openoffice.org/appwide/pdf_export/PDFExportDialog.odt
is the main spec, updated July, 31st, and this attachement to issue 67578,
http://www.openoffice.org/nonav/issues/showattachment.cgi/37895/draft-doc-pdf-security.odt
where I added some documentation not in spec document, especially
filter parameters related to security. These are waiting to be
embedded in more "well dressed" documentation.
I didn't check your code, but the following basic code fragments is
what I worked with:
/'codestart
Function MkPropVal( Optional cName As String, Optional uValue ) As
com.sun.star.beans.PropertyValue
Dim oPropertyValue As New com.sun.star.beans.PropertyValue
If Not IsMissing( cName ) Then
oPropertyValue.Name = cName
EndIf
If Not IsMissing( uValue ) Then
oPropertyValue.Value = uValue
EndIf
MkPropVal() = oPropertyValue
End Function
Sub DoExport
' now export it
oExpOptions = Array(_
MkPropVal( "FilterName", "writer_pdf_Export" ),_
MkPropVal( "FilterData", oExpFilterOptions )_
)
oDoc = ThisComponent
aURL = oDoc.getLocation()
aURL = aURL + "-macro.pdf" ' add a pdf file type
' Save the document in the new destination format.
oDoc.storeToURL( aURL, oExpOptions )
end sub
Sub CheckPDFFilterProperties()
' test the filter properties, using the current document as document
' to export
' prepare export filter options, specify only the different from default
' if the options is not specified the application default will be used
' if no filter option is given (e.g. no FilterData property), the last
user setting will be used
' see spec for details
' to test: get the name from the specification (or manual ?)
' from their name build a property array
' check the value of any of them and see in acro reader how they behave
' the following is a test setting
oExpFilterOptions = Array(_
MkPropVal( "InitialView", 0 ),_
MkPropVal( "PageLayout", 0 ),_
MkPropVal( "UseTaggedPDF", False ),_
MkPropVal( "EncryptFile", True ),_
MkPropVal( "DocumentOpenPassword", "open" ),_
MkPropVal( "RestrictPermissions", True ),_
MkPropVal( "PermissionPassword", "permission" ),_
MkPropVal( "Printing", 24 ),_
MkPropVal( "Changes", 4 ),_
MkPropVal( "EnableCopyingOfContent", True ),_
MkPropVal( "EnableTextAccessForAccessibilityTools", True )_
)
DoExport
End Sub
Sub Main
CheckPDFFilterProperties
'the following four call are for text
'SecPDFCase1
'SecPDFCase2
'SecPDFCase3
SecPDFCase4
'WriteSecDefault
End Sub
'/=====code end
I think you have to trim it a little, because it's a not very clean code.
--
Hope it helped,
Kind regards,
Giuseppe Castagno
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]