Sitemap

Amicuk Programming Answers

Pdf file handling

-0001-11-30   Views:0

Advertisement

Hi, I am trying to read pdf file in String, process the string and then put the string back in a new pdf file. The code I am using is as follows: Reading pdf file: String readFile() throws Exception      InputStream istr = getClass().getResourceAsStr

Hi,
I am trying to read pdf file in String, process the string and then put the string back in a new pdf file. The code I am using is as follows:
Reading pdf file:
String readFile() throws Exception
     InputStream istr = getClass().getResourceAsStream("26-1880.pdf");
     StringBuffer buff = new StringBuffer();
int someByte=0;
     for(int i=0 ; ; i++)
          try
               someByte = istr.read();
          catch(IOException ioe)
               ioe.printStackTrace();
          if(someByte == -1)
          break;
          buff.append((char)someByte);
return (buff.toString());
Writing string to pdf:
void writeFile(String file) throws Exception
     OutputStream ostr = new FileOutputStream(new File("VALoan.pdf"));
     byte[] someByte=file.getBytes();
     ostr.write(someByte);
     ostr.flush();
     ostr.close();
But the new file that I generate does not become valid pdf file.
Also right now, I am not even processing the string that I get from a pdf file. I just get and put it back.
Can anyone find out what could be the problem?
Thanks,
-Stan

The replay answer
Advertisement
Hi Vanilla,
I want to process the string that I get from the pdf.What do you mean "process"? What are you planning to do with it?
And it is NOT a String. If you want a String representation (e.g., just the text, with no layout, font, etc. info), then you'd need to interpret the BYTES first and then build a String from the results.
I can not process the bytes. So I think, I have to
convert the bytes into string.Then you need to either learn the PDF spec and write code to interpret those bytes, or you need to find a 3rd party library that does this. You can't just expect to read the bytes into a Java String and have it work.

Go to See the other 7 answers

PDF file handling through BPEL

Category:DefaultRelease time:2015-10-11Views:130

Hi, We are exploring BPEL as an option to handle PDF files generated by Oracle EBS (BI Publisher). Basically we want to achieve following: Pick up PDF files from certain location on UNIX box and then a. Spliting the PDF file into two or more files (d[More]

Pdf file handling

Category:DefaultRelease time:-0001-11-30Views:130

Hi, I am trying to read pdf file in String, process the string and then put the string back in a new pdf file. The code I am using is as follows: Reading pdf file: String readFile() throws Exception      InputStream istr = getClass().getResourceAsStr[More]

Raise without Handler error when printing pdf files in Outlook

Category:DefaultRelease time:2015-10-11Views:130

At work sometimes I'm asked to print emails with tons of attachments, but when I attempt to print the email with the attachments through outlook, anytime there is a PDF attached, I get the "Raise without Handler!" error and also the following wi[More]

Handle the "No matches were found." when doing a search in Adobe Acrobat PDF file.

Category:DefaultRelease time:2015-10-11Views:130

I have written an Excel spread sheet and using visual basic coding in my macro can open an as needed PDF file, search for a paragraph number as copied from the spread sheet, capture the page in the PDF file it is found on and paste the "pagefound&quo[More]

Acrobat 4.0 possible patch to handle newer .pdf files?

Category:DefaultRelease time:2015-10-11Views:130

I am currently at a small printing company that uses a Heidelberg Prosetter and interconnected software programs for platemaking in our pre-press department. We currently have an outdated Heidelberg meta dimension system that I was told will only han[More]

Unable to make Acrobat X the default handler/opener of PDF files on a Windows 8 laptop with Acrobat Reader also installed.

Category:DefaultRelease time:2015-10-11Views:130

I have a user with a Windows 8 Sony Vaio laptop with Microsoft Office 2013 Professional, Acrobat X Standard, and Acrobat Reader installed. Another program on his system requires Acrobat Reader so we cannot just remove that and keep it off the system.[More]

XMP Standard - Is there a tool for non-professionals to handle PDF files for free?

Category:DefaultRelease time:2015-10-11Views:130

I'd like to start organising my various files and I wonder if I could include PDF files into the process (it seems easier with graphics), possibly also some video or audio files in the future. I hope there's a tool, not onle for IT specialists to han[More]

PDF Preview Handler will not open 1 file

Category:DefaultRelease time:-0001-11-30Views:130

Hi, I have Office 2013 and Acrobat XI, the PDF Handler works fine on all my files except one. Through our online ordering, I get a confirmation email with E-Order.pdf with every confirmation, worked for a while and now gives me the "This file cannot[More]

How to open PDF file generated by some ashx handler using POST parameters in Internet Explorer for W

Category:DefaultRelease time:-0001-11-30Views:130

I need to print content of pdf file by JavaScript. To do this used HTML like this: <OBJECT id = "Pdf" data = 'http://someurl.com/getpdf.ashx' name="Pdf2" WIDTH="300" HEIGHT="300"></OBJECT> <a onclick=[More]

How to open report.pdf file? getting error message file cannot be previewed pdf preview handler

Category:DefaultRelease time:2015-10-11Views:130

how can I open a report.pdf file that shows error: file cannot be previewed because of an error w/ pdf preview handlerHi pfmercerville, If you are running the 64-bit version of Windows 7 (or Vista), you will find that your PDF files do not preview in[More]

File handles don't close when the pdf is closed?

Category:DefaultRelease time:2015-10-11Views:130

Using Acrobat X on Windows 7 Pro in a networked environment. Once I open a PDF file in Acrobat, as long as I have acrobat running, (even after I have closed the file and moved on) I cannot change/move/rename the file. Since I spend a lot of time revi[More]

Hot
Hi All, I need one help. In one of my program, I am using something like this fnd_request.submit_request ()-prog A fnd_request.submit_request ()-prog B fnd_request.submit_request ()-prog c now I want prog A,B and C to use same session. the moment I u [More]
Trying to Install RMS application 13.2.2 and I get past the pre-installation checks and when I get to the Data Source details and enter the data source details with the check box checked to validate the schema/Test Data Source I get the following err [More]
I have a Microsoft Word 2007 document with headers and footers. When I use the PDFMaker icon to create a PDF for Acrobat 9, I need the headers and footers to be included in the Tags panel and to have a number in the Order panel. However, the header a [More]
Hi Experts, my issue is the following: We try to create a purchase order in SRM with a local mapped category (mapped to the local srm system) and depending on the user the target system should be overwritten in BADI bbp_determine_logsys to get the pu [More]
I've tried various methods but to no avail. I have a pdf document and within the pdf I'd like to embed a couple pdf documents so that all the user has to do is double click on the pdf object inside the pdf and it opens in a new window. I've tried usi [More]
In the last week I've been having a problem on my iphone 3gs. The emails from my icloud account are not being seen as read when I have already read or deleted them on my macbook or ipad. I have tried turning off mail for the icloud and turning it bac [More]
Hi, We are doing upgrade from ECC 6.0 to ENHP4. We are seeing that SAP has inserted a field in the middle in BSEG  table. Since it has inserted in the BSEG, not sure it would cause any table conversion or not. How do we prevent table conversion in th [More]
ITunes won't let me download TV shows I've purchased, giving me an "Upgrade to iTunes 7.6. I can't bypass this message and not install. However, when I try to install 7.6 I'm told it doesn't work on XP 64 bit. Any ideas? (I'm managing to function wit [More]
BRAND NEW 3GS 16 gig, version 3.1.2, 2 days old, IS NOT JAIL BROKEN!! HERE is what happens, I turn it off while battery at 25 percent, then power back on, shows 12 percent, and LOW BAT DISMISS window pops up. If I let it sit for 3 seconds, the percen [More]
Hi Experts, I enhanced one Module Pool Prog., which contains 3 parts i.e. 1 - Main Module Prog. 2- Top include 3- One error report prog. i.e. executable prog. So, Now, I need to move this main Module prog. to TEST box, So, 1) I guess I need to move t [More]