OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

ExportPDF with a specific PageRange

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Code Snippets
View previous topic :: View next topic  
Author Message
Cold_Burn
Power User
Power User


Joined: 21 Apr 2008
Posts: 66

PostPosted: Fri May 11, 2012 6:36 am    Post subject: ExportPDF with a specific PageRange Reply with quote

To export a specific PageRange to PDF.
I think it will be useful to others.

Code:
Boolean   lb_result
string ls_docfullpath
OLEObject ioo_objPropertyValue
OLEObject ioo_objPropertyValueArray[]
OLEObject ioo_objPropertyValue1
OLEObject ioo_objPropertyValue2
OLEObject ioo_objPropertyValueArray1[]
OLEObject ioo_objDoc1
OLEObject ioo_objValueObj

if Not IsValid(ioo_obj) or IsNull(as_docfullpath) then return False
if ioo_obj.of_isalive() = FALSE then return False

ioo_objDoc1=ioo_objDesktop.getcurrentcomponent()

ioo_objPropertyValue = ioo_obj.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
ioo_objPropertyValue1 = ioo_obj.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
ioo_objPropertyValue2 = ioo_obj.Bridge_GetStruct("com.sun.star.beans.PropertyValue")

ioo_objPropertyValue2.Name = "PageRange"
ioo_objPropertyValue2.Value = "1-3;6;8" //will take a argument here to accommodate the various PageRange possibilities

ioo_objPropertyValueArray1[upperbound(ioo_objPropertyValueArray1)+1] = ioo_objPropertyValue2

ioo_objValueObj = ioo_objDesktop.Bridge_GetValueObject()
ioo_objValueObj.set("[]com.sun.star.beans.PropertyValue", ioo_objPropertyValueArray1)

ioo_objPropertyValue.Name= "FilterName"
ioo_objPropertyValue.Value= "writer_pdf_Export"
ioo_objPropertyValue1.Name= "FilterData"
ioo_objPropertyValue1.Value= ioo_objValueObj

ioo_objPropertyValueArray[upperbound(ioo_objPropertyValueArray)+1]=ioo_objPropertyValue
ioo_objPropertyValueArray[upperbound(ioo_objPropertyValueArray)+1]=ioo_objPropertyValue1

ls_docfullpath=of_filename2url(as_docfullpath,true)

ioo_objDoc1.storeToURL(ls_docfullpath, ioo_objPropertyValueArray)

return lb_result


Some of the language is PowerScript but you can see the algorithm.

Cold_Burn
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Code Snippets All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group