Opening a pdf file stream using java
I am developing a web app using jsp that needs to dynamically create xml files, then using fop I convert those files into pdf's.
I would need to be able to open multiple pdf files in a row...
Here's what I have so far....this will only open the 1st file...
I don't need to open the pdf files in a web browser, it can be done in acrobat reader if needs be...
do
if ( ( ( startRec * cache) + 1 ) <= ( min( ( startRec + 1 ) * cache, recCount ) ) )
System.out.println( ( startRec * cache ) + 1 + "-" + min( ( startRec + 1 ) * cache, recCount ) );
String xmlString = xmlStart;
for ( int n=( startRec * cache ); n<min( ( startRec + 1 ) * cache, recCount ); n++ )
ViewFileDetailsBean viewBean = (ViewFileDetailsBean)listOfViewFileDetailsBean.get(n);
xmlString = xmlString + viewBean.getxMLString();
xmlString = xmlString + "/t</data>\n"; // THIS FINISHES THE XML
pdfBean.makePDF( xmlString );
response.setContentLength( pdfBean.getOutput().length );
response.setContentType( "application/pdf" );
response.getOutputStream().write( pdfBean.getOutput() );
response.getOutputStream().flush();
startRec++;
}while ( startRec <= ( recCount / cache ) );
Thanks,
GoldenEye4ever
I forgot to say,
We will not have write access to the server, also, the higher-ups would like to view pdf files.. rather than extracting a zip file containing pdf files...lol
Basically, the xml file that I was initally creating was getting far too large for java to handle, 190,000 records +,
so i am breaking them down to perhaps 10,000 record long xml files, to be converted to pdf
Thanks for your fast reply
GoldenEye4ever
Similar Messages
-
Opening a pdf file without using ABAP
Hi All,
Can I open a pdf file in the ITS without using ABAP
coding. I mean by using Java Script in an another
dialog/page can i open a pdf file. If anyone has got
any idea or sample code please let me know.
Thanks,
AmitabhHi,
Where exactly you want to open the file?
The most simple way would be to upload the file under MIMES and provide the URL in the corresponding ITS service.
BR,
Disha.
Pls reward points for helpful answers. -
HELP! opening a pdf file and using page view
Hi everyone!
I'm doing a school project in which I'm trying to develop an app that opens a pdf file from the device memory (ipad or iphone) and lets the user turn pages forward and backward by swiping on the screen. Although I have very basic knowledge of C++ and Objective C programming, I find myself completely lost and don't know how nor where to start. I'd be pleased if you could help me or at least give me a starting point to develop my app.
Thank you
Alberthttps://developer.apple.com/library/ios/#samplecode/ZoomingPDFViewer/Introductio n/Intro.html#//apple_ref/doc/uid/DTS40010281
-
How to print pdf file by using java print API ? I am trying with this code
import java.io.FileInputStream;
import java.io.InputStream;
import javax.print.Doc;
import javax.print.DocFlavor;
import javax.print.DocPrintJob;
import javax.print.PrintException;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.SimpleDoc;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.standard.Copies;
import javax.print.attribute.standard.MediaSizeName;
public class PDFPrint {
static public void print(InputStream inputStream, PrintService printService) throws PrintException {
Doc doc = new SimpleDoc(inputStream, DocFlavor.INPUT_STREAM.AUTOSENSE, null);
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
attributes.add(MediaSizeName.ISO_A4);
attributes.add(new Copies(1));
print(doc, attributes, printService);
}//print()
static public void print(Doc doc, PrintRequestAttributeSet attributes, PrintService printService) throws PrintException {
if (printService == null) {
printService = PrintServiceLookup.lookupDefaultPrintService();
System.out.println("The Printer Name is :"+printService.getName());
DocPrintJob docPrintJob = printService.createPrintJob();
System.out.println("Before Print Start()");
docPrintJob.print(doc, attributes);
}//print()
public static void main(String args[])
PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService();
String file="c:/BackUp/file.pdf";
FileInputStream fis=new FileInputStream(file);
System.out.println("Before Print() called ..");
print(fis,defaultPrintService);
System.out.println("After Printing....");
I am using this code to print pdf file. But when I try this one automatically the printer starting with print ascii codes with infinite loop.
I am using jdk1.4,Acrobat 8.0, Windows environment.
Can u help me in this regard'
Thank u
graniimport java.io.FileInputStream;
import java.io.InputStream;
import javax.print.Doc;
import javax.print.DocFlavor;
import javax.print.DocPrintJob;
import javax.print.PrintException;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.SimpleDoc;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.standard.Copies;
import javax.print.attribute.standard.MediaSizeName;
public class PDFPrint {
static public void print(InputStream inputStream, PrintService printService) throws PrintException {
Doc doc = new SimpleDoc(inputStream, DocFlavor.INPUT_STREAM.AUTOSENSE, null);
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
attributes.add(MediaSizeName.ISO_A4);
attributes.add(new Copies(1));
print(doc, attributes, printService);
}//print()
static public void print(Doc doc, PrintRequestAttributeSet attributes, PrintService printService) throws PrintException {
if (printService == null) {
printService = PrintServiceLookup.lookupDefaultPrintService();
System.out.println("The Printer Name is :"+printService.getName());
DocPrintJob docPrintJob = printService.createPrintJob();
System.out.println("Before Print Start()");
docPrintJob.print(doc, attributes);
}//print()
public static void main(String args[])
PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService();
String file="c:/BackUp/file.pdf";
FileInputStream fis=new FileInputStream(file);
System.out.println("Before Print() called ..");
print(fis,defaultPrintService);
System.out.println("After Printing....");
I am using this code to print pdf file. But when I try this one automatically the printer starting with print ascii codes with infinite loop.
I am using jdk1.4,Acrobat 8.0, Windows environment.
Can u help me in this regard'
Thank u
grani -
How to create pdf files dynamically using Java
I am new to java world. I got a task of generating dynamic pdf files using Java. I have tried with some third party APIs for generating pdf. But most of them are not so feasable. I am looking for source code for one such APIs so that I can build my custom requirements over it.
ThanksI am new to java world. I got a task of generating
dynamic pdf files using Java. I have tried with some
third party APIs for generating pdf. But most of
them are not so feasable. Which ones? What was wrong with them?
I am looking for source
code for one such APIs so that I can build my custom
requirements over it.What are your exact requirement? -
Open *.PDF file by using ABAP program
Hi,
Can anyone please tell me about " how to open a PDF file by using an ABAP program".
Regards,
PrasanthWelcome to SDN.
Refer this class - CL_GUI_PDF_VIEWER
You may refer this thread also -
Re: Open Jpg, Excel, word, pdf files from SAP screen.
Regards,
Amit -
How to allow only the specified users/groups to open my pdf files...
Hi there,
I'm looking for resources/documents describing how to allow only the specified users/groups to open my pdf files by the Java API...
I've found a sample code creating a policy in the following document.
http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/wwhelp/wwhimpl/js/html/w whelp.htm?context=sdkHelp&topic=learn_lc_sdk_invokeremoting
( API Quick Starts (Code Examples) > Rights Management Service API Quick Starts > Quick Start: Creating a new policy using the Java API )
But the sample code doesn't set recepients( users/groups ) who can open the pdf file.
How can I make it ?
Any samples ? or Does anybody can tell me which Java classes/methods I should use ??
Policy#addPolicyEntry(PolicyEntry policyEntry) ??
PolicyEntry#setPrincipal(Principal principal) ??
or none of them ?
Any hints are appreciated !
Thanks.I'm not exactly sure what you are tying to do here, but typical approach when issuing one PDF par user/groups scenario goes like:
1. Create policy for specific purpose and add principal (user/group)
2. Apply policy on server side
3. Deliver the file (via email etc...)
If you are looking for sample codes, try quick start.
http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/wwhelp/wwhimpl/js/html/w whelp.htm?&accessible=true
If you go "API Quick Start/Rights Management Service API Quick Starts", you might find something useful. I think you need "Creating Policies" or "Modifying Policies" for step 1 above, and "Applying Policies to PDF Documents" for step 2.
Hope this helps. -
I can not open my PDF files sent using my Adobe Reader. I keep gettting prompts to buy Adobe XI and that my free trial period is up.
What is your operating system? What is your Reader version? What means "can not"?
Can you post a screenshot of such a message "to buy Adobe XI"? -
Open a PDF file in linux using java
Hi..
How can I open a PDF file in linux using java.
I am able to open PDF in windows and mac using this code
in Windows
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + path_of_PDF);
in mac
Runtime.getRuntime().exec("open " + path_of_PDF);
But nothing is working with linux.
Please help
ThanksOne thread is enough:
http://forum.java.sun.com/thread.jspa?threadID=5267458 -
How to open a PDF file using NWDS or VC
Hi Frndz...
As per my requirment i need to open a PDF file on browser which PDFs are reside on R/3 and in my case EP server is on UNIX usinig either NWDS or VC ....
Thanks in Advance
Regards
Rajesh
09903726944hi,
can you put your question much more clearly? I couldnt get you properly.
Check out the following links, they may be useful
[How to Create a pdf form Using Web Dynpro - Java;
[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/805709cb-ec97-2910-04b8-f3d6303d8d3b]
[Diff - PDF view inside NWDS livecycle designer and when App. is run;
[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/90e8e837-cc15-2a10-8db1-a87e2d29e9c9]
Regards,
Murthy. -
Opening jpg/pdf files from Java
Hi,
How can I open jpg/pdf files or any file in general from Java, such that they open up in the default program in Windows?
I dont want to read in the files using Java. Just open them in their default program. Eg. PDF should open in Adobe.
thanks,
parsifalThanks both of you for answering.
You don't need to make a map. You need the "cmd /c
start" command in Windows.This is what I was missing. I looked up DOS commands to open a files in window but couldnt get it. So I thought java would have some command that equals double-clicking icons on window.
Thanks.
best,
parsifal -
Why do I keep getting a pop-up window that says install Java when I try to open a pdf file?
Why do I keep getting a pop-up window that says install Java when I try to open a pdf file?
(You can take screenshots of the windows in your computer using Alt+PrintScreen... No need to use a camera)
This is quite odd. Where did you get the Reader installer from? I would suggest uninstalling it and then downloading the installer from Adobe (here: http://get.adobe.com/reader/ ) and re-installing it. -
multiple blank firefox pages open one after the other, can't stop them. only solution is to use "force quit" I am on an iMac. Never had this until today. Has happened now 3 times! its scary/
== This happened ==
Just once or twice
== I clicked to open a pdf file on a web page (i've done this many times before on this web page with no problem) ==
== User Agent ==
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7See [[Firefox keeps opening many tabs or windows]]
You can have infinite tabs opening if you have selected Firefox as the application to handle a file if you get an ''Open with'' download window.
Firefox should not be selected as the application to handle a file and you have to remove the action that is associated with that file type.
You can delete [http://kb.mozillazine.org/mimeTypes.rdf mimeTypes.rdf] in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Profile Folder] to reset all actions or set that action in Tools > Options > Applications to 'Always Ask'.
See http://kb.mozillazine.org/File_types_and_download_actions ("File handling in Firefox 3 and SeaMonkey 2" and "Reset Download Actions") -
I am unable to use adobe reader xi. I have tried to use the clean up tool and re install the reader. That doesn't seem to help. I go to open the pdf file in the reader and the window will load but I am not able to do anything past that point. Almost as if the program freezes once loaded I never get a not responding error until I open the task manager on the computer.
Can you open Reader by itself? If so, try disabling Protected Mode [Edit | Preferences | Security (Enhanced)].
-
When I try to open a PDF file I get this message:
"The Adobe Acrobat ?Reader that is running can not be used to view PDF files in a web browser. Adobe Acrobat/Reader version 8 or 9 is required. Please exit and try again.
I have downloaded the Adobe Reader 9.2..... but I still get this message????
Why do I keep getting this message?
Thanks for your help..
CindyUninstall Reader. Use the Microsoft Installer Cleanup Tool. They try re-installing Reader 9.2
Maybe you are looking for
-
When I try to send a Safari web page via Mail, Mail locks up!
No matter how I try to Email a Safari web page (using the share arrow icon or the mail icon or the File menu), Mail locks up. Then I have to Force Quit Mail and send the report to Apple. There must be a bug somewhere, but I can't figure out where!
-
Export progress bar shows, but no SWF appears
Hello all, i've been through tech support and about 100 different sites with this issue but nothing seems to help. I'm using windows Vista 64 bit (work machine, not personal) with Adobe CS5 production premium. I have this training I created in flash
-
Where Is My Bookmarks Library on Firefox 29.0.1?
How do I get to my Bookmarks Library in Firefox 29.0.1? When I click on the Bookmark Icon at the top, all I see is "View Bookmarks Sidebar," then below that, "Bookmarks Toolbar," "Unsorted Bookmarks," "Recent Tags," and "Recently Bookmarked." I don't
-
Error updating Dispute case: FDM_PROCESS_BUFFER Internal error: ENQUEUE
Whenever we clear a Disputed Invoice with an incoming payment, we receive this error message if the Dispute is unresolved: - An error occurred during the update of case xxxxx Update Case with Program FDM_PROCESS_BUFFER You can start the program by ru
-
Central monitoring of profile parametes of managed systems
Hi, is there a standard functionality in Solution Manager to monitor the profile parameters of the managed systems? In other words, can Solution Manager read profile parameters of its clients through the agent and store them in own database? It could