Sponsored Content
Top Forums Shell Programming and Scripting How to create or convert to pdf files from csv files using shell script? Post 302921023 by junior-helper on Tuesday 14th of October 2014 10:14:16 AM
Old 10-14-2014
If you have libreoffice, you could try this for a one-to-one copy:
Code:
$ libreoffice --headless --infilter=text --convert-to pdf file.csv

The light-blue part is optional, figure out the difference if you leave it out.
This User Gave Thanks to junior-helper For This Post:
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

convert files into csv format using perl

Hi all perl gurus, I need your help to get the desired output in perl. I have a file which has text in it in the format Connection request start timestamp = 12/08/2008 00:58:36.956700 Connect request completion timestamp = 12/08/2008 00:58:36.959729 Application idle time ... (10 Replies)
Discussion started by: azs0309
10 Replies

2. UNIX and Linux Applications

How to create PDF documents from my word files?

Hi guys, I need to create PDF documents from my word files. How do I do it? (4 Replies)
Discussion started by: Hilda Thompson
4 Replies

3. Shell Programming and Scripting

how to create the files dynamically in c shell script

how can i CREATE a txt file dynamically in c shell: for instance: #! /bin/csh for each i (*) cat>file$i.txt for each j do .... (1 Reply)
Discussion started by: jdsignature88
1 Replies

4. Shell Programming and Scripting

Perl program to convert PDF to text/CSV

Please suggest ways to easily convert pdf to text in perl only on windows (no other tools can be downloaded) Here is what I have been doing : using a module CAM::PDF to extract data. But it shows everything in messy format :wall: But this module is the only one working with the pdf... (0 Replies)
Discussion started by: chakrapani
0 Replies

5. UNIX for Dummies Questions & Answers

Extracting data from PDF files into CSV file

Hi, I have several hundreds of PDFfiles number 01.pdf, 02.pdf, 03.pdf, etc in one folder. These are vey long documentd with a lot of information (text, tables, figures, etc). I need to extract the information asociated with one disease in particular (Varicella). The information I need to... (5 Replies)
Discussion started by: Xterra
5 Replies

6. Shell Programming and Scripting

Perl script to Convert XLSX or XLS files to CSV file

Hi All, I've got in a situation where I need to convert .xlsx or .xls formatted files into simple text file or .csv file. I've found many options but doing this using PERL script is the best way I believe.I'm in AIX box. Perl code should have 2 params while running. i.e perl... (1 Reply)
Discussion started by: manab86
1 Replies

7. Shell Programming and Scripting

Create pdf of a jpg image in shell script

Dear Team, Can any one please let me know, if there is any way to create pdf of a Jpg image file in shell script. I work on Solaris, Korn Shell. Currently we are using sunpcl2pdf.exe to create PDF from PCL(Printer Control Language) files. But we are searching for some different way to... (2 Replies)
Discussion started by: Uttam Maji
2 Replies

8. Shell Programming and Scripting

Shell script for field wise record count for different Files .csv files

Hi, Very good wishes to all! Please help to provide the shell script for generating the record counts in filed wise from the .csv file My question: Source file: Field1 Field2 Field3 abc 12f sLm 1234 hjd 12d Hyd 34 Chn My target file should generate the .csv file with the... (14 Replies)
Discussion started by: Kirands
14 Replies
UNOCONV(1)																UNOCONV(1)

NAME
unoconv - convert any document from and to any LibreOffice supported format SYNOPSIS
unoconv [options] file [file2 ..] unoconv --listener [--server SRV] [--port PRT] [--connection CON] DESCRIPTION
unoconv is a command line utility that can convert any file format that LibreOffice can import, to any file format that LibreOffice is capable of exporting. unoconv uses the LibreOffice's UNO bindings for non-interactive conversion of documents and therefore needs an LibreOffice instance to communicate with. Therefore if it cannot find one, it will start its own instance for temporary usage. If desired, one can start a "listener" instance to use for subsequent connections or even for remote connections. OPTIONS
-c, --connection UNO connection string to be used by the client to connect to an LibreOffice instance, or used by the listener to make LibreOffice listen. Default connection string is "socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" -d, --doctype Specify the LibreOffice document type of the backend format. Possible document types are: document, graphics, presentation, spreadsheet. Default document type is 'document'. -e, --export Set specific export filter options (related to the used LibreOffice filter). eg. for the PDF output filter one can specify: -e PageRange=1-2 See the *EXPORT FILTERS* section. -f, --format Specify the output format for the document. You can get a list of possible output formats per document type by using the --show option. Default document type is 'pdf'. -i, --import Set specific import filters options (related to the used LibreOffice import filter based on the input filename). See the *IMPORT FILTERS* section. -l, --listener Start unoconv as listener for unoconv clients to connect to. -n, --no-launch By default if no listener is running, unoconv will launch its own (temporary) listener to make sure the conversion works. This option will abort the conversion if no listener is found, rather than starting our own listener. -o, --output If the argument is a directory, put the converted documents in this directory. If multiple input files are provided, use it as a basename (and add output extension). Otherwise use it as the output filename. --pipe Use a pipe as an alternative connection mechanism to talk to LibreOffice. -p, --port Port to listen on (as listener) or to connect to (as client). Default port is '2002'. -s, --server Server (address) to listen on (as listener) or to connect to (as client). Default server is 'localhost'. --show List the possible output formats to be used with -f. --stdout Print converted output file to stdout. -t, --template Specify the template to use for importing styles from. This can be very useful if you have a corporate identity you have to apply to every document you distribute. -T, --timeout When unoconv starts its own listener, try to connect to it for an amount of seconds before giving up. Increasing this may help when you receive random errors caused by the listener not being ready to accept conversion jobs. -v, --verbose Be more and more and more verbose. ARGUMENTS
You can provide one or more files as arguments to convert each of them to the specified output format. IMPORT FILTERS
Depending on the used input file, a different LibreOffice import filter is automatically used by unoconv. This import filter can be influenced by the -i option that, depending on the filter used, accepts different arguments. It is not always clear what import filter options you can provide, the import dialog in LibreOffice for the filter you ar using might give a good indication as to what you can expect as import filter options. The reference is LibreOffice's documentation, for spreadsheets it is described at: http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options but we will look into some examples. DEFAULT IMPORT FILTER OPTIONS
The default import filter for many imports (eg. Lotus, dBase or DIF) accepts as the only argument the input encoding-type, so if you require utf-8 you can do: -i utf-8 For a list of possible encoding types, you can use the above link to find the possible options. CSV IMPORT FILTER OPTIONS
The CSV import filter accepts various arguments, the order is: separator(s),text-delimiter,encoding,first-row,column-format For example you might want to use this for a real comma-separated document: -i 44,34,utf-8,2,1/5/2/1/3/1/4/1 which will use a comma (44) as the field separator, a double quote (34) as the text delimiter, UTF-8 for the input encoding, start from the second row and use the specified formats for each column (1 means standard, 5 means YY/MM/DD date) If you like to use more than one separator (say a space or a tab) and use the system's encoding, but with no text-delimiter, you can do: -i 9/32,,system,2 EXPORT FILTERS
In contrast to import filters, export filters can have multiple named options, although it is not always clear what options are available. It all depends on the version of LibreOffice. The export dialog you get in LibreOffice might give you a clue about what is possible, each of those widgets represents an option. PDF EXPORT FILTER OPTIONS
The PDF export filter is likely the most advanced export filter in its kind with a myriad of options one can use. The export filter options are described in a separate document, or on LibreOffice's wiki at: http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export For example one can specify: -e PageRange=1-2 EXAMPLES
You can use unoconv in standalone mode, this means that in absence of an LibreOffice listener, it will starts its own: unoconv -f pdf some-document.odt One can use unoconv as a listener (by default localhost:2002) to let other unoconv instances connect to it: unoconv --listener & unoconv -f pdf some-document.odt unoconv -f doc other-document.odt unoconv -f jpg some-image.png unoconv -f xsl some-spreadsheet.csv kill -15 %- This also works on a remote host: unoconv --listener --server 1.2.3.4 --port 4567 and then connect another system to convert documents: unoconv --server 1.2.3.4 --port 4567 ENVIRONMENT VARIABLES
UNO_PATH specifies what LibreOffice pyuno installation unoconv needs to use eg. /opt/libreoffice3.4/basis-link/program EXIT STATUS
Normally, the exit status is 0 if the conversion ran successful. If an error has occured, the return code is most likely an error returned by LibreOffice (or its interface, called UNO) however, the error never translates to something meaningful. In case you like to decipher the LibreOffice errCode, look at: http://cgit.freedesktop.org/libreoffice/core/tree/tools/inc/tools/errcode.hxx http://cgit.freedesktop.org/libreoffice/core/tree/svtools/inc/svtools/sfxecode.hxx http://cgit.freedesktop.org/libreoffice/core/tree/svtools/inc/svtools/soerr.hxx Using the above lists, the error code 2074 means: Class: 1 (ERRCODE_CLASS_ABORT) Code: 26 (ERRCODE_IO_INVALIDPARAMETER or SVSTREAM_INVALID_PARAMETER) And the error code 3088 means: Class: 3 (ERRCODE_CLASS_NOTEXISTS) Code: 16 (ERRCODE_IO_CANTWRITE) SEE ALSO
convert(1), file(1), odt2txt BUGS
unoconv uses the UNO bindings to connect to LibreOffice, in absence of a usable socket, it will start its own LibreOffice instance with the correct parameters. Note Please see the TODO file for known bugs and future plans. REFERENCES
unoconv is very useful together with the following tools: Asciidoc http://www.methods.co.nz/asciidoc/ asciidoc-odf http://github.com/dagwieers/asciidoc-odf docbook2odf http://open.comsultia.com/docbook2odf/ A list of possible import and export formats is available from: OpenOffice 2.1 http://wiki.services.openoffice.org/wiki/Framework/Article/Filter/FilterList_OOo_2_1 OpenOffice 3.0 http://wiki.services.openoffice.org/wiki/Framework/Article/Filter/FilterList_OOo_3_0 AUTHOR
Written by Dag Wieers, <dag@wieers.com[1]> RESOURCES
Main web site: http://dag.wieers.com/home-made/unoconv/ COPYING
Copyright (C) 2007 Dag Wieers. Free use of this software is granted under the terms of the GNU General Public License (GPL). AUTHOR
Dag Wieers <dag@wieers.com> Author. NOTES
1. dag@wieers.com mailto:dag@wieers.com 0.4 20 october 2010 UNOCONV(1)
All times are GMT -4. The time now is 05:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy