|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Bad page numbers when updating table of contentsHi,
This is my first post here, I'm not experimented with uno but trying to use it for generating pdf from odt documents on a server. It works quite well, my server is running debian and a python server application, so i use pyUno, with openoffice.org 3.1.1 running in headless mode. I managed to open a document and save it to pdf, It was quite easy. The problem I have now appears when updating the table of contents, the page numbers are not correctly set : they are all changed to the first table of contents page number (2) (so the index is updated, in the odt they were set to 1). There might be several reasons to that : - as oo.o runs headless, does it automatically updates the page numbers ? - I call the update() method on the index just after having called loadComponentFromURL, do I need to attach my update to an kind of event (I was wondering if the document were finished to be loaded when I do my update) I would greatly appreciate any advice on this way of doing things using uno. Thanks Stephane. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: Bad page numbers when updating table of contentsHello Stéphane,
On Thursday 15 October 2009, 10:26, Stéphane Bonhomme wrote: > Hi, > > This is my first post here, I'm not experimented with uno but trying to > use it for generating pdf from odt documents on a server. > > It works quite well, my server is running debian and a python server > application, so i use pyUno, with openoffice.org 3.1.1 running in > headless mode. I managed to open a document and save it to pdf, It was > quite easy. > > The problem I have now appears when updating the table of contents, the > page numbers are not correctly set : they are all changed to the first > table of contents page number (2) (so the index is updated, in the odt > they were set to 1). > > There might be several reasons to that : > - as oo.o runs headless, does it automatically updates the page > numbers ? > - I call the update() method on the index just after having called > loadComponentFromURL, do I need to attach my update to an kind of event > (I was wondering if the document were finished to be loaded when I do my > update) AFAIK updating the TOC does not force a re-pagination. The easiest is to dispatch a ".uno:Repaginate" before, or even an ".uno:UpdateAll". Nevertheless, I've no idea if this works headless. Try it and tell. Regards -- Ariel Constenla-Haile La Plata, Argentina --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: Bad page numbers when updating table of contentsHello Ariel,
Thanks for your solution it works fine. Now I'm trying to set pdf export parameters, but I don't know how to access the configuration service using pyuno, may be someone could give me the path.... cheers S.B. Le jeudi 15 octobre 2009 à 11:02 -0300, Ariel Constenla-Haile a écrit : > Hello Stéphane, > > On Thursday 15 October 2009, 10:26, Stéphane Bonhomme wrote: > > Hi, > > > > This is my first post here, I'm not experimented with uno but trying to > > use it for generating pdf from odt documents on a server. > > > > It works quite well, my server is running debian and a python server > > application, so i use pyUno, with openoffice.org 3.1.1 running in > > headless mode. I managed to open a document and save it to pdf, It was > > quite easy. > > > > The problem I have now appears when updating the table of contents, the > > page numbers are not correctly set : they are all changed to the first > > table of contents page number (2) (so the index is updated, in the odt > > they were set to 1). > > > > There might be several reasons to that : > > - as oo.o runs headless, does it automatically updates the page > > numbers ? > > - I call the update() method on the index just after having called > > loadComponentFromURL, do I need to attach my update to an kind of event > > (I was wondering if the document were finished to be loaded when I do my > > update) > > AFAIK updating the TOC does not force a re-pagination. > The easiest is to dispatch a ".uno:Repaginate" before, or even an > ".uno:UpdateAll". > > Nevertheless, I've no idea if this works headless. > Try it and tell. > > Regards --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: Bad page numbers when updating table of contentsHello Stéphane,
On Friday 16 October 2009, 08:23, Stéphane Bonhomme wrote: > Hello Ariel, > > Thanks for your solution it works fine. > > Now I'm trying to set pdf export parameters, but I don't know how to > access the configuration service using pyuno, may be someone could give > me the path.... attached is a Python version of http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export#Accessing_the_configuration Regards -- Ariel Constenla-Haile La Plata, Argentina [pdf_config.py] # -*- coding: utf-8 -*- # sample client application import uno import unohelper from com.sun.star.beans import NamedValue def get_pdf_config_access( xContext ): """Access the PDF configuration.""" xConfigurationProvider = xContext.ServiceManager.createInstanceWithContext( "com.sun.star.configuration.ConfigurationProvider", xContext ) aNamedValue = NamedValue() aNamedValue.Name = "nodepath" aNamedValue.Value = "/org.openoffice.Office.Common/Filter/PDF/Export/" xConfigurationUpdateAccess = xConfigurationProvider.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationUpdateAccess", (aNamedValue,) ) return xConfigurationUpdateAccess sConnectionStr = "uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext" localContext = uno.getComponentContext() localServiceManager = localContext.getServiceManager() xURLResolver = localServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", localContext) remoteContext = xURLResolver.resolve( sConnectionStr ) remoteServiceManager = remoteContext.getServiceManager() xPDFConfig = get_pdf_config_access( remoteContext ) xPDFConfig.setPropertyValue("ReduceImageResolution", True) xPDFConfig.setPropertyValue("MaxImageResolution", 600) # When exporting a document to PDF, the default is PDF 1.4 # Since OOo 2.4 the PDF/A-1a is also supported. # PDF/A-1a is an ISO 19005-1:2005 International Standard. # # NOTE that some other options WILL NOT be available if this format # is selected (UseTaggedPDF, ExportFormFileds, FormsType, # all security options) xPDFConfig.setPropertyValue("SelectPdfVersion", 1) # "Magnification" specifies the action to be performed # when the PDF document is opened. # A value of 4 opens with the zoom level specified in the # "Zoom" property. xPDFConfig.setPropertyValue("Magnification", 4) xPDFConfig.setPropertyValue("Zoom", 60) # When using XMultiPropertySet:setPropertyValues(), # properties must be alphabetically sorted! xPDFConfig.setPropertyValues( ( "CenterWindow", "DisplayPDFDocumentTitle", "InitialView", "PageLayout" ), ( True, False, 2, 1 ) ) # commit the changes, otherwise they will be lost! xPDFConfig.commitChanges() --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
| Free embeddable forum powered by Nabble | Forum Help |