I download itext for convert jsp to PDF. How to set content type for PDF.
I download itext for convert jsp to PDF. How to set content type for PDF. I try
<%@ page contentType = "application/pdf;charset=TIS-620" %>
, but the page does not PDF.
Thank.
PDF files are usually binary files, JSPs are not well-suited for binary content.
(If you download the result of your JSP you'll see that it is not a valid PDF file; it will have probably a lot of whitespace and linefeeds, that will choke your PDF reader.). The first few characters must be
"%PDF-" without whitespace.
You can try using PDF files encoded as text - check if you can use text-encoded PDFs in iText.
Try using a Servlet instead.
Similar Messages
-
How to set content-type for outbound mail in BCS
Hey everybody,
can anybody please give me a hint how to set the content-type for outbound email in ABAP using BCS to send mail.
By default the content tyoe is set to text/html. I need other.
Best regards
Roman//add related mutip-part to combine parts
MimeMultipart multipart = new MimeMultipart("related");
//attach a pdf
messageBodyPart = new MimeBodyPart();
fds = new FileDataSource("h:/something.pdf");
messageBodyPart.setDataHandler(new DataHandler(fds));
messageBodyPart.setFileName(fds.getName());
multipart.addBodyPart(messageBodyPart);
//add multipart to the message
message.setContent(multipart);
//send message
Transport.send(message); -
How to set content type for a JSF page
Hi,
I want to know is there any way we can specify the content type of a JSF page, like in JSPs we have the page attribute <%@ page contentType="application/vnd.ms-excel" %>
In JSP we can create a html table with values and if we specify the contenType as application/vnd.ms-excel, we would get an excel file generated.
But do we have something similar to this is JSF, as I am using Facelets I cannot use page directive in the xhtml file.
I tried setting the content type in MangedBean's action as follows
((HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse()).setContentType("application/vnd.ms-excel"); but it did'nt work.
Thanks in advance.//add related mutip-part to combine parts
MimeMultipart multipart = new MimeMultipart("related");
//attach a pdf
messageBodyPart = new MimeBodyPart();
fds = new FileDataSource("h:/something.pdf");
messageBodyPart.setDataHandler(new DataHandler(fds));
messageBodyPart.setFileName(fds.getName());
multipart.addBodyPart(messageBodyPart);
//add multipart to the message
message.setContent(multipart);
//send message
Transport.send(message); -
How to set content type for the attachment?
Hello Everybody,
I was trying to do the following in my send mail program:-
1. I am making a file using FileWriter:
FileWriter fw = new FileWriter(f);
fw.write(str);
2. I now want to attach this file with my mail. but before that I want to set the Content type of this as "application/smil". and trying the following code:
mimebodyparts[0].setContent(fds[0],"application/smil");
As this is a new MIME type perhaps I need to change the mailcap file. I found the same in the activation jar package but thought instead of chagning the default file i tried putting following code in my program:
File capfile = new File("simple.mailcap");
if (!capfile.isFile())
System.out.println("Cannot locate the \"simple.mailcap\" file.");
System.exit(1);
CommandMap.setDefaultCommandMap( new MailcapCommandMap(new FileInputStream(capfile)));
and in simple.mailcap file put the following value
application/smil;; x-java-content-handler=com.sun.mail.handlers.application_smil but I am still getting the following error:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/smil
Can somebody Please help to sort this out.
regards,
Arun//add related mutip-part to combine parts
MimeMultipart multipart = new MimeMultipart("related");
//attach a pdf
messageBodyPart = new MimeBodyPart();
fds = new FileDataSource("h:/something.pdf");
messageBodyPart.setDataHandler(new DataHandler(fds));
messageBodyPart.setFileName(fds.getName());
multipart.addBodyPart(messageBodyPart);
//add multipart to the message
message.setContent(multipart);
//send message
Transport.send(message); -
How to set security type for lenovo working with hotspot?
How to set wireless security type for lenovo laptop working with hotspot?
Since I can connect with the other laptops except this brand.//add related mutip-part to combine parts
MimeMultipart multipart = new MimeMultipart("related");
//attach a pdf
messageBodyPart = new MimeBodyPart();
fds = new FileDataSource("h:/something.pdf");
messageBodyPart.setDataHandler(new DataHandler(fds));
messageBodyPart.setFileName(fds.getName());
multipart.addBodyPart(messageBodyPart);
//add multipart to the message
message.setContent(multipart);
//send message
Transport.send(message); -
How to set activity type for a cost center
i was practicing the split valuation topic and for the that i was making a routing for a product so that i can have that product for inhouse production.
while using ca01(to create routing), i am facing a problem with the activity type.
when i am setting up the operation i am getting an error " activity type # is not set up for cost center 10004220 in year 2007"
can you please tell me how should i come out of it.
thankyou very muchhi Nandha, i am sorry but i could not do it. i am new in this. let me make my problem more clear to you.
i was creating a routing using ca01
after puttig all the details i switched to operations tab and in operation tab i put workcenter as (1111 - lathe, may be i am wrong as i told you i am just practicing).
i did not put anything on that screen and then when i pressed enter it took me to another screen with name Operation check.
here is the layout of the problem on that screen
std val unit activity type efficiency
set up min 1422
machine min 1421
labor min 1420
and then curser being on the std value i am getting this error "activity type 1422 is not set up for cost center 1000 4220 in the year 2007.when i am ignoring it it is switching to next std val coloumn and the same error.
thankyou for your time -
How to set MIME type for JNLP in Windows2000 IIS
Hi!
I try to set up my windows 2000 IIS's MIME type for JNLP to test java web start, but I have no idea how to set
the MIME type. Can anybody help me???
Best wishesIn IIS v4 which comes with the Windows NT4 option pack, you right click the web page you are working with, select properties, then go to the HTTP Headers tab. At the bottom there's a button labelled File Types in the MIME Map section.
After you've clicked that, you can add the two mime types you need;
Associated Extension MIME Type
.jar application/x-java-jar-file
.jnlp application/x-java-jnlp-file
I'm assuming that it is the same in W2k/IIS5. -
Hi guys
I want my jsp output in pdf format. I have written following lines at the start of jsp:
response.setContentType("application/pdf");
response.setHeader("content-disposition","attachment;");
But acrobat reader is giving following error:
"Acrobat could not open the file because it is either not a supoorted file type or because the file has been corrupted.(for example it was sent as an email attachment and wont correctly decoded)"
Please advise if anybody knows this issue.
Regards,
SMA common problem with writing PDF's back to the browser is some browsers need to know the size of the PDF file before you start to send it. The following code over comes that problem and is known to work.
response.reset();
response.setContentType("application/pdf");
response.setHeader("Expires", "0");
response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
response.setHeader("Pragma", "public");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
FileInputStream from = new FileInputStream("mypdf.pdf");
byte[] buffer = new byte[4096];
int bytes_read;
while((bytes_read = from.read(buffer)) != -1)
baos.write(buffer, 0, bytes_read);
response.setContentLength( baos.size());
baos.writeTo(response.getOutputStream());
response.getOutputStream().flush();
from.close();
baos.close();
Hope that helps -
How to set Mime Type for Static Files
Hi All,
I am working on Apex 3.2.1.00.10.
When I am trying to upload (create) a ".js" file into Static Files under Shared Components of an application; it is saving as "*text/plain*" for Mime Type. But I need Mime type to be set as "*application/x-javascript*".
Please help me to change the Mime type of .js file.
Or is there any way to upload the file directly as "*application/x-javascript*" as its Mime Type.
Thanks in advance.
UmeshIn IIS v4 which comes with the Windows NT4 option pack, you right click the web page you are working with, select properties, then go to the HTTP Headers tab. At the bottom there's a button labelled File Types in the MIME Map section.
After you've clicked that, you can add the two mime types you need;
Associated Extension MIME Type
.jar application/x-java-jar-file
.jnlp application/x-java-jnlp-file
I'm assuming that it is the same in W2k/IIS5. -
How to set cursor type for TextField uses
Hello, hope someone can help. I'm importing HTML into a
TextField called "webText_htm". I'm also calling CSS and it is
working to style the text. Player 8 and ActionScript 2
When I mouseover the TextField, the cursor changes to the
I-bar.
Second problem is that <a href=""> is not signalling
the Hand Cursor, and does not do anything when I click on it.
Thanks in advance
Gregshrinktight,
> Hello, so this is sort of a dumb question; I've become
> acquainted with the help docs. Is that the best place
> to look up properties for a class?
I think so, mainly because it's so easily within reach. I
tend to fire
up the ActionScript 2.0 and/or Component Language Reference
and start there.
If I can't find what I need, I hit the LiveDocs version
http://livedocs.macromedia.com/),
which has developer notes. If I'm still
stuck, I head to the forums.
> Is thre a reference somewhere that I can study which
> explans each property? Where can I find that stuff?
For 99% percent of it (informal estimate, of course), just
hit the F1
key and search. Every object in ActionScript is defined by
its namesake
class. Again, properties describe the object's
characteristics, methods
describe things the object can do, and events describe things
the object can
react to.
This may help get you started.
http://www.communitymx.com/abstract.cfm?cid=01B54
David
stiller (at) quip (dot) net
Dev essays:
http://www.quip.net/blog/
"Luck is the residue of good design." -
Hi,
I am creating a new output for print PO in NACE. Now I am getting the problem of setting the access key combination. Now I Even want to get that new cretead output type in me23n messaages.
regards
AashishHI,
I think you need not to create OUTPUT type. But you want to assign print program and SAPscript/Smartform to the existing output type.
You can set the output type, print program and SAPscript/Smartform in the table TNAPR.
YOu can do it either from SM30 or from SE16 as Table maintenance is allowed for this Table.
Sample entries are like below:
MANDT 030
KSCHL NEU
NACHA 1
KAPPL EA
PGNAM SAPFM06P
RONAM ENTRY_NEU
FONAM Z_MEDRUCK
PGNAM2
RONAM2
FONAM2
PGNAM3
RONAM3
FONAM3
PGNAM4
RONAM4
FONAM4
PGNAM5
RONAM5
FONAM5
FUNCNAME
SFORM
Message was edited by: Ramakrishna Prasad -
How to set encoding type for e4x result
I have a application with front end Flex and Server side App
in Java. I am using HttpService to communicate to Java application
(Web). I am sending data in xml format to flex and parsing it as
e4x format. From service side I am setting the charset as
windows-1252 and xml encoding is also windows-1252. In Flex I am
getting some junk characters. But When I post the same http request
from browser, I am able to view the characters with expected
encoding.
Can anybody clue me on getting xml data in required encoding
type (charset) in Flex.
Thanks in Advance,
Gokul Ram.TThe message is old, but the problem is opened and I believe that many people have troubles with getting appropriate encoding in e4x result.
I have excactly same problem like Gokul, only difference is that I am trying to get ISO-8859-2 charset. HttpService deffinition looks like this:
var source:HTTPService = new HTTPService();
source.method = "POST";
source.resultFormat = "e4x";
source.contentType = "text/xml; charset=ISO-8859-2";
source.headers = {"Content-Type": "text/xml; charset=ISO-8859-2"};
So I suppose that everything what can be set is set. But still in result XMLthere are no national chars. I also get correct XML when I request it in browser, but requesting by Flex and HttpService makes problem.
Does anyone have same problem and find out something to handle this? -
How to set mime types for applet in iAS sp3?
Hi,
Please refer to Adding Mime types and let me know if that address to solve your problem.
Regards
Ganesh .R
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers/support -
How to control save as option in a jsp whose content type is PDF
Hi
I have one jsp in which i am showing PDF, it means it content type is PDF. I want to control save as option in it,
i.e when a user tries to save it the default name which is coming it is name of the jsp, but i want default name is dynamic which depends upon user.
I used response.setHeader(content-deposition,inline;filename=abcd.pdf) , but it doesnt work. if i use
response.setHeader(content-deposition,attachment;filename=abcd.pdf) then it is working but it straight away giving option as "U want to open or want to save it". I dont want this i want first PDF to be shown in jsp then if some one wants to save he will click on save button in PDF and there and want this option.
Kindly help meDon't use JSP to serve a binary file. It almost implies the use of awful scriptlets and the invocation of both the response writer and the response outputstream which would only lead to IllegalStateException headaches in the server logs.
Use a Servlet instead. Specify the file name as request parameter and let the servlet read the file and write it to the outputstream of the response. -
IOException: invalid content type for SOAP: TEXT/HTML
Hi all,
After the IS received a SOAP request successfully and sent it to the Adapter Engine I get an IOException in my SOAP Adapter (I configured a SOAP communication channel). From my RWB I can see:
2005-08-12 10:53:17 Success SOAP: request message entering the adapter
2005-08-12 10:53:17 Success SOAP: completed the processing
2005-08-12 10:53:18 Success The message was successfully received by the messaging system. Profile: XI URL: http://ecsap:50000/MessagingSystem/receive/AFW/XI
2005-08-12 10:53:18 Success Using connection AFW. Trying to put the message into the receive queue.
2005-08-12 10:53:18 Success Message successfully put into the queue.
2005-08-12 10:53:18 Success The message was successfully retrieved from the receive queue.
2005-08-12 10:53:18 Success The message status set to DLNG.
2005-08-12 10:53:18 Success Delivering to channel: J2E_ReceiverChannel_SOAP
2005-08-12 10:53:18 Success SOAP: request message entering the adapter
2005-08-12 10:53:18 Error SOAP: error occured: java.io.IOException: invalid content type for SOAP: TEXT/HTML
2005-08-12 10:53:18 Error Exception caught by adapter framework: invalid content type for SOAP: TEXT/HTML
2005-08-12 10:53:18 Error Delivery of the message to the application using connection AFW failed, due to: invalid content type for SOAP: TEXT/HTML.
2005-08-12 10:53:18 Success The asynchronous message was successfully scheduled to be delivered at Fri Aug 12 10:58:18 CEST 2005.
2005-08-12 10:53:18 Success The message status set to WAIT.
Please help if possible! Thanks!
Denishi guys
this is my soap Reciever CC is showing the Error .
please suggest me the solution.
2007-12-21 10:09:27 Error SOAP: call failed: java.io.IOException: invalid content type for SOAP: TEXT/HTML
2007-12-21 10:09:27 Error SOAP: error occured: com.sap.aii.af.ra.ms.api.RecoverableException: invalid content type for SOAP: TEXT/HTML: java.io.IOException: invalid content type for SOAP: TEXT/HTML
2007-12-21 10:09:27 Error MP: exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: invalid content type for SOAP: TEXT/HTML: java.io.IOException: invalid content type for SOAP: TEXT/HTML
2007-12-21 10:09:27 Error Exception caught by adapter framework: invalid content type for SOAP: TEXT/HTML
2007-12-21 10:09:27 Error Delivery of the message to the application using connection SOAP_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: invalid content type for SOAP: TEXT/HTML: java.io.IOException: invalid content type for SOAP: TEXT/HTML. Setting message to status failed.
2007-12-21 10:09:27 Error The message status set to FAIL.
2007-12-21 10:09:27 Error Returning synchronous error message to calling application: com.sap.aii.af.ra.ms.api.RecoverableException: invalid content type for SOAP: TEXT/HTML: java.io.IOException: invalid content type for SOAP: TEXT/HTML.
thanks & Regards
Ravi
Maybe you are looking for
-
How can I get the third page to show?
I have a track with 3 regions and the last one won't show up in the score editor even though all 3 regions are selected. I believe I must leave the 3 regions unmerged because of some triplets that are misrepresented if I merge them with the rest whic
-
Passing values between methods in the same class
Hi, How to pass internal tables or values between methods in the same class. How to check if the internal method in another method is initial or not. How to see if the method has already been executed. Thanks.
-
Hello I have the following problem. I need to extract the usernames and passwords that are created in shared services (Essbase). For Authenticate me in obiee 11g, with the same user. Is there any way to extract users to authenticate created in essbas
-
Hi, i wanted to send a file to windows server in CRLF mode. sorce is UNIX and target is WINDOWS. i have done following In BPEL , created a adapter to send the file in ASCII mode FTP adapter server type property is set to windows, But still the file i
-
How to move app in sequence for saving documents
When I save a document on my ipad, I get many options for apps. Can you move the order of the apps to put dropbox in the front?