Hi Vern,
Vern Sun escribió:
Hi,
When I am opening one pdf document, the OO application ask me this:
- Character set
- Default fonts
- Language
- Paragraph break
The pdf document is opened after I give this properties.
I think you are mixing things here: the PDF document is not opened, at
least not in the sense that you have the PDF document imported for
editing (to do this you have to install the PDF import extension).
As you don't have this extension installed, the pdf file is opened with
Writer's encoded text filter, showing you its UIComponent (the dialog
entitled "ASCII Filter Options").
Now I want to opening pdf use ODK,
you will have to install the PDF import extension (which in this stage
AFAIK only opens the pdf file in OOo Draw, that is: every line of text
is a text shape)
For any case, you need to pass the property *FilterName*
http://api.openoffice.org/docs/common/ref/com/sun/star/document/MediaDescriptor.html#FilterName
If you want to import PDF (and have already installed the PDF Import
extension):
Sub PDF_Import
Dim oMediaDescriptor(0) as New com.sun.star.beans.PropertyValue
oMediaDescriptor(0).Name = "FilterName"
oMediaDescriptor(0).Value = "writer_pdf_import"
'although I use "writer_pdf_import"
'and not "draw_pdf_import",
'the file opens in Draw.
'Writer import is planed AFAIK for the next stage
Dim sURL$ ' customize this:
sURL = convertToURL("/home/ariel/Documentos/demo.pdf")
Dim oDoc as Object
oDoc = StarDesktop.loadComponentFromURL(_
sURL, "_blank", 0, oMediaDescriptor)
End Sub
but I don't know the names of this
properties in source code, and how to write it right.
116 Sequence < ::com::sun::star::beans::PropertyValue > loadProps (2);
117 loadProps[0].Name = OUString::createFromAscii( "Hidden" );
118 loadProps[0].Value <<= sal_Bool(true);
119 loadProps[1].Name = OUString::createFromAscii( "ReadOnly" );
120 loadProps[1].Value <<= sal_Bool(true);
... loadProps[1].Name ???
... loadProps[1].Value ???
121 Reference< XComponent > xComponent =
g_xComponentLoader->loadComponentFromURL(
122 sAbsoluteDocUrl, OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0,
loadProps);
If you want to import encoded text, pass "Text (encoded)" in FilterName,
and you must also pass the property *FilterOptions*
http://api.openoffice.org/docs/common/ref/com/sun/star/document/MediaDescriptor.html#FilterOptions
The filter options are passed in this case as a string with fields
separated by comma:
Sub ENCODED_TEXT_FILTER
Dim sURL$, oDoc as Object
Dim aProps(1) as New com.sun.star.beans.PropertyValue
aProps(0).Name = "FilterName"
aProps(0).Value = "Text (encoded)"
aProps(1).Name = "FilterOptions"
aProps(1).Value = "UTF8,CRLF,GalatiaSil,el-GR"
'customize this
sURL = convertToURL(_
"/home/ariel/tmp/encoded_text_filter_demo.txt" )
oDoc = StarDesktop.loadComponentFromURL(_
sURL, "_default", 0, aProps)
End Sub
The string "UTF8,CRLF,GalatiaSil,el-GR" means:
1. Encoding: UTF8
2. Line brake: CRLF (CR & LF)
3. Font name: GalatiaSil
4. Country-language code: el-GR
Explanation from sw/source/filter/basflt/fltini.cxx v. 1.59 l. 864 ss.
(SwAsciiOptions, decl. in sw/inc/shellio.hxx v. 1.39 l. 72 ss.)
// The user data contains the options for the ascii import/export filter.
// The format is:
// 1. CharSet - as ascii chars
// 2. LineEnd - as CR/LR/CRLF
// 3. Fontname
// 4. Language
// the delimetercharacter is ","
//
* For the supported encodings, refer to GetCharSetNameMap() in
sw/source/filter/basflt/fltini.cxx v. 1.59 l. 722 ss.
* Possible values for line end are
CR
LF
CRLF
* specify the font name as you see it in the "Font Name" list box on the
"Formatting" toolbar
* for the language, specify the language-country codes (see
i18npool/source/isolang/isolang.cxx v. 1.16 l. 61 ss.)
I would be glad if someone wrote some code example(java is ok) for me. thanks!
I'm to lazy to write a C++ or Java example on Sunday night, so I did it
in OOo Basic, hope this helps you anyway.
Regards,
Ariel
--
Ariel Constenla-Haile
La Plata, Argentina
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://www.ArielConstenlaHaile.com.ar/ooo/
"Aus der Kriegsschule des Lebens
- Was mich nicht umbringt,
macht mich härter."
Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]