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
BE WARNED: I sent in my iPod (4th gen) for repair under warranty, and it was returned unrepaired on the grounds that liquid had got into the headphone jack and triggered the 'liquid submersion indicator'. The only liquid that could have got in there [More]
i was wondering if this is a hardware problem with my phone since it is a refurbished one, or if it has happened to other people as well.How are you trying to accomplish these two tasks? The correct way is as follows: Camera zoom: pinch with your fin [More]
In my previous place I had all my Mac Book, iphone and iPad connected through the wireless router. Now in my new place my macbook is connecting occasionally, and my iphone and ipad are not connecting at all, although in "settings" it looks that [More]
All of my apple items are registered to iCloud using one account. Then when I updated my phone to iOS 6, it automatically registered my phone to iCloud using my old mobile me email. So, my phone isn't streaming to computer, etc. Can I just delete the [More]
How can I back up only iTunes and iPhoto, so I can reformat my computer and restore the files in these two programs?  I have an external, but its not big enough to create a time machine copy of my HDD.  I have an iMac running OS X Yosemite 10.10.1.  [More]
Hi Friends, I have created a screen using screen painter. The screen is having 4 tabs (subscreen) and in all the subscreen, i have used table control to insert multiple lines in the table. The problem I am getting is that, the data of table control p [More]
How do you update to ios 5.1.1 on iphone 3gs that has no software update feature?Open itunes, connect iphone.Read other 2 answers [More]
Hallo, in Bedinungshilfen, wenn ich das Menü Speakable Items markiere tauchen keine Einstellungen auf.In my experience it is simply unusable, SIRI on iOS can do a very good job of my very clear Scottish accent, Dictation even works really quite well [More]
Ok...I'm using InDesign CS4. My layers panel is completely empty, grayed out, with no option to add a layer or do anything within the panel. Any clue why this is happening? It's driving me nuts! Thanks in advance for the help. KatieShould have known. [More]
Hi, I'm almost ready to submit an iPad app to Apple but have an issue with the stage rotating during startup. My app is configured to use landscape mode, fullscreen turned on, auto-orient turned off, selected device iPad. When yo launch the app it sh [More]