Convert pdf and output to html
I need help!
If I have a pdf file and I want to upload to iFS, should I convert it to html or test format and save to database with iFS feature? Or it's better to save as a pdf file and output as html with iFS feature.
Also, if I a some images in the pdf file, what should I do?
Thank you so much in advance.
Hong
null
Try to use filterDocumnet() and getFilteredDocument() in oracle.ifs.beans.Document. It helps to generate the PDF into HTML format.
null
Similar Messages
-
Convert PDF to Exactly Looking HTML
Hi ,
I am having Acrobat XI ..is it possible to convert a PDF to similar looking HTML having the same layout and formatting.
Thanks
KapilSimilar, probably if the layout is simple. You cannot get exactly the same, because HTML isn't an exact layout, just hints to a browser. (Indeed, if HTML could do what PDF does, PDF wouldn't have been invented!)
-
Trying to batch convert PDF/AI files. If I run the batch I either force the same action test case "open" name on the batched files, or get a bunch of open files with no action run. Workaround is to open the files in one batch, and process them (on opened files) in another. But what about droplets? Can someone confirm I haven't lost my mind?
I'm just looking to convert a bunch of PDFs to JPG keeping the same names and using an action to process the files. Can't get it to work.
Thanks - J>I'm just looking to convert a bunch of PDFs to JPG
If you're on CS4, download and install
Dr. Brown's Services
2.0.1, it's like the Image Processor on steroids, written by the same author of the more modest Image Processor, Russell Brown. The installation includes
1-2-3 Process,
Caption Maker and
Dr. Brown's Services.
http://www.russellbrown.com/tips_tech.html > scroll down about one fourth of the page. -
Printing or Converting to PDF and outputting in current folder?
Hi all,
I've got a bunch of Word docs in a bunch of different folders and I'm looking for an easy way to convert them to PDF without much intervention. I can go into my Adobe PDF printing preferences and specify each folder before I select all the Word docs and print them, but then I have to change the output folder each time. I'm looking for a way to specify it to just output the PDF to the current folder by default and not bring up a dialog box to rename the file.
Is there an easy way to do this? I have docs separated into about 50-100 different folders. I'd like to just point it to the root folder and click print or convert, but if I have to go into each folder individually, select all and print/convert then that would be more acceptable than the way we have to do it currently.
Thanks for your time!BobLevine wrote:
Won't do much good if it's a just an image saved as EPS. Of course if it's an Illy EPS that would be the best route.
Bob
Quite so, but transparency implied vector to me. -
Web Intelligence: Save Report as PDF and with embedded HTML code
Hi all.
Sorry but I'm not able to find any post about this matter, please feel free to provide links if you know existing topics about this problem.
We created a beautiful report with HTML5 code embedded into a blank cell and we are now trying to export it in a printable format (e.g.: PDF or HTML).
As you know (as per manual information) it is not possible to export a report with embedded HTML code and keeping it in the output (cell with embedded HTML code is rendered blank).
My question is: is there a known workaround or an alternative solution to export the report and keep its content?
Print screen is not a valid option :-P
Thanks for the support or any suggestions
StecasProduct limitation; vote for change on ideaplace, etc. I don't believe there is an *easy* workaround, but see:
https://scn.sap.com/thread/3149287
HTH
NMG -
after sending mail ,the attachment doesnt conatin any pdf data.
code is as follows.............
LOOP AT IT_PDF.
TRANSLATE IT_PDF USING ' ~'.
CONCATENATE GD_BUFFER IT_PDF
INTO GD_BUFFER.
ENDLOOP.
TRANSLATE GD_BUFFER USING '~ '.
DO.
I_OBJBIN = GD_BUFFER.
APPEND I_OBJBIN.
SHIFT GD_BUFFER LEFT BY 100 PLACES.
IF GD_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
LOOP AT IT_PDF.
TRANSLATE IT_PDF USING '~'.
ENDLOOP.
REFRESH:
I_RECLIST,
I_OBJTXT,
I_OBJBIN,
I_OBJPACK.
CLEAR I_OBJPACK-TRANSF_BIN.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
I_OBJPACK-BODY_START = 1.
I_OBJPACK-BODY_NUM = V_LINES_TXT.
I_OBJPACK-DOC_TYPE = 'RAW'.
APPEND I_OBJPACK.
Attachment (pdf-Attachment)
I_OBJPACK-TRANSF_BIN = 'X'.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
I_OBJPACK-BODY_START = 1.
DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
READ TABLE I_OBJBIN INDEX V_LINES_BIN.
I_OBJPACK-DOC_SIZE = V_LINES_BIN * 550 .
I_OBJPACK-BODY_NUM = V_LINES_BIN.
I_OBJPACK-DOC_TYPE = 'PDF'.
I_OBJPACK-OBJ_NAME = 'purchase order'.
I_OBJPACK-OBJ_DESCR = 'purchase order'.
APPEND I_OBJPACK.
clear WA_OBJHEAD.
CLEAR I_RECLIST.
I_RECLIST-RECEIVER = P_EMAIL.
I_RECLIST-EXPRESS = 'X'.
I_RECLIST-REC_TYPE = 'U'.
I_CC-COPY = I_CC.
APPEND I_RECLIST.
I_OBJTXT = 'Hi'.
APPEND I_OBJTXT.
I_OBJTXT = ' '.
APPEND I_OBJTXT.
I_OBJTXT = 'Please find the purchase order as an attachment'.
APPEND I_OBJTXT.
I_OBJTXT = 'from meda'.
APPEND I_OBJTXT.
I_OBJTXT = ' '.
APPEND I_OBJTXT.
I_OBJTXT = 'Thanks'.
APPEND I_OBJTXT.
I_OBJTXT = 'purcahse order'.
APPEND I_OBJTXT.
DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
READ TABLE I_OBJTXT INDEX V_LINES_TXT.
WA_DOC_CHNG-OBJ_NAME = 'purcahse order'.
WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
WA_DOC_CHNG-OBJ_DESCR = 'Mail from meda'.
WA_DOC_CHNG-SENSITIVTY = 'F'.
WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 2255.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = WA_OBJHEAD
CONTENTS_BIN = I_OBJBIN
CONTENTS_TXT = I_OBJTXT
RECEIVERS = I_RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
IF SY-SUBRC EQ 0.
WRITE : / 'email sent over' .
ENDIF.
ENDFORM. " EMAIL_DISPLAYhi check this....
*& Report ZSPOOLTOPDF *
*& Converts spool request into PDF document and emails it to *
*& recipicant. *
*& Execution *
*& This program must be run as a background job in-order for the write *
*& commands to create a Spool request rather than be displayed on *
*& screen *
REPORT zspooltopdf.
PARAMETER: p_email1 LIKE somlreci1-receiver,
p_sender LIKE somlreci1-receiver ,
p_delspl AS CHECKBOX.
*DATA DECLARATION
DATA: gd_recsize TYPE i.
Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: w_recsize TYPE i.
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.
CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV',
c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL'.
*START-OF-SELECTION.
START-OF-SELECTION.
Write statement to represent report output. Spool request is created
if write statement is executed in background. This could also be an
ALV grid which would be converted to PDF without any extra effort
WRITE 'Hello World'.
new-page.
commit work.
new-page print off.
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
Alternative way could be to submit another program and store spool
id into memory, will be stored in sy-spono.
*submit ZSPOOLTOPDF2
to sap-spool
spool parameters %_print
archive parameters %_print
without spool dynpro
and return.
Get spool id from program called above
IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
if p_delspl EQ 'X'.
PERFORM delete_spool.
endif.
IF sy-sysid = c_dev.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool',
'request to be created.'.
ENDIF.
FORM obtain_spool_id *
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM.
FORM get_job_details *
FORM get_job_details.
Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM.
FORM convert_spool_to_pdf *
FORM convert_spool_to_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
FORM process_email *
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
perform send_email using p_email2.
ENDFORM.
FORM send_email *
--> p_email *
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachname'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
'Example .xls documnet attachment'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM.
FORM delete_spool *
FORM delete_spool.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
ld_spool_nr = gd_spool_nr.
CHECK p_delspl <> c_no.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = ld_spool_nr.
ENDFORM.
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables it_message
it_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
regards,
venkat. -
Convert ls -l output to html [solved]
My ISP's webserver which I am using as a repo doesn't allow live dir listings. In other words, if a user simply browses to the site root in a browser, a message comes up telling them the pages doesn't exist.
The structure of my site is trivial:
/i686
/x86_64
I'd like a nice script that simply converts the output of an "ls -l" to html with basic click-able links for the files and simply prints the date/time stamp and file size.
Example:
file1 Jan 15 16:55 25M
file2 Jan 15 16:55 25M
file3 Jan 15 16:55 25M
I was thinking about something like:
#!/bin/bash
date >> /dev/shm/ls.html
echo "<br>" >> /dev/shm/ls.html
for i in * ; do
#echo item: $i
echo "$i" "<br>" >> /dev/shm/ls.html
done
Is there something out there that's pre-made and more visually appealing? If not, how can I store and parse the output of an ls -lh to the following format (for each item):
filename datestamp size
EDIT: From what I'm finding via google, perl is probably the right scripting language (not bash) to accomplish this task. I know 0 about perl
Last edited by graysky (2011-01-23 20:43:17)GNU stat would work just fine for this. Do not parse ls.
exec > /path/to/output.html
printf '<html>\n<head>\n<body>\n<table>\n'
for file in *; do
stat "$file" -c '<td>%A</td><td>%U</td><td>%G</td><td>%B</td><td>%y</td><td>%n</td>'
done
printf '</table>\n</body>\n</head>\n</html>\n
This should get you started.
Last edited by falconindy (2011-01-23 15:11:04) -
Downloading converted PDF file - output is truncated
Hi -
My requirement is to convert an SAP spool to a PDF file and download it to the presentation server. It is working, however, when I open the PDF file, the output is truncated such that only 132 characters of each line are being displayed (instead of the desired 255). Any ideas? Thanks.James,
The PDF the table parameter of function module CONVERT_ABAPSPOOLJOB_2_PDF have a data element TLINE which have length of 132, so you need to do something this way
data : begin of out occurs 0.
include structure solisti1.
data : end of out.
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = spoolid
no_dialog = 'X'
tables
pdf = pdf_table
exceptions
others = 0.
clear: pos,
out,
len.
loop at pdf_table.
pos = 255 - len.
if pos > 134. "length of pdf_table
pos = 134.
endif.
out+len = pdf_table(pos).
len = len + pos.
if len = 255. "length of out (contents_bin)
append out.
clear: out, len.
if pos < 134.
out = pdf_table+pos.
len = 134 - pos.
endif.
endif.
endloop.
if len > 0.
append out.
endif.
a® -
Convert Docx and doc to HTML in unix environment with CFMX7
I have a web app that allows user to upload doc or docx files and converts it to HTML. I have CFMX 7 in a unix environment. Is there a custom tag that I could use for this conversion? I tried the cfx_word2html tag .. it converts .doc not docx. Please let me know. Thanks...
I've been pleased with Aspose's Words component. I use the .NET version, but a Java version is also available. You could try using CFOBJECT plus the Words Java component to handle document conversion on your server.
http://www.aspose.com/categories/file-format-components/aspose.words-for-.net-and-java/def ault.aspx -
Hi all
I have some html files.
and I'd like to produre RTF and PDF by those HTML files.
I've seen iText tools.But actually it needs well formed HTML files.
do you have any alternative idea?I mean I could stream the html and create some different data structure and then parsing it for creating ...xsl-fo but it's hard doing by myself.
I need a quick solution.
Regards
GiovanniHi all
I have some html files.
and I'd like to produre RTF and PDF by those HTML files.
I've seen iText tools.But actually it needs well formed HTML files.
do you have any alternative idea?I mean I could stream the html and create some different data structure and then parsing it for creating ...xsl-fo but it's hard doing by myself.
I need a quick solution.
Regards
Giovanni -
Parsing DOM with XSL and output as HTML
In a servlet I am fetching data from DB into an DOM-tree (using ordinary JDBC and building the XML-DOM while fetching rows). This is done in a servlet, and before I response to the browser i use Oracle XML-parser to join my DOM-tree with an XSL-file. If I try to my DOM-tree out before parsing, it contains data. But the parsed DOM only contains XSL-tags, no data. What do I do wrong?
Here is the code:
DOMParser parser = new DOMParser();
parser.setPreserveWhitespace(true);
//No problem finding the XSL-file...
URL xslURL = createURL("employee.xsl");
parser.parse(xslURL);
xslDoc = parser.getDocument();
XSLStylesheet xsl = new XSLStylesheet(xslDoc, xslURL);
XSLProcessor processor = new XSLProcessor();
processor.showWarnings(true);
processor.setErrorStream(System.out);
//XML doc does contain data!!!
DocumentFragment result =
processor.processXSL(xsl, xmlDoc);
xmlOut = new XMLDocument();
Element root = xmlOut.createElement("root");
xmlOut.appendChild(root);
root.appendChild(result);
xmlOut.print(out); // Result is only the XSL-file.....
Regards Frank =:>Sorry, but I still can not make it work. Here are the XSL and XML-files. My XML test file (which reflects the DOM I am makings
is:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE employees SYSTEM "employee.dtd">
<?xml:stylesheet type="text/xsl" href="employee.xsl" ?>
<employees>
<employee>
<id>1</id>
<firstname>Frank</firstname>
<lastname>Nilsen</lastname>
</employee>
<employee>
<id>2</id>
<firstname>Ronald</firstname>
<lastname>Reagen</lastname>
</employee>
</employees>
XSL-file is:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<HTML>
<BODY>
<xsl:for-each select="employees/employee">
<font color="red"><xsl:value-of select="id"/></font>
<xsl:value-of select="firstname"/>
<xsl:value-of select="lastname"/>
</xsl:for-each>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
Regards,
Frank =:> -
Converting .pdf and .doc files into .txt file
Can anyone here please tell me (a humble programmer) if there's anything in Java to help me accomplish the above, i.e. to strip the markup of these files.
Or perhaps someone might know if there are programs already out there that can?
Any pointers or advice would be great, thanksPDF: iText (www.lowagie.org or .com) and FOP (at apache.org, or maybe jakarta.apache.org) are the de facto standards for writing PDF in Java, but I don't think either of them will help you with reading it. You might check out etymon. I think that reads PDF. Or you could google for java pdf reader
Doc: Check out POI, again at either jakarta or apache. -
Converting XML and XSL into HTML
Hello!
I'm designing a servlet class that merges an xml file and xsl file into html that will be sent to the client. But I don't understand how the (sparsely documented) javax.xml.transform.dom package works. An exception is generated for a missing "version" tag, when I've included one that has worked on client-side xml/xsl pages before. If it matters, I'm using Apache Tomcat/JDK 1.4.
Here's the code:package mypackage.servlet.xml;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
public class XML2HTMLServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
response.setContentType("text/html");
PrintWriter writer = response.getWriter();
try {
openFile("D:/Webdev/xml2html/data.xml", "D:/Webdev/xml2html/style.xsl", writer);
} catch (Exception e) {
e.printStackTrace(writer);
private void openFile(String xmlPath, String xslPath, PrintWriter writer)
throws IOException, ParserConfigurationException, SAXException,
TransformerConfigurationException, TransformerException {
File xmlFile = new File(xmlPath);
File xslFile = new File(xslPath);
TransformerFactory tFact = TransformerFactory.newInstance();
DocumentBuilderFactory dbFact = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dbFact.newDocumentBuilder();
Document xmlDoc = builder.parse(xmlFile);
Document xslDoc = builder.parse(xslFile);
Node xmlDocNode = (Node)xmlDoc;
Node xslDocNode = (Node)xslDoc;
DOMSource xmlSrc = new DOMSource(xmlDocNode);
DOMSource xslSrc = new DOMSource(xslDocNode);
DOMResult htmlResult = new DOMResult();
Transformer transformer = tFact.newTransformer(xslSrc); // the exception occurs here!
When it runs, it complains:
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException:
javax.xml.transform.TransformerException: stylesheet requires attribute: version at
org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:767) at
mypackage.servlet.xml.XML2HTMLServlet.openFile(XML2HTMLServlet.java:49) at
...etc...etc...
data.xml contains:
<?xml version="1.0"?>
<document type="lecture">
<title>Test Data</title>
<section>
<name>A New Section</name>
</section>
</document>
style.xsl contains:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title><xsl:value-of select="document/title"/></title>
</head>
<body>
<xsl:apply-templates select="document/section"/>
</body>
</html>
</xsl:template>
<xsl:template match="section">
<div><i>Section</i><br/><xsl:value-of select="name"/></div>
</xsl:template>
</xsl:stylesheet>I'm not sure the method calls above are what I want, so here's the client-side equivalent in Internet Explorer 5.0:
function createStyledXMLDocument(xmlUrl, xslUrl) {
var xmlDocument = new ActiveXObject("Microsoft.XMLDOM");
xmlDocument.load(xmlUrl);
var xslDocument = new ActiveXObject("Microsoft.XMLDOM");
xslDocument.load(xslUrl);
return xmlDocument.transformNode(xslDocument);
}Any help would be greatly appreciated.Hi!
I found the immediate answer with
dbFact.setNamespaceAware(true);As for parser, I'm just using the default JDK install. But I'd like to hear more on Xalan. Is it independent open source? How does Xalan compare to whatever is default in JDK?
Thanks -
How can I convert pdf file to xml or html file.
Hello
My English ability is very poor. sorry.
I want to extract text and image from pdf file.
so, I try use itext. but.. I can't make what I want .
I searched pdfbox and jpedal.
but I can't get my solution.
Just I want to convert pdf to xml or html(html prefer).
I think pdfviewer is hint.
but I can't get full source(in jpedal)
Plz help.. me.....
Does anybody solve this problem?Stay in your old thread
[http://forums.sun.com/thread.jspa?threadID=5198647]
Don't multi/crosspost or your account will be locked. -
Jasper report for pdf and html
Hi friends I am Gopi
I am doing project in servlet and jasperreport in tomcat.
I save my path jasperreport for Html and Pdf reports.
when i click the jsp button Export to pdf and Export to Html,
I need to open this files in new pdf application and new browser window .
if(pdf1.equals("html"))
JasperExportManager.exportReportToHtmlFile(jasperPrint, path +"\\" + reportName + ".html");
exporter = new JRHtmlExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
exporter.exportReport();
if(pdf1.equals("pdf"))
System.out.println("PDF");
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfFile(jasperPrint,path +"\\" + reportName + ".pdf");
exporter = new JRPdfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
exporter.exportReport();
pls help me...gopikannang wrote:
when i click the jsp button Export to pdf and Export to Html,
I need to open this files in new pdf application and new browser window . Use the target attribute of the <form> or the <a> element which opens the PDF file. Set its value to "_blank".
Learn HTML. There is a nice tutorial at w3schools.com and a good specification at w3.org.
Maybe you are looking for
-
Adding a Mail Account on the IPhone
Can any-one help? I am fed up with calling BT! I migrated onto BT Mail a few days ago and my mail account stopped working on my iphone. So I deleted the account and set up a new one with my new password but it will not accept it. I decided to try ad
-
Using Windows 7 and firefox 3.6.8 Occurs on all sites w/Firfox but not with IE.
-
IMac just won't start up!
I'm running out of ideas here, fellas. My first-generation iMac G5 won't start up. I turn it on and it only goes up to the screen with the gray Apple logo. It never gets to the point of the spinning gear. After a while, the fan makes a constant loud
-
I'm trying to find information on BI Extractors. Does anyone have any links or documents that explain what extractors there are that can be used with SAP BI 7.0. I'll be extracting data from SAP HR, so any additional information relating extractors b
-
FLVPlayback Will Not Play Local Content in IE8
Hello We have developed our own FLV movie player which uses the FLVPlayback component to play movie files. Our web page uses Javascript to pass the movie filename to the swf file as a parameter. The Flash movie player reads this parameter to play the